[PATCH] D16669: [LICM] Keep metadata on control equivalent hoists

Igor Laevsky via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 28 06:23:23 PST 2016

igor-laevsky accepted this revision.
igor-laevsky added a comment.
This revision is now accepted and ready to land.

looks good

Comment at: lib/Transforms/Scalar/LICM.cpp:736-739
@@ -725,3 +735,6 @@
   // Metadata can be dependent on the condition we are hoisting above.
-  // Conservatively strip all metadata on the instruction.
-  I.dropUnknownNonDebugMetadata();
+  // Conservatively strip all metadata on the instruction unless we were
+  // guaranteed to execute I if we entered the loop, in which case the metadata
+  // is valid in the loop preheader.
+  if (!KeepMetadata)
+    I.dropUnknownNonDebugMetadata();
This could be moved under `if (I.hasMetadataOtherThanDebugLoc())` condition. So that `KeepMetadata` variable is not required. But it looks good either way.


More information about the llvm-commits mailing list