[llvm-commits] [llvm] r123562 - in /llvm/trunk: lib/Analysis/ConstantFolding.cpp test/Transforms/InstCombine/crash.ll
Chris Lattner
sabre at nondot.org
Sat Jan 15 19:43:53 PST 2011
Author: lattner
Date: Sat Jan 15 21:43:53 2011
New Revision: 123562
URL: http://llvm.org/viewvc/llvm-project?rev=123562&view=rev
Log:
fix PR8983, a broken assertion.
Modified:
llvm/trunk/lib/Analysis/ConstantFolding.cpp
llvm/trunk/test/Transforms/InstCombine/crash.ll
Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=123562&r1=123561&r2=123562&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original)
+++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Sat Jan 15 21:43:53 2011
@@ -581,7 +581,7 @@
if (NumOps == 2 &&
cast<PointerType>(ResultTy)->getElementType()->isIntegerTy(8)) {
ConstantExpr *CE = dyn_cast<ConstantExpr>(Ops[1]);
- assert(CE->getType() == IntPtrTy &&
+ assert((CE == 0 || CE->getType() == IntPtrTy) &&
"CastGEPIndices didn't canonicalize index types!");
if (CE && CE->getOpcode() == Instruction::Sub &&
CE->getOperand(0)->isNullValue()) {
Modified: llvm/trunk/test/Transforms/InstCombine/crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/crash.ll?rev=123562&r1=123561&r2=123562&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/crash.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/crash.ll Sat Jan 15 21:43:53 2011
@@ -341,3 +341,15 @@
%select = select i1 %cmp, double 2.000000e+00, double 3.141592e+00
ret double %select
}
+
+
+; PR8983
+%struct.basic_ios = type { i8 }
+
+define %struct.basic_ios *@test17() ssp {
+entry:
+ %add.ptr.i = getelementptr i8* null, i64 undef
+ %0 = bitcast i8* %add.ptr.i to %struct.basic_ios*
+ ret %struct.basic_ios* %0
+}
+
More information about the llvm-commits
mailing list