[llvm] r259446 - [LVI] Fix a latent bug in getValueAt
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 1 16:45:30 PST 2016
Date: Mon Feb 1 18:45:30 2016
New Revision: 259446
[LVI] Fix a latent bug in getValueAt
This routine was returning Undefined for most queries. This was utterly wrong. Amusingly, we do not appear to have any callers of this which are actually trying to exploit unreachable code or this would have broken the world.
A better approach would be to explicit describe the intersection of facts. That's blocked behind http://reviews.llvm.org/D14476 and I wanted to fix the current bug.
--- llvm/trunk/lib/Analysis/LazyValueInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/LazyValueInfo.cpp Mon Feb 1 18:45:30 2016
@@ -1128,6 +1128,14 @@ LVILatticeVal LazyValueInfoCache::getVal
Result = getFromRangeMetadata(I);
mergeAssumeBlockValueConstantRange(V, Result, CxtI);
+ // Note: What's actually happening here is that we're starting at overdefined
+ // and then intersecting two different types of facts. The code is not
+ // structured that way (FIXME), and we need to take particular care to not
+ // let the undefined state escape since we have *not* proven the particular
+ // value to be unreachable at the context instruction.
+ if (Result.isUndefined())
DEBUG(dbgs() << " Result = " << Result << "\n");
More information about the llvm-commits