[PATCH] D31035: Call isGuaranteedToTransferExecutionToSuccessor on each instruction

Aditya Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 16 09:47:56 PDT 2017


hiraditya created this revision.

w.r.t. https://bugs.llvm.org/show_bug.cgi?id=32153
The consensus seems to be isGuaranteedToTransferExecutionToSuccessor should be called for each function.


https://reviews.llvm.org/D31035

Files:
  llvm/lib/Transforms/Scalar/GVNHoist.cpp


Index: llvm/lib/Transforms/Scalar/GVNHoist.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/GVNHoist.cpp
+++ llvm/lib/Transforms/Scalar/GVNHoist.cpp
@@ -907,7 +907,10 @@
         // Do not value number terminator instructions.
         if (isa<TerminatorInst>(&I1))
           break;
-
+        // If I1 cannot guarantee progress, subsequent instructions
+        // in BB cannot be hoisted anyways.
+        if (!isGuaranteedToTransferExecutionToSuccessor(&I1))
+          break;
         if (auto *Load = dyn_cast<LoadInst>(&I1))
           LI.insert(Load, VN);
         else if (auto *Store = dyn_cast<StoreInst>(&I1))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31035.92011.patch
Type: text/x-patch
Size: 676 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170316/5adc3cda/attachment.bin>


More information about the llvm-commits mailing list