When computing the value on an edge, in certain cases LVI would fail to compute the...
authorOwen Anderson <resistor@mac.com>
Wed, 5 Jan 2011 21:37:18 +0000 (21:37 +0000)
committerOwen Anderson <resistor@mac.com>
Wed, 5 Jan 2011 21:37:18 +0000 (21:37 +0000)
in the predecessor block, leading to an incorrect conclusion for the edge value.  Found by inspection.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122908 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/LazyValueInfo.cpp

index 38355edb83dda8931e3d87c5b6bf55498bce23d7..17348cd028ea21a488e02d0656537aed683b0db8 100644 (file)
@@ -817,6 +817,11 @@ bool LazyValueInfoCache::getEdgeValue(Value *Val, BasicBlock *BBFrom,
           if (!isTrueDest) TrueValues = TrueValues.inverse();
           
           // Figure out the possible values of the query BEFORE this branch.  
+          if (!hasBlockValue(Val, BBFrom)) {
+            block_value_stack.push(std::make_pair(BBFrom, Val));
+            return false;
+          }
+          
           LVILatticeVal InBlock = getBlockValue(Val, BBFrom);
           if (!InBlock.isConstantRange()) {
             Result = LVILatticeVal::getRange(TrueValues);