[PATCH] D125574: [BasicBlockUtils] Do not move loop metadata if outer loop header.

Hendrik Greving via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 23 07:32:38 PDT 2022


hgreving added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/BasicBlockUtils.cpp:1162
+    Loop *IL = LI->getLoopFor(OldLatch);
+    // It's still possible that OldLatch is the latch of another inner loop, in
+    // which case we do not move the metadata.
----------------
fhahn wrote:
> So the interesting case is when the original latch is shared between multiple loops. At the moment, we move the metadata to the new latch of the outer loop. With this patch we keep it at the latch of the inneer loop, which won't be the latch of the outer loop any longer.
> 
> I am not sure if either option is more correct/better than the other.
> 
> Should we duplicate the metadata and add it to the new latches of both loops? This would be in line with the original IR, where the metadata applied to both loops.
You're right, I think we should copy the metadata. I will update the patch.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125574/new/

https://reviews.llvm.org/D125574



More information about the llvm-commits mailing list