bjope added a comment.

In https://reviews.llvm.org/D48721#1150361, @hfinkel wrote:

> In https://reviews.llvm.org/D48721#1150333, @bjope wrote:
>
> > Is the fault that the metadata only should be put on the back edge, not the 
> > branch in the preheader?
>
>
> Yea. Our past thinking has been that any backedge in the loop is valid. The 
> metadata shouldn't end up other places, although it's benign unless those 
> other places are (or may later become) a backedge for some different loop.


I'm no expert on clang. The patch seems to fix the problem if the goal is to 
only add the loop-metadata on the backedge , but I'll leave it to someone else 
to approve it.

I'm a little bit concerned about opt not detecting this kind of problems though.
Would it be possible for some verifier to detect if we have loop metadata on 
some branch that aren't in the latch block?
And/or should the optimization that "merges" two branches with different loop 
metadata), be smarter about which loop metadata to keep? Or maybe we should be 
defensive and discard loop metadata on the merged branch instruction?


Repository:
  rC Clang

https://reviews.llvm.org/D48721



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

Reply via email to