[PATCH] D22779: Clone block with icmp+branch if it likely results in further jump threading

Easwaran Raman via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 18 17:53:03 PDT 2016


eraman added a comment.

Thanks for the comments!


================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:903-904
@@ +902,4 @@
+      for (auto *Pred : predecessors(BB)) {
+        if (LVI->getConstantOnEdge(Cond, Pred, BB) &&
+            TryDuplicatePredsWithUncondBranch(BB))
+          return true;
----------------
haicheng wrote:
> If I understand it correctly,  the predecessor that TryDuplicatePredsWithUncondBranch() finds is the first predecessor that has an unconditional branch.  It may not be Pred here which can provide a constant condition.
Yes. I have fixed it by calling DuplicateBBIntoPreds directly with the right Pred.


https://reviews.llvm.org/D22779





More information about the llvm-commits mailing list