[LVI] Speculative fix for assertion seen in clang bots
authorPhilip Reames <listmail@philipreames.com>
Tue, 26 Apr 2016 22:31:53 +0000 (22:31 +0000)
committerPhilip Reames <listmail@philipreames.com>
Tue, 26 Apr 2016 22:31:53 +0000 (22:31 +0000)
I'll clean this up and add a test case shortly.  I want to make sure this does actually fix the bots; if not, I'll revert.

llvm-svn: 267617

llvm/lib/Analysis/LazyValueInfo.cpp

index 4abb098..5f1d179 100644 (file)
@@ -1013,6 +1013,12 @@ bool LazyValueInfoCache::solveBlockValueCast(LVILatticeVal &BBLV,
 
   const unsigned OperandBitWidth =
     BBI->getOperand(0)->getType()->getPrimitiveSizeInBits();
+  if (OperandBitWidth == 0) {
+    // Without knowing how wide the input is, we can't analyze it in any useful
+    // way.  
+    BBLV.markOverdefined();
+    return true;
+  }
   
   ConstantRange LHSRange = ConstantRange(OperandBitWidth);
   if (hasBlockValue(BBI->getOperand(0), BB)) {