diff options
author | Philip Reames <listmail@philipreames.com> | 2015-11-04 01:47:04 +0000 |
---|---|---|
committer | Philip Reames <listmail@philipreames.com> | 2015-11-04 01:47:04 +0000 |
commit | aeefae0cc58e3afab940875e466926d90c285929 (patch) | |
tree | aec2f08dfb4722ae0644cc1a3666ebdde664832e /llvm/lib/Analysis/LazyValueInfo.cpp | |
parent | 814fb60130e44ef11b33abe718dac17eb9d972a6 (diff) | |
download | bcm5719-llvm-aeefae0cc58e3afab940875e466926d90c285929.tar.gz bcm5719-llvm-aeefae0cc58e3afab940875e466926d90c285929.zip |
[LVI] Update a comment to clarify what's actually happening and why
llvm-svn: 252033
Diffstat (limited to 'llvm/lib/Analysis/LazyValueInfo.cpp')
-rw-r--r-- | llvm/lib/Analysis/LazyValueInfo.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp index a4e02686ecd..1d50e98c0fd 100644 --- a/llvm/lib/Analysis/LazyValueInfo.cpp +++ b/llvm/lib/Analysis/LazyValueInfo.cpp @@ -1298,9 +1298,28 @@ LazyValueInfo::getPredicateAt(unsigned Pred, Value *V, Constant *C, if (Ret != Unknown) return Ret; - // TODO: Move this logic inside getValueAt so that it can be cached rather - // than re-queried on each call. This would also allow us to merge the - // underlying lattice values to get more information. + // Note: The following bit of code is somewhat distinct from the rest of LVI; + // LVI as a whole tries to compute a lattice value which is conservatively + // correct at a given location. In this case, we have a predicate which we + // weren't able to prove about the merged result, and we're pushing that + // predicate back along each incoming edge to see if we can prove it + // separately for each input. As a motivating example, consider: + // bb1: + // %v1 = ... ; constantrange<1, 5> + // br label %merge + // bb2: + // %v2 = ... ; constantrange<10, 20> + // br label %merge + // merge: + // %phi = phi [%v1, %v2] ; constantrange<1,20> + // %pred = icmp eq i32 %phi, 8 + // We can't tell from the lattice value for '%phi' that '%pred' is false + // along each path, but by checking the predicate over each input separately, + // we can. + // We limit the search to one step backwards from the current BB and value. + // We could consider extending this to search further backwards through the + // CFG and/or value graph, but there are non-obvious compile time vs quality + // tradeoffs. if (CxtI) { BasicBlock *BB = CxtI->getParent(); |