[PATCH] D29200: [JumpThread] Enhance finding partial redundant loads by continuing scanning single predecessor
Jun Bum Lim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 30 13:17:14 PST 2017
junbuml added inline comments.
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.
If c1/c3 is false and c2 is true, only fn2() will be called, so in the new cond2, it unconditionally branch to %end after calling fn2(). I added CHECKs for the branch to %end in cond2 and for the call to fn2(%l2) in cond2.
When %c1 is false, it directly branch to %cond3 from entry. We have this CHECK in entry. So, we only branch to cond2 from cond1 by %c1 when c1/c3 is false.
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.
It's one hop from cond2 to entry, but cond2 -> cond1 -> entry is two hop.
I also added another test which has three hop.
More information about the llvm-commits