[llvm-branch-commits] [llvm-branch] r68501 - in /llvm/branches/Apple/Dib: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2009-04-06-GEP-Index-Crash.ll
Bill Wendling
isanbard at gmail.com
Mon Apr 6 22:07:34 PDT 2009
Author: void
Date: Tue Apr 7 00:07:34 2009
New Revision: 68501
URL: http://llvm.org/viewvc/llvm-project?rev=68501&view=rev
Log:
--- Merging (from foreign repository) r68500 into '.':
A test/Transforms/InstCombine/2009-04-06-GEP-Index-Crash.ll
U lib/Transforms/Scalar/InstructionCombining.cpp
Added:
llvm/branches/Apple/Dib/test/Transforms/InstCombine/2009-04-06-GEP-Index-Crash.ll
Modified:
llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp
Modified: llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp?rev=68501&r1=68500&r2=68501&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp Tue Apr 7 00:07:34 2009
@@ -5216,10 +5216,11 @@
// Convert to correct type.
if (Op->getType() != IntPtrTy) {
if (Constant *OpC = dyn_cast<Constant>(Op))
- Op = ConstantExpr::getSExt(OpC, IntPtrTy);
+ Op = ConstantExpr::getIntegerCast(OpC, IntPtrTy, true);
else
- Op = IC.InsertNewInstBefore(new SExtInst(Op, IntPtrTy,
- Op->getName()+".c"), I);
+ Op = IC.InsertNewInstBefore(CastInst::CreateIntegerCast(Op, IntPtrTy,
+ true,
+ Op->getName()+".c"), I);
}
if (Size != 1) {
Constant *Scale = ConstantInt::get(IntPtrTy, Size);
Added: llvm/branches/Apple/Dib/test/Transforms/InstCombine/2009-04-06-GEP-Index-Crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/Transforms/InstCombine/2009-04-06-GEP-Index-Crash.ll?rev=68501&view=auto
==============================================================================
--- llvm/branches/Apple/Dib/test/Transforms/InstCombine/2009-04-06-GEP-Index-Crash.ll (added)
+++ llvm/branches/Apple/Dib/test/Transforms/InstCombine/2009-04-06-GEP-Index-Crash.ll Tue Apr 7 00:07:34 2009
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis
+; rdar://6762290
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9"
+ %T = type <{ i64, i64, i64 }>
+
+define i32 @test(i8* %start, i32 %X) nounwind {
+entry:
+ %tmp3 = load i64* null ; <i64> [#uses=1]
+ %add.ptr = getelementptr i8* %start, i64 %tmp3 ; <i8*> [#uses=1]
+ %tmp158 = load i32* null ; <i32> [#uses=1]
+ %add.ptr159 = getelementptr %T* null, i32 %tmp158
+ %add.ptr209 = getelementptr i8* %start, i64 0 ; <i8*> [#uses=1]
+ %add.ptr212 = getelementptr i8* %add.ptr209, i32 %X ; <i8*> [#uses=1]
+ %cmp214 = icmp ugt i8* %add.ptr212, %add.ptr ; <i1> [#uses=1]
+ br i1 %cmp214, label %if.then216, label %if.end363
+
+if.then216: ; preds = %for.body162
+ ret i32 1
+
+if.end363: ; preds = %for.body162
+ ret i32 0
+}
More information about the llvm-branch-commits
mailing list