hfinkel added a comment.

In https://reviews.llvm.org/D48808#1149828, @Meinersbur wrote:

> In https://reviews.llvm.org/D48808#1149549, @hfinkel wrote:
>
> > In https://reviews.llvm.org/D48808#1149534, @ABataev wrote:
> >
> > >
> >
> >
> > Michael, can you please add a test with two inner loops, one where more 
> > than one is annotated, and one where only the outer loop is annotated? It's 
> > not clear to me that I->setMetadata will do the right thing here in the 
> > former case.
>
>
> The test case `pragma-loop-safety-nested.cpp` check the case where the outer 
> loop is annotated.
>
> Iterating over `Active` will iterate from outer to inner loops, meaning 
> `I->setMetadata` will overwrite the annotation of the outermost loop (which 
> IMHO is the most useful behaviour). Since it not possible to add multiple 
> `!llvm.mem.parallel_loop_access` annotation, we cannot annotate multiple 
> loops.


We specifically defined the metadata to support nested loops. The LangRef says, 
"The llvm.mem.parallel_loop_access metadata refers to a loop identifier, or 
metadata containing a list of loop identifiers for nested loops." To handle 
nested loops, we need to make the instruction metadata point to a list of loop 
IDs.


Repository:
  rC Clang

https://reviews.llvm.org/D48808



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to