diff options
author | Chris Lattner <sabre@nondot.org> | 2009-08-30 21:31:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-08-30 21:31:34 +0000 |
commit | 4007241607fdfd38c73d059285c24c2eb4873f8c (patch) | |
tree | edd9f19338aae8254ef4511e983c86e32cb0a2a1 /test | |
parent | 4a1fadaf5207e46d19c64e5773ff8d9e65e607d7 (diff) | |
download | external_llvm-4007241607fdfd38c73d059285c24c2eb4873f8c.zip external_llvm-4007241607fdfd38c73d059285c24c2eb4873f8c.tar.gz external_llvm-4007241607fdfd38c73d059285c24c2eb4873f8c.tar.bz2 |
suck a bunch more gep tests into getelementptr.ll and filecheckize them all.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80517 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
19 files changed, 271 insertions, 813 deletions
diff --git a/test/Transforms/InstCombine/2002-09-17-GetElementPtrCrash.ll b/test/Transforms/InstCombine/2002-09-17-GetElementPtrCrash.ll deleted file mode 100644 index 5b127d7..0000000 --- a/test/Transforms/InstCombine/2002-09-17-GetElementPtrCrash.ll +++ /dev/null @@ -1,12 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine - - %bob = type { i32 } - -define i32 @alias() { - %pbob1 = alloca %bob ; <%bob*> [#uses=1] - %pbob2 = getelementptr %bob* %pbob1 ; <%bob*> [#uses=1] - %pbobel = getelementptr %bob* %pbob2, i64 0, i32 0 ; <i32*> [#uses=1] - %rval = load i32* %pbobel ; <i32> [#uses=1] - ret i32 %rval -} - diff --git a/test/Transforms/InstCombine/2003-06-22-ConstantExprCrash.ll b/test/Transforms/InstCombine/2003-06-22-ConstantExprCrash.ll deleted file mode 100644 index d6cacec..0000000 --- a/test/Transforms/InstCombine/2003-06-22-ConstantExprCrash.ll +++ /dev/null @@ -1,13 +0,0 @@ -; This is a bug in the VMcode library, not instcombine, it's just convenient -; to expose it here. - -; RUN: llvm-as < %s | opt -instcombine -disable-output - -@A = global i32 1 ; <i32*> [#uses=1] -@B = global i32 2 ; <i32*> [#uses=1] - -define i1 @test() { - %C = icmp ult i32* getelementptr (i32* @A, i64 1), getelementptr (i32* @B, i64 2) ; <i1> [#uses=1] - ret i1 %C -} - diff --git a/test/Transforms/InstCombine/2003-10-23-InstcombineNullFail.ll b/test/Transforms/InstCombine/2003-10-23-InstcombineNullFail.ll deleted file mode 100644 index 7daf7cb..0000000 --- a/test/Transforms/InstCombine/2003-10-23-InstcombineNullFail.ll +++ /dev/null @@ -1,12 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep false -; -; This actually looks like a constant propagation bug - -%X = type { [10 x i32], float } - -define i1 @test() { - %A = getelementptr %X* null, i64 0, i32 0, i64 0 ; <i32*> [#uses=1] - %B = icmp ne i32* %A, null ; <i1> [#uses=1] - ret i1 %B -} - diff --git a/test/Transforms/InstCombine/2004-12-08-InstCombineCrash.ll b/test/Transforms/InstCombine/2004-12-08-InstCombineCrash.ll deleted file mode 100644 index 5908205..0000000 --- a/test/Transforms/InstCombine/2004-12-08-InstCombineCrash.ll +++ /dev/null @@ -1,14 +0,0 @@ -; RUN: llvm-as %s -o - | opt -instcombine - - -%"java/lang/Object" = type { %struct.llvm_java_object_base } -%"java/lang/StringBuffer" = type { %"java/lang/Object", i32, { %"java/lang/Object", i32, [0 x i16] }*, i1 } -%struct.llvm_java_object_base = type opaque - -define void @"java/lang/StringBuffer/append(Ljava/lang/String;)Ljava/lang/StringBuffer;"() { -bc0: - %tmp53 = getelementptr %"java/lang/StringBuffer"* null, i32 0, i32 1 ; <i32*> [#uses=1] - store i32 0, i32* %tmp53 - ret void -} - diff --git a/test/Transforms/InstCombine/2006-02-07-SextZextCrash.ll b/test/Transforms/InstCombine/2006-02-07-SextZextCrash.ll deleted file mode 100644 index d7df5a0..0000000 --- a/test/Transforms/InstCombine/2006-02-07-SextZextCrash.ll +++ /dev/null @@ -1,21 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output - - %struct.rtx_const = type { i32, { %union.real_extract } } - %struct.rtx_def = type { i32, [1 x %union.rtunion_def] } - %union.real_extract = type { double } - %union.rtunion_def = type { i32 } - -define fastcc void @decode_rtx_const(%struct.rtx_def* %x, %struct.rtx_const* %value) { - %tmp.54 = getelementptr %struct.rtx_const* %value, i32 0, i32 0 ; <i32*> [#uses=1] - %tmp.56 = getelementptr %struct.rtx_def* %x, i32 0, i32 0 ; <i32*> [#uses=1] - %tmp.57 = load i32* %tmp.56 ; <i32> [#uses=1] - %tmp.58 = shl i32 %tmp.57, 8 ; <i32> [#uses=1] - %tmp.59 = ashr i32 %tmp.58, 24 ; <i32> [#uses=1] - %tmp.60 = trunc i32 %tmp.59 to i16 ; <i16> [#uses=1] - %tmp.61 = zext i16 %tmp.60 to i32 ; <i32> [#uses=1] - %tmp.62 = shl i32 %tmp.61, 16 ; <i32> [#uses=1] - %tmp.65 = or i32 0, %tmp.62 ; <i32> [#uses=1] - store i32 %tmp.65, i32* %tmp.54 - ret void -} - diff --git a/test/Transforms/InstCombine/2006-06-28-infloop.ll b/test/Transforms/InstCombine/2006-06-28-infloop.ll deleted file mode 100644 index 84e7510..0000000 --- a/test/Transforms/InstCombine/2006-06-28-infloop.ll +++ /dev/null @@ -1,20 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output - -target datalayout = "E-p:32:32" -target triple = "powerpc-apple-darwin8" - -define void @test() { -entry: - %tmp = getelementptr { i64, i64, i64, i64 }* null, i32 0, i32 3 ; <i64*> [#uses=1] - %tmp.upgrd.1 = load i64* %tmp ; <i64> [#uses=1] - %tmp8.ui = load i64* null ; <i64> [#uses=1] - %tmp8 = bitcast i64 %tmp8.ui to i64 ; <i64> [#uses=1] - %tmp9 = and i64 %tmp8, %tmp.upgrd.1 ; <i64> [#uses=1] - %sext = trunc i64 %tmp9 to i32 ; <i32> [#uses=1] - %tmp27.i = sext i32 %sext to i64 ; <i64> [#uses=1] - tail call void @foo( i32 0, i64 %tmp27.i ) - unreachable -} - -declare void @foo(i32, i64) - diff --git a/test/Transforms/InstCombine/2006-09-11-EmptyStructCrash.ll b/test/Transforms/InstCombine/2006-09-11-EmptyStructCrash.ll deleted file mode 100644 index bf9252a..0000000 --- a/test/Transforms/InstCombine/2006-09-11-EmptyStructCrash.ll +++ /dev/null @@ -1,46 +0,0 @@ -; PR905 -; RUN: llvm-as < %s | opt -instcombine -disable-output -; END. - -%RPYTHON_EXCEPTION = type { %RPYTHON_EXCEPTION_VTABLE* } -%RPYTHON_EXCEPTION_VTABLE = type { %RPYTHON_EXCEPTION_VTABLE*, i32, i32, %RPyOpaque_RuntimeTypeInfo*, %arraytype_Char*, %functiontype_12* } -%RPyOpaque_RuntimeTypeInfo = type opaque* -%arraytype_Char = type { i32, [0 x i8] } -%fixarray_array1019 = type [1019 x i8*] -%functiontype_12 = type %RPYTHON_EXCEPTION* () -%functiontype_14 = type void (%structtype_pypy.rpython.memory.gc.MarkSweepGC*) -%structtype_AddressLinkedListChunk = type { %structtype_AddressLinkedListChunk*, i32, %fixarray_array1019 } -%structtype_exceptions.Exception = type { %RPYTHON_EXCEPTION } -%structtype_gc_pool = type { } -%structtype_gc_pool_node = type { %structtype_header*, %structtype_gc_pool_node* } -%structtype_header = type { i32, %structtype_header* } -%structtype_pypy.rpython.memory.gc.MarkSweepGC = type { %structtype_exceptions.Exception, i32, i32, i1, %structtype_gc_pool*, i32, %structtype_header*, %structtype_header*, %structtype_gc_pool_node*, double, double } - -define fastcc void @pypy_MarkSweepGC.collect() { -block0: - %v1221 = load %structtype_AddressLinkedListChunk** null ; <%structtype_AddressLinkedListChunk*> [#uses=1] - %v1222 = icmp ne %structtype_AddressLinkedListChunk* %v1221, null ; <i1> [#uses=1] - br i1 %v1222, label %block79, label %block4 - -block4: ; preds = %block0 - ret void - -block22: ; preds = %block79 - ret void - -block67: ; preds = %block79 - %v1459 = load %structtype_gc_pool** null ; <%structtype_gc_pool*> [#uses=1] - %v1460 = bitcast %structtype_gc_pool* %v1459 to i8* ; <i8*> [#uses=1] - %tmp_873 = ptrtoint i8* %v1460 to i32 ; <i32> [#uses=1] - %tmp_874 = sub i32 %tmp_873, 0 ; <i32> [#uses=1] - %v1461 = inttoptr i32 %tmp_874 to i8* ; <i8*> [#uses=1] - %v1462 = bitcast i8* %v1461 to %structtype_header* ; <%structtype_header*> [#uses=1] - %tmp_876 = getelementptr %structtype_header* %v1462, i32 0, i32 0 ; <i32*> [#uses=1] - store i32 0, i32* %tmp_876 - ret void - -block79: ; preds = %block0 - %v1291 = load %structtype_gc_pool** null ; <%structtype_gc_pool*> [#uses=1] - %v1292 = icmp ne %structtype_gc_pool* %v1291, null ; <i1> [#uses=1] - br i1 %v1292, label %block67, label %block22 -} diff --git a/test/Transforms/InstCombine/2006-12-10-ICmp-GEP-GEP.ll b/test/Transforms/InstCombine/2006-12-10-ICmp-GEP-GEP.ll deleted file mode 100644 index 15f7362..0000000 --- a/test/Transforms/InstCombine/2006-12-10-ICmp-GEP-GEP.ll +++ /dev/null @@ -1,162 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ -; RUN: grep -v {icmp ult i32} -; END. - -target datalayout = "e-p:32:32" -target triple = "i686-pc-linux-gnu" - %struct.edgeBox = type { i16, i16, i16, i16, i16, i16 } -@qsz = external global i32 ; <i32*> [#uses=12] -@thresh = external global i32 ; <i32*> [#uses=2] -@mthresh = external global i32 ; <i32*> [#uses=1] - -define i32 @qsorte(i8* %base, i32 %n, i32 %size) { -entry: - %tmp = icmp sgt i32 %n, 1 ; <i1> [#uses=1] - br i1 %tmp, label %cond_next, label %return - -cond_next: ; preds = %entry - store i32 %size, i32* @qsz - %tmp3 = shl i32 %size, 2 ; <i32> [#uses=1] - store i32 %tmp3, i32* @thresh - %tmp4 = load i32* @qsz ; <i32> [#uses=1] - %tmp5 = mul i32 %tmp4, 6 ; <i32> [#uses=1] - store i32 %tmp5, i32* @mthresh - %tmp6 = load i32* @qsz ; <i32> [#uses=1] - %tmp8 = mul i32 %tmp6, %n ; <i32> [#uses=1] - %tmp9 = getelementptr i8* %base, i32 %tmp8 ; <i8*> [#uses=3] - %tmp11 = icmp sgt i32 %n, 3 ; <i1> [#uses=1] - br i1 %tmp11, label %cond_true12, label %bb30 - -cond_true12: ; preds = %cond_next - %tmp156 = call i32 @qste( i8* %base, i8* %tmp9 ) ; <i32> [#uses=0] - %tmp16 = load i32* @thresh ; <i32> [#uses=1] - %tmp18 = getelementptr i8* %base, i32 %tmp16 ; <i8*> [#uses=2] - %tmp3117 = load i32* @qsz ; <i32> [#uses=1] - %tmp3318 = getelementptr i8* %base, i32 %tmp3117 ; <i8*> [#uses=2] - %tmp3621 = icmp ult i8* %tmp3318, %tmp18 ; <i1> [#uses=1] - br i1 %tmp3621, label %bb, label %bb37 - -bb: ; preds = %bb30, %cond_true12 - %hi.0.0 = phi i8* [ %tmp18, %cond_true12 ], [ %hi.0, %bb30 ] ; <i8*> [#uses=4] - %j.1.0 = phi i8* [ %base, %cond_true12 ], [ %j.1, %bb30 ] ; <i8*> [#uses=4] - %tmp33.0 = phi i8* [ %tmp3318, %cond_true12 ], [ %tmp33, %bb30 ] ; <i8*> [#uses=6] - %tmp3.upgrd.1 = bitcast i8* %j.1.0 to %struct.edgeBox* ; <%struct.edgeBox*> [#uses=1] - %tmp4.upgrd.2 = bitcast i8* %tmp33.0 to %struct.edgeBox* ; <%struct.edgeBox*> [#uses=1] - %tmp255 = call i32 @comparee( %struct.edgeBox* %tmp3.upgrd.1, %struct.edgeBox* %tmp4.upgrd.2 ) ; <i32> [#uses=1] - %tmp26 = icmp sgt i32 %tmp255, 0 ; <i1> [#uses=1] - br i1 %tmp26, label %cond_true27, label %bb30 - -cond_true27: ; preds = %bb - br label %bb30 - -bb30: ; preds = %cond_true27, %bb, %cond_next - %hi.0.3 = phi i8* [ %hi.0.0, %cond_true27 ], [ %hi.0.0, %bb ], [ undef, %cond_next ] ; <i8*> [#uses=0] - %j.1.3 = phi i8* [ %j.1.0, %cond_true27 ], [ %j.1.0, %bb ], [ undef, %cond_next ] ; <i8*> [#uses=0] - %tmp33.3 = phi i8* [ %tmp33.0, %cond_true27 ], [ %tmp33.0, %bb ], [ undef, %cond_next ] ; <i8*> [#uses=0] - %hi.0 = phi i8* [ %tmp9, %cond_next ], [ %hi.0.0, %bb ], [ %hi.0.0, %cond_true27 ] ; <i8*> [#uses=2] - %lo.1 = phi i8* [ %tmp33.0, %cond_true27 ], [ %tmp33.0, %bb ], [ %base, %cond_next ] ; <i8*> [#uses=1] - %j.1 = phi i8* [ %tmp33.0, %cond_true27 ], [ %j.1.0, %bb ], [ %base, %cond_next ] ; <i8*> [#uses=2] - %tmp31 = load i32* @qsz ; <i32> [#uses=1] - %tmp33 = getelementptr i8* %lo.1, i32 %tmp31 ; <i8*> [#uses=2] - %tmp36 = icmp ult i8* %tmp33, %hi.0 ; <i1> [#uses=1] - br i1 %tmp36, label %bb, label %bb37 - -bb37: ; preds = %bb30, %cond_true12 - %j.1.1 = phi i8* [ %j.1, %bb30 ], [ %base, %cond_true12 ] ; <i8*> [#uses=4] - %tmp40 = icmp eq i8* %j.1.1, %base ; <i1> [#uses=1] - br i1 %tmp40, label %bb115, label %cond_true41 - -cond_true41: ; preds = %bb37 - %tmp43 = load i32* @qsz ; <i32> [#uses=1] - %tmp45 = getelementptr i8* %base, i32 %tmp43 ; <i8*> [#uses=2] - %tmp6030 = icmp ult i8* %base, %tmp45 ; <i1> [#uses=1] - br i1 %tmp6030, label %bb46, label %bb115 - -bb46: ; preds = %bb46, %cond_true41 - %j.2.0 = phi i8* [ %j.1.1, %cond_true41 ], [ %tmp52, %bb46 ] ; <i8*> [#uses=3] - %i.2.0 = phi i8* [ %base, %cond_true41 ], [ %tmp56, %bb46 ] ; <i8*> [#uses=3] - %tmp.upgrd.3 = load i8* %j.2.0 ; <i8> [#uses=2] - %tmp49 = load i8* %i.2.0 ; <i8> [#uses=1] - store i8 %tmp49, i8* %j.2.0 - %tmp52 = getelementptr i8* %j.2.0, i32 1 ; <i8*> [#uses=2] - store i8 %tmp.upgrd.3, i8* %i.2.0 - %tmp56 = getelementptr i8* %i.2.0, i32 1 ; <i8*> [#uses=3] - %tmp60 = icmp ult i8* %tmp56, %tmp45 ; <i1> [#uses=1] - br i1 %tmp60, label %bb46, label %bb115 - -bb66: ; preds = %bb115, %bb66 - %hi.3 = phi i8* [ %tmp118, %bb115 ], [ %tmp70, %bb66 ] ; <i8*> [#uses=2] - %tmp67 = load i32* @qsz ; <i32> [#uses=2] - %tmp68 = sub i32 0, %tmp67 ; <i32> [#uses=1] - %tmp70 = getelementptr i8* %hi.3, i32 %tmp68 ; <i8*> [#uses=2] - %tmp.upgrd.4 = bitcast i8* %tmp70 to %struct.edgeBox* ; <%struct.edgeBox*> [#uses=1] - %tmp1 = bitcast i8* %tmp118 to %struct.edgeBox* ; <%struct.edgeBox*> [#uses=1] - %tmp732 = call i32 @comparee( %struct.edgeBox* %tmp.upgrd.4, %struct.edgeBox* %tmp1 ) ; <i32> [#uses=1] - %tmp74 = icmp sgt i32 %tmp732, 0 ; <i1> [#uses=1] - br i1 %tmp74, label %bb66, label %bb75 - -bb75: ; preds = %bb66 - %tmp76 = load i32* @qsz ; <i32> [#uses=1] - %tmp70.sum = sub i32 %tmp76, %tmp67 ; <i32> [#uses=1] - %tmp78 = getelementptr i8* %hi.3, i32 %tmp70.sum ; <i8*> [#uses=3] - %tmp81 = icmp eq i8* %tmp78, %tmp118 ; <i1> [#uses=1] - br i1 %tmp81, label %bb115, label %cond_true82 - -cond_true82: ; preds = %bb75 - %tmp83 = load i32* @qsz ; <i32> [#uses=1] - %tmp118.sum = add i32 %tmp116, %tmp83 ; <i32> [#uses=1] - %tmp85 = getelementptr i8* %min.1, i32 %tmp118.sum ; <i8*> [#uses=1] - %tmp10937 = getelementptr i8* %tmp85, i32 -1 ; <i8*> [#uses=3] - %tmp11239 = icmp ult i8* %tmp10937, %tmp118 ; <i1> [#uses=1] - br i1 %tmp11239, label %bb115, label %bb86 - -bb86: ; preds = %bb104, %cond_true82 - %tmp109.0 = phi i8* [ %tmp10937, %cond_true82 ], [ %tmp109, %bb104 ] ; <i8*> [#uses=5] - %i.5.2 = phi i8* [ %i.5.3, %cond_true82 ], [ %i.5.1, %bb104 ] ; <i8*> [#uses=0] - %tmp100.2 = phi i8* [ %tmp100.3, %cond_true82 ], [ %tmp100.1, %bb104 ] ; <i8*> [#uses=0] - %tmp88 = load i8* %tmp109.0 ; <i8> [#uses=2] - %tmp9746 = load i32* @qsz ; <i32> [#uses=1] - %tmp9847 = sub i32 0, %tmp9746 ; <i32> [#uses=1] - %tmp10048 = getelementptr i8* %tmp109.0, i32 %tmp9847 ; <i8*> [#uses=3] - %tmp10350 = icmp ult i8* %tmp10048, %tmp78 ; <i1> [#uses=1] - br i1 %tmp10350, label %bb104, label %bb91 - -bb91: ; preds = %bb91, %bb86 - %i.5.0 = phi i8* [ %tmp109.0, %bb86 ], [ %tmp100.0, %bb91 ] ; <i8*> [#uses=1] - %tmp100.0 = phi i8* [ %tmp10048, %bb86 ], [ %tmp100, %bb91 ] ; <i8*> [#uses=4] - %tmp93 = load i8* %tmp100.0 ; <i8> [#uses=1] - store i8 %tmp93, i8* %i.5.0 - %tmp97 = load i32* @qsz ; <i32> [#uses=1] - %tmp98 = sub i32 0, %tmp97 ; <i32> [#uses=1] - %tmp100 = getelementptr i8* %tmp100.0, i32 %tmp98 ; <i8*> [#uses=3] - %tmp103 = icmp ult i8* %tmp100, %tmp78 ; <i1> [#uses=1] - br i1 %tmp103, label %bb104, label %bb91 - -bb104: ; preds = %bb91, %bb86 - %i.5.1 = phi i8* [ %tmp109.0, %bb86 ], [ %tmp100.0, %bb91 ] ; <i8*> [#uses=4] - %tmp100.1 = phi i8* [ %tmp10048, %bb86 ], [ %tmp100, %bb91 ] ; <i8*> [#uses=3] - store i8 %tmp88, i8* %i.5.1 - %tmp109 = getelementptr i8* %tmp109.0, i32 -1 ; <i8*> [#uses=3] - %tmp112 = icmp ult i8* %tmp109, %tmp118 ; <i1> [#uses=1] - br i1 %tmp112, label %bb115, label %bb86 - -bb115: ; preds = %bb104, %cond_true82, %bb75, %bb46, %cond_true41, %bb37 - %tmp109.1 = phi i8* [ undef, %bb37 ], [ %tmp109.1, %bb75 ], [ %tmp10937, %cond_true82 ], [ %tmp109, %bb104 ], [ undef, %bb46 ], [ undef, %cond_true41 ] ; <i8*> [#uses=1] - %i.5.3 = phi i8* [ undef, %bb37 ], [ %i.5.3, %bb75 ], [ %i.5.3, %cond_true82 ], [ %i.5.1, %bb104 ], [ undef, %bb46 ], [ undef, %cond_true41 ] ; <i8*> [#uses=3] - %tmp100.3 = phi i8* [ undef, %bb37 ], [ %tmp100.3, %bb75 ], [ %tmp100.3, %cond_true82 ], [ %tmp100.1, %bb104 ], [ undef, %bb46 ], [ undef, %cond_true41 ] ; <i8*> [#uses=3] - %min.1 = phi i8* [ %tmp118, %bb104 ], [ %tmp118, %bb75 ], [ %base, %bb37 ], [ %base, %bb46 ], [ %base, %cond_true41 ], [ %tmp118, %cond_true82 ] ; <i8*> [#uses=2] - %j.5 = phi i8* [ %tmp100.1, %bb104 ], [ %j.5, %bb75 ], [ %tmp52, %bb46 ], [ %j.1.1, %bb37 ], [ %j.1.1, %cond_true41 ], [ %j.5, %cond_true82 ] ; <i8*> [#uses=2] - %i.4 = phi i8* [ %i.5.1, %bb104 ], [ %i.4, %bb75 ], [ %tmp56, %bb46 ], [ undef, %bb37 ], [ %base, %cond_true41 ], [ %i.4, %cond_true82 ] ; <i8*> [#uses=2] - %c.4 = phi i8 [ %tmp88, %bb104 ], [ %c.4, %bb75 ], [ %tmp.upgrd.3, %bb46 ], [ undef, %bb37 ], [ undef, %cond_true41 ], [ %c.4, %cond_true82 ] ; <i8> [#uses=2] - %tmp116 = load i32* @qsz ; <i32> [#uses=2] - %tmp118 = getelementptr i8* %min.1, i32 %tmp116 ; <i8*> [#uses=9] - %tmp122 = icmp ult i8* %tmp118, %tmp9 ; <i1> [#uses=1] - br i1 %tmp122, label %bb66, label %return - -return: ; preds = %bb115, %entry - ret i32 undef -} - -declare i32 @qste(i8*, i8*) - -declare i32 @comparee(%struct.edgeBox*, %struct.edgeBox*) diff --git a/test/Transforms/InstCombine/2007-03-31-InfiniteLoop.ll b/test/Transforms/InstCombine/2007-03-31-InfiniteLoop.ll deleted file mode 100644 index 640f6d5..0000000 --- a/test/Transforms/InstCombine/2007-03-31-InfiniteLoop.ll +++ /dev/null @@ -1,302 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output -; END. - -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" -target triple = "i686-apple-darwin8" - %struct.ZZIP_FILE = type { %struct.zzip_dir*, i32, i32, i32, i32, i32, i32, i64, i8*, i64, %struct.z_stream, %struct.zzip_plugin_io* } - %struct.anon = type { %struct.ZZIP_FILE*, i8* } - %struct.internal_state = type { i32 } - %struct.z_stream = type { i8*, i32, i32, i8*, i32, i32, i8*, %struct.internal_state*, i8* (i8*, i32, i32)*, void (i8*, i8*)*, i8*, i32, i32, i32 } - %struct.zzip_dir = type { i32, i32, i32, %struct.anon, %struct.zzip_dir_hdr*, %struct.zzip_dir_hdr*, %struct.ZZIP_FILE*, %struct.zzip_dirent, i8*, i8*, i8**, %struct.zzip_plugin_io* } - %struct.zzip_dir_hdr = type { i32, i32, i32, i32, i16, i16, i8, i16, [1 x i8] } - %struct.zzip_dirent = type { i32, i32, i32, i16, i8*, i32, i32 } - %struct.zzip_plugin_io = type { i32 (i8*, i32, ...)*, i32 (i32)*, i32 (i32, i8*, i32)*, i64 (i32, i64, i32)*, i64 (i32)*, i32 } - -define %struct.ZZIP_FILE* @zzip_open_shared_io(%struct.ZZIP_FILE* %stream, i8* %filename, i32 %o_flags, i32 %o_modes, i8** %ext, %struct.zzip_plugin_io* %io) { -entry: - %basename = alloca [1024 x i8], align 16 ; <[1024 x i8]*> [#uses=5] - %e = alloca i32, align 4 ; <i32*> [#uses=4] - icmp eq %struct.ZZIP_FILE* %stream, null ; <i1>:0 [#uses=1] - br i1 %0, label %cond_next22, label %cond_true - -cond_true: ; preds = %entry - %tmp3 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1] - %tmp4 = load %struct.zzip_dir** %tmp3 ; <%struct.zzip_dir*> [#uses=1] - icmp eq %struct.zzip_dir* %tmp4, null ; <i1>:1 [#uses=1] - br i1 %1, label %cond_next22, label %cond_true5 - -cond_true5: ; preds = %cond_true - icmp eq i8** %ext, null ; <i1>:2 [#uses=1] - br i1 %2, label %cond_true7, label %cond_next - -cond_true7: ; preds = %cond_true5 - %tmp9 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1] - %tmp10 = load %struct.zzip_dir** %tmp9 ; <%struct.zzip_dir*> [#uses=1] - %tmp11 = getelementptr %struct.zzip_dir* %tmp10, i32 0, i32 10 ; <i8***> [#uses=1] - %tmp12 = load i8*** %tmp11 ; <i8**> [#uses=1] - br label %cond_next - -cond_next: ; preds = %cond_true7, %cond_true5 - %ext_addr.0 = phi i8** [ %ext, %cond_true5 ], [ %tmp12, %cond_true7 ] ; <i8**> [#uses=2] - icmp eq %struct.zzip_plugin_io* %io, null ; <i1>:3 [#uses=1] - br i1 %3, label %cond_true14, label %cond_next22 - -cond_true14: ; preds = %cond_next - %tmp16 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1] - %tmp17 = load %struct.zzip_dir** %tmp16 ; <%struct.zzip_dir*> [#uses=1] - %tmp18 = getelementptr %struct.zzip_dir* %tmp17, i32 0, i32 11 ; <%struct.zzip_plugin_io**> [#uses=1] - %tmp19 = load %struct.zzip_plugin_io** %tmp18 ; <%struct.zzip_plugin_io*> [#uses=1] - br label %cond_next22 - -cond_next22: ; preds = %cond_true14, %cond_next, %cond_true, %entry - %io_addr.0 = phi %struct.zzip_plugin_io* [ %io, %entry ], [ %io, %cond_true ], [ %io, %cond_next ], [ %tmp19, %cond_true14 ] ; <%struct.zzip_plugin_io*> [#uses=2] - %ext_addr.1 = phi i8** [ %ext, %entry ], [ %ext, %cond_true ], [ %ext_addr.0, %cond_next ], [ %ext_addr.0, %cond_true14 ] ; <i8**> [#uses=2] - icmp eq %struct.zzip_plugin_io* %io_addr.0, null ; <i1>:4 [#uses=1] - br i1 %4, label %cond_true24, label %cond_next26 - -cond_true24: ; preds = %cond_next22 - %tmp25 = call %struct.zzip_plugin_io* @zzip_get_default_io( ) ; <%struct.zzip_plugin_io*> [#uses=1] - br label %cond_next26 - -cond_next26: ; preds = %cond_true24, %cond_next22 - %io_addr.1 = phi %struct.zzip_plugin_io* [ %io_addr.0, %cond_next22 ], [ %tmp25, %cond_true24 ] ; <%struct.zzip_plugin_io*> [#uses=4] - %tmp28 = and i32 %o_modes, 81920 ; <i32> [#uses=1] - icmp eq i32 %tmp28, 0 ; <i1>:5 [#uses=1] - br i1 %5, label %try_real, label %try_zzip - -try_real: ; preds = %bb223, %cond_next26 - %fd160.2 = phi i32 [ undef, %cond_next26 ], [ %fd160.0, %bb223 ] ; <i32> [#uses=1] - %len.2 = phi i32 [ undef, %cond_next26 ], [ %len.0, %bb223 ] ; <i32> [#uses=1] - %o_flags_addr.1 = phi i32 [ %o_flags, %cond_next26 ], [ %o_flags_addr.0, %bb223 ] ; <i32> [#uses=2] - %tmp33348 = and i32 %o_modes, 262144 ; <i32> [#uses=1] - icmp eq i32 %tmp33348, 0 ; <i1>:6 [#uses=1] - br i1 %6, label %cond_next38, label %cond_true35 - -cond_true35: ; preds = %try_real - %tmp36 = call %struct.zzip_plugin_io* @zzip_get_default_io( ) ; <%struct.zzip_plugin_io*> [#uses=1] - br label %cond_next38 - -cond_next38: ; preds = %cond_true35, %try_real - %iftmp.21.0 = phi %struct.zzip_plugin_io* [ %tmp36, %cond_true35 ], [ %io_addr.1, %try_real ] ; <%struct.zzip_plugin_io*> [#uses=3] - %tmp41 = getelementptr %struct.zzip_plugin_io* %iftmp.21.0, i32 0, i32 0 ; <i32 (i8*, i32, ...)**> [#uses=1] - %tmp42 = load i32 (i8*, i32, ...)** %tmp41 ; <i32 (i8*, i32, ...)*> [#uses=1] - %tmp45 = call i32 (i8*, i32, ...)* %tmp42( i8* %filename, i32 %o_flags_addr.1 ) ; <i32> [#uses=3] - icmp eq i32 %tmp45, -1 ; <i1>:7 [#uses=1] - br i1 %7, label %cond_next67, label %cond_true47 - -cond_true47: ; preds = %cond_next38 - %tmp48 = call i8* @cli_calloc( i32 1, i32 108 ) ; <i8*> [#uses=2] - %tmp4849 = bitcast i8* %tmp48 to %struct.ZZIP_FILE* ; <%struct.ZZIP_FILE*> [#uses=3] - icmp eq i8* %tmp48, null ; <i1>:8 [#uses=1] - br i1 %8, label %cond_true51, label %cond_next58 - -cond_true51: ; preds = %cond_true47 - %tmp53 = getelementptr %struct.zzip_plugin_io* %iftmp.21.0, i32 0, i32 1 ; <i32 (i32)**> [#uses=1] - %tmp54 = load i32 (i32)** %tmp53 ; <i32 (i32)*> [#uses=1] - %tmp56 = call i32 %tmp54( i32 %tmp45 ) ; <i32> [#uses=0] - ret %struct.ZZIP_FILE* null - -cond_next58: ; preds = %cond_true47 - %tmp60 = getelementptr %struct.ZZIP_FILE* %tmp4849, i32 0, i32 1 ; <i32*> [#uses=1] - store i32 %tmp45, i32* %tmp60 - %tmp63 = getelementptr %struct.ZZIP_FILE* %tmp4849, i32 0, i32 11 ; <%struct.zzip_plugin_io**> [#uses=1] - store %struct.zzip_plugin_io* %iftmp.21.0, %struct.zzip_plugin_io** %tmp63 - ret %struct.ZZIP_FILE* %tmp4849 - -cond_next67: ; preds = %cond_next38 - %tmp70716 = and i32 %o_modes, 16384 ; <i32> [#uses=1] - icmp eq i32 %tmp70716, 0 ; <i1>:9 [#uses=1] - br i1 %9, label %try_zzip, label %return - -try_zzip: ; preds = %cond_next67, %cond_next26 - %fd160.3 = phi i32 [ %fd160.2, %cond_next67 ], [ undef, %cond_next26 ] ; <i32> [#uses=6] - %len.3 = phi i32 [ %len.2, %cond_next67 ], [ undef, %cond_next26 ] ; <i32> [#uses=3] - %o_flags_addr.3 = phi i32 [ %o_flags_addr.1, %cond_next67 ], [ %o_flags, %cond_next26 ] ; <i32> [#uses=4] - %tmp76 = and i32 %o_flags_addr.3, 513 ; <i32> [#uses=1] - icmp eq i32 %tmp76, 0 ; <i1>:10 [#uses=1] - br i1 %10, label %cond_next80, label %cond_true77 - -cond_true77: ; preds = %try_zzip - %tmp78 = call i32* @__error( ) ; <i32*> [#uses=1] - store i32 22, i32* %tmp78 - ret %struct.ZZIP_FILE* null - -cond_next80: ; preds = %try_zzip - %tmp83844 = and i32 %o_flags_addr.3, 2 ; <i32> [#uses=1] - icmp eq i32 %tmp83844, 0 ; <i1>:11 [#uses=1] - %tmp87 = xor i32 %o_flags_addr.3, 2 ; <i32> [#uses=1] - %o_flags_addr.0 = select i1 %11, i32 %o_flags_addr.3, i32 %tmp87 ; <i32> [#uses=2] - %basename90 = getelementptr [1024 x i8]* %basename, i32 0, i32 0 ; <i8*> [#uses=1] - %tmp92 = call i8* @strcpy( i8* %basename90, i8* %filename ) ; <i8*> [#uses=0] - icmp eq %struct.ZZIP_FILE* %stream, null ; <i1>:12 [#uses=1] - br i1 %12, label %bb219, label %cond_true94 - -cond_true94: ; preds = %cond_next80 - %tmp96 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1] - %tmp97 = load %struct.zzip_dir** %tmp96 ; <%struct.zzip_dir*> [#uses=1] - icmp eq %struct.zzip_dir* %tmp97, null ; <i1>:13 [#uses=1] - br i1 %13, label %bb219, label %cond_true98 - -cond_true98: ; preds = %cond_true94 - %tmp100 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1] - %tmp101 = load %struct.zzip_dir** %tmp100 ; <%struct.zzip_dir*> [#uses=1] - %tmp102 = getelementptr %struct.zzip_dir* %tmp101, i32 0, i32 9 ; <i8**> [#uses=1] - %tmp103 = load i8** %tmp102 ; <i8*> [#uses=1] - icmp eq i8* %tmp103, null ; <i1>:14 [#uses=1] - br i1 %14, label %bb219, label %cond_true104 - -cond_true104: ; preds = %cond_true98 - %tmp106 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1] - %tmp107 = load %struct.zzip_dir** %tmp106 ; <%struct.zzip_dir*> [#uses=1] - %tmp108 = getelementptr %struct.zzip_dir* %tmp107, i32 0, i32 9 ; <i8**> [#uses=1] - %tmp109 = load i8** %tmp108 ; <i8*> [#uses=1] - %tmp110 = call i32 @strlen( i8* %tmp109 ) ; <i32> [#uses=7] - %tmp112 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1] - %tmp113 = load %struct.zzip_dir** %tmp112 ; <%struct.zzip_dir*> [#uses=1] - %tmp114 = getelementptr %struct.zzip_dir* %tmp113, i32 0, i32 9 ; <i8**> [#uses=1] - %tmp115 = load i8** %tmp114 ; <i8*> [#uses=1] - %tmp118 = call i32 @memcmp( i8* %filename, i8* %tmp115, i32 %tmp110 ) ; <i32> [#uses=1] - icmp eq i32 %tmp118, 0 ; <i1>:15 [#uses=1] - br i1 %15, label %cond_true119, label %bb219 - -cond_true119: ; preds = %cond_true104 - %tmp122 = getelementptr i8* %filename, i32 %tmp110 ; <i8*> [#uses=1] - %tmp123 = load i8* %tmp122 ; <i8> [#uses=1] - icmp eq i8 %tmp123, 47 ; <i1>:16 [#uses=1] - br i1 %16, label %cond_true124, label %bb219 - -cond_true124: ; preds = %cond_true119 - %tmp126 = add i32 %tmp110, 1 ; <i32> [#uses=1] - %tmp128 = getelementptr i8* %filename, i32 %tmp126 ; <i8*> [#uses=1] - %tmp129 = load i8* %tmp128 ; <i8> [#uses=1] - icmp eq i8 %tmp129, 0 ; <i1>:17 [#uses=1] - br i1 %17, label %bb219, label %cond_true130 - -cond_true130: ; preds = %cond_true124 - %tmp134.sum = add i32 %tmp110, 1 ; <i32> [#uses=1] - %tmp135 = getelementptr i8* %filename, i32 %tmp134.sum ; <i8*> [#uses=1] - %tmp137 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1] - %tmp138 = load %struct.zzip_dir** %tmp137 ; <%struct.zzip_dir*> [#uses=1] - %tmp140 = call %struct.ZZIP_FILE* @zzip_file_open( %struct.zzip_dir* %tmp138, i8* %tmp135, i32 %o_modes, i32 -1 ) ; <%struct.ZZIP_FILE*> [#uses=3] - icmp eq %struct.ZZIP_FILE* %tmp140, null ; <i1>:18 [#uses=1] - br i1 %18, label %cond_true142, label %return - -cond_true142: ; preds = %cond_true130 - %tmp144 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1] - %tmp145 = load %struct.zzip_dir** %tmp144 ; <%struct.zzip_dir*> [#uses=1] - %tmp146 = getelementptr %struct.zzip_dir* %tmp145, i32 0, i32 1 ; <i32*> [#uses=1] - %tmp147 = load i32* %tmp146 ; <i32> [#uses=1] - %tmp148 = call i32 @zzip_errno( i32 %tmp147 ) ; <i32> [#uses=1] - %tmp149 = call i32* @__error( ) ; <i32*> [#uses=1] - store i32 %tmp148, i32* %tmp149 - ret %struct.ZZIP_FILE* %tmp140 - -bb: ; preds = %bb219 - store i32 0, i32* %e - store i8 0, i8* %tmp221 - %basename162 = getelementptr [1024 x i8]* %basename, i32 0, i32 0 ; <i8*> [#uses=1] - %tmp166 = call i32 @__zzip_try_open( i8* %basename162, i32 %o_flags_addr.0, i8** %ext_addr.1, %struct.zzip_plugin_io* %io_addr.1 ) ; <i32> [#uses=4] - icmp eq i32 %tmp166, -1 ; <i1>:19 [#uses=1] - br i1 %19, label %bb219, label %cond_next169 - -cond_next169: ; preds = %bb - %tmp173 = call %struct.zzip_dir* @zzip_dir_fdopen_ext_io( i32 %tmp166, i32* %e, i8** %ext_addr.1, %struct.zzip_plugin_io* %io_addr.1 ) ; <%struct.zzip_dir*> [#uses=7] - %tmp174 = load i32* %e ; <i32> [#uses=1] - icmp eq i32 %tmp174, 0 ; <i1>:20 [#uses=1] - br i1 %20, label %cond_next185, label %cond_true175 - -cond_true175: ; preds = %cond_next169 - %tmp176 = load i32* %e ; <i32> [#uses=1] - %tmp177 = call i32 @zzip_errno( i32 %tmp176 ) ; <i32> [#uses=1] - %tmp178 = call i32* @__error( ) ; <i32*> [#uses=1] - store i32 %tmp177, i32* %tmp178 - %tmp180 = getelementptr %struct.zzip_plugin_io* %io_addr.1, i32 0, i32 1 ; <i32 (i32)**> [#uses=1] - %tmp181 = load i32 (i32)** %tmp180 ; <i32 (i32)*> [#uses=1] - %tmp183 = call i32 %tmp181( i32 %tmp166 ) ; <i32> [#uses=0] - ret %struct.ZZIP_FILE* null - -cond_next185: ; preds = %cond_next169 - %tmp186187 = ptrtoint i8* %tmp221 to i32 ; <i32> [#uses=1] - %basename188189 = ptrtoint [1024 x i8]* %basename to i32 ; <i32> [#uses=1] - %tmp190 = sub i32 %tmp186187, %basename188189 ; <i32> [#uses=1] - %tmp192.sum = add i32 %tmp190, 1 ; <i32> [#uses=1] - %tmp193 = getelementptr i8* %filename, i32 %tmp192.sum ; <i8*> [#uses=1] - %tmp196 = call %struct.ZZIP_FILE* @zzip_file_open( %struct.zzip_dir* %tmp173, i8* %tmp193, i32 %o_modes, i32 -1 ) ; <%struct.ZZIP_FILE*> [#uses=4] - icmp eq %struct.ZZIP_FILE* %tmp196, null ; <i1>:21 [#uses=1] - br i1 %21, label %cond_true198, label %cond_false204 - -cond_true198: ; preds = %cond_next185 - %tmp200 = getelementptr %struct.zzip_dir* %tmp173, i32 0, i32 1 ; <i32*> [#uses=1] - %tmp201 = load i32* %tmp200 ; <i32> [#uses=1] - %tmp202 = call i32 @zzip_errno( i32 %tmp201 ) ; <i32> [#uses=1] - %tmp203 = call i32* @__error( ) ; <i32*> [#uses=1] - store i32 %tmp202, i32* %tmp203 - %tmp2169 = call i32 @zzip_dir_close( %struct.zzip_dir* %tmp173 ) ; <i32> [#uses=0] - ret %struct.ZZIP_FILE* %tmp196 - -cond_false204: ; preds = %cond_next185 - %tmp206 = getelementptr %struct.zzip_dir* %tmp173, i32 0, i32 9 ; <i8**> [#uses=1] - %tmp207 = load i8** %tmp206 ; <i8*> [#uses=1] - icmp eq i8* %tmp207, null ; <i1>:22 [#uses=1] - br i1 %22, label %cond_true208, label %cond_next214 - -cond_true208: ; preds = %cond_false204 - %basename209 = getelementptr [1024 x i8]* %basename, i32 0, i32 0 ; <i8*> [#uses=1] - %tmp210 = call i8* @strdup( i8* %basename209 ) ; <i8*> [#uses=1] - %tmp212 = getelementptr %struct.zzip_dir* %tmp173, i32 0, i32 9 ; <i8**> [#uses=1] - store i8* %tmp210, i8** %tmp212 - %tmp21610 = call i32 @zzip_dir_close( %struct.zzip_dir* %tmp173 ) ; <i32> [#uses=0] - ret %struct.ZZIP_FILE* %tmp196 - -cond_next214: ; preds = %cond_false204 - %tmp216 = call i32 @zzip_dir_close( %struct.zzip_dir* %tmp173 ) ; <i32> [#uses=0] - ret %struct.ZZIP_FILE* %tmp196 - -bb219: ; preds = %bb, %cond_true124, %cond_true119, %cond_true104, %cond_true98, %cond_true94, %cond_next80 - %fd160.0 = phi i32 [ %fd160.3, %cond_next80 ], [ %tmp166, %bb ], [ %fd160.3, %cond_true94 ], [ %fd160.3, %cond_true98 ], [ %fd160.3, %cond_true104 ], [ %fd160.3, %cond_true119 ], [ %fd160.3, %cond_true124 ] ; <i32> [#uses=1] - %len.0 = phi i32 [ %len.3, %cond_next80 ], [ %len.0, %bb ], [ %len.3, %cond_true94 ], [ %len.3, %cond_true98 ], [ %tmp110, %cond_true104 ], [ %tmp110, %cond_true119 ], [ %tmp110, %cond_true124 ] ; <i32> [#uses=2] - %basename220 = getelementptr [1024 x i8]* %basename, i32 0, i32 0 ; <i8*> [#uses=1] - %tmp221 = call i8* @strrchr( i8* %basename220, i32 47 ) ; <i8*> [#uses=3] - icmp eq i8* %tmp221, null ; <i1>:23 [#uses=1] - br i1 %23, label %bb223, label %bb - -bb223: ; preds = %bb219 - %tmp2262272 = and i32 %o_modes, 16384 ; <i32> [#uses=1] - icmp eq i32 %tmp2262272, 0 ; <i1>:24 [#uses=1] - br i1 %24, label %cond_next229, label %try_real - -cond_next229: ; preds = %bb223 - %tmp230 = call i32* @__error( ) ; <i32*> [#uses=1] - store i32 2, i32* %tmp230 - ret %struct.ZZIP_FILE* null - -return: ; preds = %cond_true130, %cond_next67 - %retval.0 = phi %struct.ZZIP_FILE* [ null, %cond_next67 ], [ %tmp140, %cond_true130 ] ; <%struct.ZZIP_FILE*> [#uses=1] - ret %struct.ZZIP_FILE* %retval.0 -} - -declare i32 @zzip_dir_close(%struct.zzip_dir*) - -declare i8* @strrchr(i8*, i32) - -declare %struct.ZZIP_FILE* @zzip_file_open(%struct.zzip_dir*, i8*, i32, i32) - -declare i8* @cli_calloc(i32, i32) - -declare i32 @zzip_errno(i32) - -declare i32* @__error() - -declare %struct.zzip_plugin_io* @zzip_get_default_io() - -declare i8* @strcpy(i8*, i8*) - -declare i32 @strlen(i8*) - -declare i32 @memcmp(i8*, i8*, i32) - -declare i32 @__zzip_try_open(i8*, i32, i8**, %struct.zzip_plugin_io*) - -declare %struct.zzip_dir* @zzip_dir_fdopen_ext_io(i32, i32*, i8**, %struct.zzip_plugin_io*) - -declare i8* @strdup(i8*) diff --git a/test/Transforms/InstCombine/2007-09-05-EqualGEP.ll b/test/Transforms/InstCombine/2007-09-05-EqualGEP.ll deleted file mode 100644 index 77bae78..0000000 --- a/test/Transforms/InstCombine/2007-09-05-EqualGEP.ll +++ /dev/null @@ -1,10 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 true} -; PR1637 - -define i1 @f(i8* %arr) { - %X = getelementptr i8* %arr, i32 1 - %Y = getelementptr i8* %arr, i32 1 - %test = icmp uge i8* %X, %Y - ret i1 %test -} - diff --git a/test/Transforms/InstCombine/2007-10-28-EmptyField.ll b/test/Transforms/InstCombine/2007-10-28-EmptyField.ll deleted file mode 100644 index 31ae985..0000000 --- a/test/Transforms/InstCombine/2007-10-28-EmptyField.ll +++ /dev/null @@ -1,24 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output -; PR1749 - -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" -target triple = "x86_64-unknown-linux-gnu" - %struct.__large_struct = type { [100 x i64] } - %struct.compat_siginfo = type { i32, i32, i32, { [29 x i32] } } - %struct.siginfo_t = type { i32, i32, i32, { { i32, i32, [0 x i8], %struct.sigval_t, i32 }, [88 x i8] } } - %struct.sigval_t = type { i8* } - -define i32 @copy_siginfo_to_user32(%struct.compat_siginfo* %to, %struct.siginfo_t* %from) { -entry: - %from_addr = alloca %struct.siginfo_t* ; <%struct.siginfo_t**> [#uses=1] - %tmp344 = load %struct.siginfo_t** %from_addr, align 8 ; <%struct.siginfo_t*> [#uses=1] - %tmp345 = getelementptr %struct.siginfo_t* %tmp344, i32 0, i32 3 ; <{ { i32, i32, [0 x i8], %struct.sigval_t, i32 }, [88 x i8] }*> [#uses=1] - %tmp346 = getelementptr { { i32, i32, [0 x i8], %struct.sigval_t, i32 }, [88 x i8] }* %tmp345, i32 0, i32 0 ; <{ i32, i32, [0 x i8], %struct.sigval_t, i32 }*> [#uses=1] - %tmp346347 = bitcast { i32, i32, [0 x i8], %struct.sigval_t, i32 }* %tmp346 to { i32, i32, %struct.sigval_t }* ; <{ i32, i32, %struct.sigval_t }*> [#uses=1] - %tmp348 = getelementptr { i32, i32, %struct.sigval_t }* %tmp346347, i32 0, i32 2 ; <%struct.sigval_t*> [#uses=1] - %tmp349 = getelementptr %struct.sigval_t* %tmp348, i32 0, i32 0 ; <i8**> [#uses=1] - %tmp349350 = bitcast i8** %tmp349 to i32* ; <i32*> [#uses=1] - %tmp351 = load i32* %tmp349350, align 8 ; <i32> [#uses=1] - %tmp360 = call i32 asm sideeffect "1:\09movl ${1:k},$2\0A2:\0A.section .fixup,\22ax\22\0A3:\09mov $3,$0\0A\09jmp 2b\0A.previous\0A.section __ex_table,\22a\22\0A\09.align 8\0A\09.quad 1b,3b\0A.previous", "=r,ir,*m,i,0,~{dirflag},~{fpsr},~{flags}"( i32 %tmp351, %struct.__large_struct* null, i32 -14, i32 0 ) ; <i32> [#uses=0] - unreachable -} diff --git a/test/Transforms/InstCombine/2008-02-04-GEPIdxBug.ll b/test/Transforms/InstCombine/2008-02-04-GEPIdxBug.ll deleted file mode 100644 index 064fbd1..0000000 --- a/test/Transforms/InstCombine/2008-02-04-GEPIdxBug.ll +++ /dev/null @@ -1,33 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp eq i32 %indvar, 0} -; PR1978 -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 = "i686-apple-darwin8" - %struct.x = type <{ i8 }> -@.str = internal constant [6 x i8] c"Main!\00" ; <[6 x i8]*> [#uses=1] -@.str1 = internal constant [12 x i8] c"destroy %p\0A\00" ; <[12 x i8]*> [#uses=1] - -define i32 @main() nounwind { -entry: - %orientations = alloca [1 x [1 x %struct.x]] ; <[1 x [1 x %struct.x]]*> [#uses=2] - %tmp3 = call i32 @puts( i8* getelementptr ([6 x i8]* @.str, i32 0, i32 0) ) nounwind ; <i32> [#uses=0] - %tmp45 = getelementptr inbounds [1 x [1 x %struct.x]]* %orientations, i32 1, i32 0, i32 0 ; <%struct.x*> [#uses=1] - %orientations62 = getelementptr [1 x [1 x %struct.x]]* %orientations, i32 0, i32 0, i32 0 ; <%struct.x*> [#uses=1] - br label %bb10 - -bb10: ; preds = %bb10, %entry - %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %bb10 ] ; <i32> [#uses=2] - %tmp.0.reg2mem.0.rec = mul i32 %indvar, -1 ; <i32> [#uses=1] - %tmp12.rec = add i32 %tmp.0.reg2mem.0.rec, -1 ; <i32> [#uses=1] - %tmp12 = getelementptr inbounds %struct.x* %tmp45, i32 %tmp12.rec ; <%struct.x*> [#uses=2] - %tmp16 = call i32 (i8*, ...)* @printf( i8* getelementptr ([12 x i8]* @.str1, i32 0, i32 0), %struct.x* %tmp12 ) nounwind ; <i32> [#uses=0] - %tmp84 = icmp eq %struct.x* %tmp12, %orientations62 ; <i1> [#uses=1] - %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1] - br i1 %tmp84, label %bb17, label %bb10 - -bb17: ; preds = %bb10 - ret i32 0 -} - -declare i32 @puts(i8*) - -declare i32 @printf(i8*, ...) diff --git a/test/Transforms/InstCombine/2009-03-02-VarLengthArrayGEP.ll b/test/Transforms/InstCombine/2009-03-02-VarLengthArrayGEP.ll deleted file mode 100644 index 1e136f5..0000000 --- a/test/Transforms/InstCombine/2009-03-02-VarLengthArrayGEP.ll +++ /dev/null @@ -1,14 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {getelementptr i32} -; PR3694 - -define i32 @e(i32 %m, i32 %n) nounwind { -entry: - %0 = alloca i32, i32 %n, align 4 ; <i32*> [#uses=2] - %1 = bitcast i32* %0 to [0 x i32]* ; <[0 x i32]*> [#uses=1] - call void @f(i32* %0) nounwind - %2 = getelementptr [0 x i32]* %1, i32 0, i32 %m ; <i32*> [#uses=1] - %3 = load i32* %2, align 4 ; <i32> [#uses=1] - ret i32 %3 -} - -declare void @f(i32*) diff --git a/test/Transforms/InstCombine/2009-04-06-GEP-Index-Crash.ll b/test/Transforms/InstCombine/2009-04-06-GEP-Index-Crash.ll deleted file mode 100644 index 49e1f0a..0000000 --- a/test/Transforms/InstCombine/2009-04-06-GEP-Index-Crash.ll +++ /dev/null @@ -1,24 +0,0 @@ -; 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 -} diff --git a/test/Transforms/InstCombine/GEPIdxCanon.ll b/test/Transforms/InstCombine/GEPIdxCanon.ll deleted file mode 100644 index f2e5e67..0000000 --- a/test/Transforms/InstCombine/GEPIdxCanon.ll +++ /dev/null @@ -1,10 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine -gvn -instcombine | \ -; RUN: llvm-dis | not grep getelementptr - -define i1 @test(i32* %A) { - %B = getelementptr i32* %A, i32 1 ; <i32*> [#uses=1] - %C = getelementptr i32* %A, i64 1 ; <i32*> [#uses=1] - %V = icmp eq i32* %B, %C ; <i1> [#uses=1] - ret i1 %V -} - diff --git a/test/Transforms/InstCombine/bitcast-gep.ll b/test/Transforms/InstCombine/bitcast-gep.ll deleted file mode 100644 index 2e1f769..0000000 --- a/test/Transforms/InstCombine/bitcast-gep.ll +++ /dev/null @@ -1,30 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep bitcast -; RUN: llvm-as < %s | opt -instcombine -scalarrepl | llvm-dis | grep {ret i8. %v} -; PR1345 - -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" -target triple = "powerpc-apple-darwin8.8.0" - -define i8* @test(i8* %v) { - %A = alloca [4 x i8*], align 16 ; <[4 x i8*]*> [#uses=3] - %B = getelementptr [4 x i8*]* %A, i32 0, i32 0 ; <i8**> [#uses=1] - store i8* null, i8** %B - %C = bitcast [4 x i8*]* %A to { [16 x i8] }* ; <{ [16 x i8] }*> [#uses=1] - %D = getelementptr { [16 x i8] }* %C, i32 0, i32 0, i32 8 ; <i8*> [#uses=1] - %E = bitcast i8* %D to i8** ; <i8**> [#uses=1] - store i8* %v, i8** %E - %F = getelementptr [4 x i8*]* %A, i32 0, i32 2 ; <i8**> [#uses=1] - %G = load i8** %F ; <i8*> [#uses=1] - ret i8* %G -} - -; PR3290 -%struct.Key = type { { i32, i32 } } -%struct.anon = type <{ i8, [3 x i8], i32 }> - -define i32 *@test2(%struct.Key *%A) { - %B = bitcast %struct.Key* %A to %struct.anon* - %C = getelementptr %struct.anon* %B, i32 0, i32 2 - ret i32 *%C -} - diff --git a/test/Transforms/InstCombine/cast-store-gep.ll b/test/Transforms/InstCombine/cast-store-gep.ll deleted file mode 100644 index 95a069d..0000000 --- a/test/Transforms/InstCombine/cast-store-gep.ll +++ /dev/null @@ -1,17 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep inttoptr -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep alloca - -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" -target triple = "x86_64-apple-darwin10.0" - %T = type { i8*, i8 } - -define i8* @test(i8* %Val, i64 %V) nounwind { -entry: - %A = alloca %T, align 8 - %mrv_gep = bitcast %T* %A to i64* ; <i64*> [#uses=1] - %B = getelementptr %T* %A, i64 0, i32 0 ; <i8**> [#uses=1] - - store i64 %V, i64* %mrv_gep - %C = load i8** %B, align 8 ; <i8*> [#uses=1] - ret i8* %C -} diff --git a/test/Transforms/InstCombine/constant-fold-gep-overindex.ll b/test/Transforms/InstCombine/constant-fold-gep-overindex.ll deleted file mode 100644 index 954cccb..0000000 --- a/test/Transforms/InstCombine/constant-fold-gep-overindex.ll +++ /dev/null @@ -1,33 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | FileCheck %s - -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-darwin10.0" - -%0 = type { i8*, [19 x i8] } -%1 = type { i8*, [0 x i8] } - -@array = external global [11 x i8] - -@s = external global %0 ; <%0*> [#uses=1] -@"\01LC8" = external constant [17 x i8] ; <[17 x i8]*> [#uses=1] - -; Instcombine should be able to fold this getelementptr. - -define i32 @main() nounwind { -; CHECK: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([17 x i8]* @"\01LC8", i32 0, i32 0), i8* undef, i8* bitcast (i8** getelementptr (%1* bitcast (%0* @s to %1*), i32 1, i32 0) to i8*)) nounwind - - call i32 (i8*, ...)* @printf(i8* getelementptr ([17 x i8]* @"\01LC8", i32 0, i32 0), i8* undef, i8* getelementptr (%1* bitcast (%0* @s to %1*), i32 0, i32 1, i32 0)) nounwind ; <i32> [#uses=0] - ret i32 0 -} - -; Instcombine should constant-fold the GEP so that indices that have -; static array extents are within bounds of those array extents. -; In the below, -1 is not in the range [0,11). After the transformation, -; the same address is computed, but 3 is in the range of [0,11). - -define i8* @foo() nounwind { -; CHECK: ret i8* getelementptr ([11 x i8]* @array, i32 390451572, i32 3) - ret i8* getelementptr ([11 x i8]* @array, i32 0, i64 -1) -} - -declare i32 @printf(i8*, ...) nounwind diff --git a/test/Transforms/InstCombine/getelementptr.ll b/test/Transforms/InstCombine/getelementptr.ll index 3953ee3..7bc08d0 100644 --- a/test/Transforms/InstCombine/getelementptr.ll +++ b/test/Transforms/InstCombine/getelementptr.ll @@ -1,7 +1,7 @@ ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | FileCheck %s target datalayout = "e-p:64:64" - +%intstruct = type { i32 } %pair = type { i32, i32 } %struct.B = type { double } %struct.A = type { %struct.B, i32, i32 } @@ -40,7 +40,7 @@ define i32* @test4({ i32 }* %I) { %B = getelementptr { i32 }* %A, i64 0, i32 0 ret i32* %B ; CHECK: @test4 -; CHECK: getelementptr %0* %I, i64 1, i32 0 +; CHECK: getelementptr %intstruct* %I, i64 1, i32 0 } define void @test5(i8 %B) { @@ -62,8 +62,8 @@ define i32* @test6() { } define i32* @test7(i32* %I, i64 %C, i64 %D) { - %A = getelementptr i32* %I, i64 %C ; <i32*> [#uses=1] - %B = getelementptr i32* %A, i64 %D ; <i32*> [#uses=1] + %A = getelementptr i32* %I, i64 %C + %B = getelementptr i32* %A, i64 %D ret i32* %B ; CHECK: @test7 ; CHECK: %A.sum = add i64 %C, %D @@ -72,34 +72,34 @@ define i32* @test7(i32* %I, i64 %C, i64 %D) { define i8* @test8([10 x i32]* %X) { ;; Fold into the cast. - %A = getelementptr [10 x i32]* %X, i64 0, i64 0 ; <i32*> [#uses=1] - %B = bitcast i32* %A to i8* ; <i8*> [#uses=1] + %A = getelementptr [10 x i32]* %X, i64 0, i64 0 + %B = bitcast i32* %A to i8* ret i8* %B ; CHECK: @test8 ; CHECK: bitcast [10 x i32]* %X to i8* } define i32 @test9() { - %A = getelementptr { i32, double }* null, i32 0, i32 1 ; <double*> [#uses=1] - %B = ptrtoint double* %A to i32 ; <i32> [#uses=1] + %A = getelementptr { i32, double }* null, i32 0, i32 1 + %B = ptrtoint double* %A to i32 ret i32 %B ; CHECK: @test9 ; CHECK: ret i32 8 } define i1 @test10({ i32, i32 }* %x, { i32, i32 }* %y) { - %tmp.1 = getelementptr { i32, i32 }* %x, i32 0, i32 1 ; <i32*> [#uses=1] - %tmp.3 = getelementptr { i32, i32 }* %y, i32 0, i32 1 ; <i32*> [#uses=1] + %tmp.1 = getelementptr { i32, i32 }* %x, i32 0, i32 1 + %tmp.3 = getelementptr { i32, i32 }* %y, i32 0, i32 1 ;; seteq x, y - %tmp.4 = icmp eq i32* %tmp.1, %tmp.3 ; <i1> [#uses=1] + %tmp.4 = icmp eq i32* %tmp.1, %tmp.3 ret i1 %tmp.4 ; CHECK: @test10 ; CHECK: icmp eq %pair* %x, %y } define i1 @test11({ i32, i32 }* %X) { - %P = getelementptr { i32, i32 }* %X, i32 0, i32 0 ; <i32*> [#uses=1] - %Q = icmp eq i32* %P, null ; <i1> [#uses=1] + %P = getelementptr { i32, i32 }* %X, i32 0, i32 0 + %Q = icmp eq i32* %P, null ret i1 %Q ; CHECK: @test11 ; CHECK: icmp eq %pair* %X, null @@ -138,9 +138,9 @@ define i1 @test13(i64 %X, %S* %P) { } -@G = external global [3 x i8] ; <[3 x i8]*> [#uses=1] +@G = external global [3 x i8] define i8* @test14(i32 %Idx) { - %idx = zext i32 %Idx to i64 ; <i64> [#uses=1] + %idx = zext i32 %Idx to i64 %tmp = getelementptr i8* getelementptr ([3 x i8]* @G, i32 0, i32 0), i64 %idx ret i8* %tmp ; CHECK: @test14 @@ -149,7 +149,7 @@ define i8* @test14(i32 %Idx) { ; Test folding of constantexpr geps into normal geps. -@Array = external global [40 x i32] ; <[40 x i32]*> [#uses=2] +@Array = external global [40 x i32] define i32 *@test15(i64 %X) { %A = getelementptr i32* getelementptr ([40 x i32]* @Array, i64 0, i64 0), i64 %X ret i32* %A @@ -203,4 +203,259 @@ define i32 @test20(i32* %P, i32 %A, i32 %B) { } +define i32 @test21() { + %pbob1 = alloca %intstruct + %pbob2 = getelementptr %intstruct* %pbob1 + %pbobel = getelementptr %intstruct* %pbob2, i64 0, i32 0 + %rval = load i32* %pbobel + ret i32 %rval +; CHECK: @test21 +; CHECK: getelementptr %intstruct* %pbob1, i64 0, i32 0 +} + + +@A = global i32 1 ; <i32*> [#uses=1] +@B = global i32 2 ; <i32*> [#uses=1] + +define i1 @test22() { + %C = icmp ult i32* getelementptr (i32* @A, i64 1), + getelementptr (i32* @B, i64 2) + ret i1 %C +; CHECK: @test22 +; CHECK: icmp ult (i32* getelementptr (i32* @A, i64 1), i32* getelementptr (i32* @B, i64 2)) +} + + +%X = type { [10 x i32], float } + +define i1 @test23() { + %A = getelementptr %X* null, i64 0, i32 0, i64 0 ; <i32*> [#uses=1] + %B = icmp ne i32* %A, null ; <i1> [#uses=1] + ret i1 %B +; CHECK: @test23 +; CHECK: ret i1 false +} + +%"java/lang/Object" = type { %struct.llvm_java_object_base } +%"java/lang/StringBuffer" = type { %"java/lang/Object", i32, { %"java/lang/Object", i32, [0 x i16] }*, i1 } +%struct.llvm_java_object_base = type opaque + +define void @test24() { +bc0: + %tmp53 = getelementptr %"java/lang/StringBuffer"* null, i32 0, i32 1 ; <i32*> [#uses=1] + store i32 0, i32* %tmp53 + ret void +; CHECK: @test24 +; CHECK: store i32 0, i32* getelementptr (%"java/lang/StringBuffer"* null, i32 0, i32 1) +} + +define void @test25() { +entry: + %tmp = getelementptr { i64, i64, i64, i64 }* null, i32 0, i32 3 ; <i64*> [#uses=1] + %tmp.upgrd.1 = load i64* %tmp ; <i64> [#uses=1] + %tmp8.ui = load i64* null ; <i64> [#uses=1] + %tmp8 = bitcast i64 %tmp8.ui to i64 ; <i64> [#uses=1] + %tmp9 = and i64 %tmp8, %tmp.upgrd.1 ; <i64> [#uses=1] + %sext = trunc i64 %tmp9 to i32 ; <i32> [#uses=1] + %tmp27.i = sext i32 %sext to i64 ; <i64> [#uses=1] + tail call void @foo25( i32 0, i64 %tmp27.i ) + unreachable +; CHECK: @test25 +} + +declare void @foo25(i32, i64) + + +; PR1637 +define i1 @test26(i8* %arr) { + %X = getelementptr i8* %arr, i32 1 + %Y = getelementptr i8* %arr, i32 1 + %test = icmp uge i8* %X, %Y + ret i1 %test +; CHECK: @test26 +; CHECK: ret i1 true +} + + %struct.__large_struct = type { [100 x i64] } + %struct.compat_siginfo = type { i32, i32, i32, { [29 x i32] } } + %struct.siginfo_t = type { i32, i32, i32, { { i32, i32, [0 x i8], %struct.sigval_t, i32 }, [88 x i8] } } + %struct.sigval_t = type { i8* } + +define i32 @test27(%struct.compat_siginfo* %to, %struct.siginfo_t* %from) { +entry: + %from_addr = alloca %struct.siginfo_t* + %tmp344 = load %struct.siginfo_t** %from_addr, align 8 + %tmp345 = getelementptr %struct.siginfo_t* %tmp344, i32 0, i32 3 + %tmp346 = getelementptr { { i32, i32, [0 x i8], %struct.sigval_t, i32 }, [88 x i8] }* %tmp345, i32 0, i32 0 + %tmp346347 = bitcast { i32, i32, [0 x i8], %struct.sigval_t, i32 }* %tmp346 to { i32, i32, %struct.sigval_t }* + %tmp348 = getelementptr { i32, i32, %struct.sigval_t }* %tmp346347, i32 0, i32 2 + %tmp349 = getelementptr %struct.sigval_t* %tmp348, i32 0, i32 0 + %tmp349350 = bitcast i8** %tmp349 to i32* + %tmp351 = load i32* %tmp349350, align 8 + %tmp360 = call i32 asm sideeffect "...", + "=r,ir,*m,i,0,~{dirflag},~{fpsr},~{flags}"( i32 %tmp351, + %struct.__large_struct* null, i32 -14, i32 0 ) + unreachable +; CHECK: @test27 +} + +; PR1978 + %struct.x = type <{ i8 }> +@.str = internal constant [6 x i8] c"Main!\00" +@.str1 = internal constant [12 x i8] c"destroy %p\0A\00" + +define i32 @test28() nounwind { +entry: + %orientations = alloca [1 x [1 x %struct.x]] + %tmp3 = call i32 @puts( i8* getelementptr ([6 x i8]* @.str, i32 0, i32 0) ) nounwind + %tmp45 = getelementptr inbounds [1 x [1 x %struct.x]]* %orientations, i32 1, i32 0, i32 0 + %orientations62 = getelementptr [1 x [1 x %struct.x]]* %orientations, i32 0, i32 0, i32 0 + br label %bb10 + +bb10: + %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %bb10 ] + %tmp.0.reg2mem.0.rec = mul i32 %indvar, -1 + %tmp12.rec = add i32 %tmp.0.reg2mem.0.rec, -1 + %tmp12 = getelementptr inbounds %struct.x* %tmp45, i32 %tmp12.rec + %tmp16 = call i32 (i8*, ...)* @printf( i8* getelementptr ([12 x i8]* @.str1, i32 0, i32 0), %struct.x* %tmp12 ) nounwind + %tmp84 = icmp eq %struct.x* %tmp12, %orientations62 + %indvar.next = add i32 %indvar, 1 + br i1 %tmp84, label %bb17, label %bb10 + +bb17: + ret i32 0 +; CHECK: @test28 +; CHECK: icmp eq i32 %indvar, 0 +} + +declare i32 @puts(i8*) + +declare i32 @printf(i8*, ...) + + + + +; rdar://6762290 + %T = type <{ i64, i64, i64 }> +define i32 @test29(i8* %start, i32 %X) nounwind { +entry: + %tmp3 = load i64* null + %add.ptr = getelementptr i8* %start, i64 %tmp3 + %tmp158 = load i32* null + %add.ptr159 = getelementptr %T* null, i32 %tmp158 + %add.ptr209 = getelementptr i8* %start, i64 0 + %add.ptr212 = getelementptr i8* %add.ptr209, i32 %X + %cmp214 = icmp ugt i8* %add.ptr212, %add.ptr + br i1 %cmp214, label %if.then216, label %if.end363 + +if.then216: + ret i32 1 + +if.end363: + ret i32 0 +; CHECK: @test29 +} + + +; PR3694 +define i32 @test30(i32 %m, i32 %n) nounwind { +entry: + %0 = alloca i32, i32 %n, align 4 + %1 = bitcast i32* %0 to [0 x i32]* + call void @test30f(i32* %0) nounwind + %2 = getelementptr [0 x i32]* %1, i32 0, i32 %m + %3 = load i32* %2, align 4 + ret i32 %3 +; CHECK: @test30 +; CHECK: getelementptr i32 +} + +declare void @test30f(i32*) + + + +define i1 @test31(i32* %A) { + %B = getelementptr i32* %A, i32 1 + %C = getelementptr i32* %A, i64 1 + %V = icmp eq i32* %B, %C + ret i1 %V +; CHECK: @test31 +; CHECK: ret i1 true +} + + +; PR1345 +define i8* @test32(i8* %v) { + %A = alloca [4 x i8*], align 16 + %B = getelementptr [4 x i8*]* %A, i32 0, i32 0 + store i8* null, i8** %B + %C = bitcast [4 x i8*]* %A to { [16 x i8] }* + %D = getelementptr { [16 x i8] }* %C, i32 0, i32 0, i32 8 + %E = bitcast i8* %D to i8** + store i8* %v, i8** %E + %F = getelementptr [4 x i8*]* %A, i32 0, i32 2 + %G = load i8** %F + ret i8* %G +; CHECK: @test32 +; CHECK: %D = getelementptr [4 x i8*]* %A, i64 0, i64 1 +; CHECK: %F = getelementptr [4 x i8*]* %A, i64 0, i64 2 +} + +; PR3290 +%struct.Key = type { { i32, i32 } } +%struct.anon = type <{ i8, [3 x i8], i32 }> + +define i32 *@test33(%struct.Key *%A) { + %B = bitcast %struct.Key* %A to %struct.anon* + %C = getelementptr %struct.anon* %B, i32 0, i32 2 + ret i32 *%C +; CHECK: @test33 +; CHECK: getelementptr %struct.Key* %A, i64 0, i32 0, i32 1 +} + + + + %T2 = type { i8*, i8 } +define i8* @test34(i8* %Val, i64 %V) nounwind { +entry: + %A = alloca %T2, align 8 + %mrv_gep = bitcast %T2* %A to i64* + %B = getelementptr %T2* %A, i64 0, i32 0 + + store i64 %V, i64* %mrv_gep + %C = load i8** %B, align 8 + ret i8* %C +; CHECK: @test34 +; CHECK: %V.c = inttoptr i64 %V to i8* +; CHECK: ret i8* %V.c +} + +%t0 = type { i8*, [19 x i8] } +%t1 = type { i8*, [0 x i8] } + +@array = external global [11 x i8] + +@s = external global %t0 +@"\01LC8" = external constant [17 x i8] + +; Instcombine should be able to fold this getelementptr. + +define i32 @test35() nounwind { + call i32 (i8*, ...)* @printf(i8* getelementptr ([17 x i8]* @"\01LC8", i32 0, i32 0), + i8* getelementptr (%t1* bitcast (%t0* @s to %t1*), i32 0, i32 1, i32 0)) nounwind + ret i32 0 +; CHECK: @test35 +; CHECK: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([17 x i8]* @"\01LC8", i64 0, i64 0), i8* bitcast (i8** getelementptr (%t1* bitcast (%t0* @s to %t1*), i64 1, i32 0) to i8*)) nounwind +} + +; Instcombine should constant-fold the GEP so that indices that have +; static array extents are within bounds of those array extents. +; In the below, -1 is not in the range [0,11). After the transformation, +; the same address is computed, but 3 is in the range of [0,11). + +define i8* @test36() nounwind { + ret i8* getelementptr ([11 x i8]* @array, i32 0, i64 -1) +; CHECK: @test36 +; CHECK: ret i8* getelementptr ([11 x i8]* @array, i64 1676976733973595601, i64 4) +} |