[PATCH] D12383: Teach LVI to look through Phi nodes when trying to prove a predicate
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 26 15:17:36 PDT 2015
reames created this revision.
reames added reviewers: hfinkel, nicholas, sanjoy.
reames added a subscriber: llvm-commits.
If asked to prove a predicate about a value produced by a PHI node, LazyValueInfo was unable to do so even if the predicate was known to be true for each input to the PHI. This prevented JumpThreading from eliminating a provably redundant branch.
The problematic test case looks something like this:
ListNode *p = ...;
while (p != null) {
if (!p) return;
x = g->x; // unrelated
p = p->next
}
The null check at the top of the loop is redundant since the value of 'p' is null checked on entry to the loop and before executing the backedge. This resulted in us a) executing an extra null check per iteration and b) not being able to LICM unrelated loads after the check since we couldn't prove they would execute or that their dereferenceability wasn't effected by the null check on the first iteration.
http://reviews.llvm.org/D12383
Files:
lib/Analysis/LazyValueInfo.cpp
test/Transforms/JumpThreading/phi-known.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12383.33256.patch
Type: text/x-patch
Size: 4383 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150826/42fc9a70/attachment.bin>
More information about the llvm-commits
mailing list