[PATCH] D29200: [JumpThread] Enhance finding partial redundant loads by continuing scanning single predecessor

Renato Golin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 30 05:14:14 PST 2017

rengolin added inline comments.

Comment at: lib/Transforms/Scalar/JumpThreading.cpp:1009
+    // precessor.
+    BasicBlock *CurPredBB = PredBB;
+    BasicBlock *SinglePredPredBB = PredBB->getSinglePredecessor();
Why not just transform the single access above into the loop below? Why do you need both?

Comment at: test/Transforms/JumpThreading/thread-loads.ll:312
+; CHECK-NOT: load
+; CHECK: %l2 = phi i64 [ %[[L1]], %cond1 ]
+; CHECK-LABEL: cond3:
Is this just the `phi`, or is there also a call to `fn2(%l2)`?

If `c1/c3` is false and `c2` is true, then only `fn2` is called, not `fn3`, which means the new `cond3` block has to be only conditionalised via `c1` not `c2`, as in the original IR.

Comment at: test/Transforms/JumpThreading/thread-loads.ll:326
+  %l2 = load i64, i64* %P
+  call void @fn2(i64 %l2)
Isn't there just one hop here? `%l2 -> %l1`?

I thought you were testing multiple predecessors.


More information about the llvm-commits mailing list