[llvm-commits] [llvm] r111906 - /llvm/trunk/lib/Analysis/LazyValueInfo.cpp
Owen Anderson
resistor at mac.com
Tue Aug 24 00:55:44 PDT 2010
Author: resistor
Date: Tue Aug 24 02:55:44 2010
New Revision: 111906
URL: http://llvm.org/viewvc/llvm-project?rev=111906&view=rev
Log:
Don't assume that all constants with integer types are ConstantInts.
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=111906&r1=111905&r2=111906&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LazyValueInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/LazyValueInfo.cpp Tue Aug 24 02:55:44 2010
@@ -216,6 +216,8 @@
return markOverdefined();
else
return markConstantRange(NewR);
+ } else if (!isUndefined()) {
+ return markOverdefined();
}
assert(isUndefined() && "Unexpected lattice");
@@ -541,7 +543,12 @@
ConstantRange RHSRange(1);
const IntegerType *ResultTy = cast<IntegerType>(BBI->getType());
if (isa<BinaryOperator>(BBI)) {
- RHS = cast<ConstantInt>(BBI->getOperand(1));
+ RHS = dyn_cast<ConstantInt>(BBI->getOperand(1));
+ if (!RHS) {
+ Result.markOverdefined();
+ return Result;
+ }
+
RHSRange = ConstantRange(RHS->getValue(), RHS->getValue()+1);
}
@@ -842,7 +849,9 @@
}
if (Result.isConstantRange()) {
- ConstantInt *CI = cast<ConstantInt>(C);
+ ConstantInt *CI = dyn_cast<ConstantInt>(C);
+ if (!CI) return Unknown;
+
ConstantRange CR = Result.getConstantRange();
if (Pred == ICmpInst::ICMP_EQ) {
if (!CR.contains(CI->getValue()))
More information about the llvm-commits
mailing list