[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
Author: reames
Date: Mon Feb 1 18:45:30 2016
New Revision: 259446
URL: http://llvm.org/viewvc/llvm-project?rev=259446&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Analysis/LazyValueInfo.cpp
Modified: llvm/trunk/lib/Analysis/LazyValueInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LazyValueInfo.cpp?rev=259446&r1=259445&r2=259446&view=diff
==============================================================================
--- 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())
+ Result.markOverdefined();
+
DEBUG(dbgs() << " Result = " << Result << "\n");
return Result;
}
More information about the llvm-commits
mailing list