[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-svn: 259446
This commit is contained in:
Philip Reames 2016-02-02 00:45:30 +00:00
parent 796fb93f27
commit 3e0d414c24

View File

@ -1128,6 +1128,14 @@ LVILatticeVal LazyValueInfoCache::getValueAt(Value *V, Instruction *CxtI) {
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;
}