diff options
Diffstat (limited to 'test/Transforms')
154 files changed, 2048 insertions, 2689 deletions
diff --git a/test/Transforms/ArgumentPromotion/basictest.ll b/test/Transforms/ArgumentPromotion/basictest.ll index ac9d7bf..d3d21fc 100644 --- a/test/Transforms/ArgumentPromotion/basictest.ll +++ b/test/Transforms/ArgumentPromotion/basictest.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -argpromotion -mem2reg -S | not grep alloca +; RUN: opt < %s -basicaa -argpromotion -mem2reg -S | not grep alloca target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" define internal i32 @test(i32* %X, i32* %Y) { %A = load i32* %X ; <i32> [#uses=1] diff --git a/test/Transforms/ConstProp/bitcast.ll b/test/Transforms/ConstProp/bitcast.ll index bf943c9..53239c7 100644 --- a/test/Transforms/ConstProp/bitcast.ll +++ b/test/Transforms/ConstProp/bitcast.ll @@ -1,2 +1,10 @@ -; RUN: llvm-as < %s | llvm-dis | grep 0x36A0000000000000 -@A = global float 0x36A0000000000000 ; <float*> [#uses=0] +; RUN: opt < %s -constprop -S | FileCheck %s +; PR2165 + +define <1 x i64> @test1() { + %A = bitcast i64 63 to <1 x i64> + ret <1 x i64> %A +; CHECK: @test1 +; CHECK: ret <1 x i64> <i64 63> +} + diff --git a/test/Transforms/ConstProp/bitcast2.ll b/test/Transforms/ConstProp/bitcast2.ll deleted file mode 100644 index 5c5eab1..0000000 --- a/test/Transforms/ConstProp/bitcast2.ll +++ /dev/null @@ -1,8 +0,0 @@ -; RUN: opt < %s -instcombine -S | not grep bitcast -; PR2165 - -define <1 x i64> @test() { - %A = bitcast i64 63 to <1 x i64> - ret <1 x i64> %A -} - diff --git a/test/Transforms/ConstProp/constant-expr.ll b/test/Transforms/ConstProp/constant-expr.ll index 9963032..556ed1f 100644 --- a/test/Transforms/ConstProp/constant-expr.ll +++ b/test/Transforms/ConstProp/constant-expr.ll @@ -16,9 +16,9 @@ @E = global i1 udiv (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z)) ; CHECK: @E = global i1 icmp ult (i8* @X, i8* @Y) @F = global i1 srem (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z)) -; CHECK: @F = global i1 false ; <i1*> [#uses=0] +; CHECK: @F = global i1 false @G = global i1 urem (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z)) -; CHECK: @G = global i1 false ; <i1*> [#uses=0] +; CHECK: @G = global i1 false @H = global i1 icmp ule (i32* bitcast (i8* @X to i32*), i32* bitcast (i8* @Y to i32*)) ; CHECK: @H = global i1 icmp ule (i8* @X, i8* @Y) diff --git a/test/Transforms/ConstProp/nottest.ll b/test/Transforms/ConstProp/nottest.ll deleted file mode 100644 index 799ceca..0000000 --- a/test/Transforms/ConstProp/nottest.ll +++ /dev/null @@ -1,19 +0,0 @@ -; Ensure constant propogation of 'not' instructions is working correctly. - -; RUN: opt < %s -constprop -die -S | not grep xor - -define i32 @test1() { - %R = xor i32 4, -1 ; <i32> [#uses=1] - ret i32 %R -} - -define i32 @test2() { - %R = xor i32 -23, -1 ; <i32> [#uses=1] - ret i32 %R -} - -define i1 @test3() { - %R = xor i1 true, true ; <i1> [#uses=1] - ret i1 %R -} - diff --git a/test/Transforms/ConstProp/overflow-ops.ll b/test/Transforms/ConstProp/overflow-ops.ll index 1547a4d..5587e9b 100644 --- a/test/Transforms/ConstProp/overflow-ops.ll +++ b/test/Transforms/ConstProp/overflow-ops.ll @@ -170,3 +170,14 @@ declare {i8, i1} @llvm.usub.with.overflow.i8(i8, i8) declare {i8, i1} @llvm.sadd.with.overflow.i8(i8, i8) declare {i8, i1} @llvm.ssub.with.overflow.i8(i8, i8) +declare {i8, i1} @llvm.smul.with.overflow.i8(i8, i8) + +; rdar://8501501 +define {i8, i1} @smul_1() nounwind { +entry: + %t = call {i8, i1} @llvm.smul.with.overflow.i8(i8 -20, i8 -10) + ret {i8, i1} %t + +; CHECK: @smul_1 +; CHECK: ret %i8i1 { i8 -56, i1 true } +} diff --git a/test/Transforms/ConstantMerge/dont-merge.ll b/test/Transforms/ConstantMerge/dont-merge.ll index 877cf8d..e5337df 100644 --- a/test/Transforms/ConstantMerge/dont-merge.ll +++ b/test/Transforms/ConstantMerge/dont-merge.ll @@ -28,3 +28,17 @@ define void @test2(i32** %P1, i32 addrspace(30)** %P2) { store i32 addrspace(30)* @T2b, i32 addrspace(30)** %P2 ret void } + +; PR8144 - Don't merge globals marked attribute(used) +; CHECK: @T3A = +; CHECK: @T3B = + +@T3A = internal constant i32 0 +@T3B = internal constant i32 0 +@llvm.used = appending global [2 x i32*] [i32* @T3A, i32* @T3B], section +"llvm.metadata" + +define void @test3() { + call void asm sideeffect "T3A, T3B",""() ; invisible use of T3A and T3B + ret void +} diff --git a/test/Transforms/CorrelatedValuePropagation/2010-09-02-Trunc.ll b/test/Transforms/CorrelatedValuePropagation/2010-09-02-Trunc.ll new file mode 100644 index 0000000..fef5b85 --- /dev/null +++ b/test/Transforms/CorrelatedValuePropagation/2010-09-02-Trunc.ll @@ -0,0 +1,25 @@ +; RUN: opt -S < %s -correlated-propagation | FileCheck %s + +; CHECK: @test +define i16 @test(i32 %a, i1 %b) { +entry: + %c = icmp eq i32 %a, 0 + br i1 %c, label %left, label %right + +right: + %d = trunc i32 %a to i1 + br label %merge + +left: + br i1 %b, label %merge, label %other + +other: + ret i16 23 + +merge: + %f = phi i1 [%b, %left], [%d, %right] +; CHECK: select i1 %f, i16 1, i16 0 + %h = select i1 %f, i16 1, i16 0 +; CHECK: ret i16 %h + ret i16 %h +}
\ No newline at end of file diff --git a/test/Transforms/CorrelatedValuePropagation/2010-09-26-MergeConstantRange.ll b/test/Transforms/CorrelatedValuePropagation/2010-09-26-MergeConstantRange.ll new file mode 100644 index 0000000..9ccc787 --- /dev/null +++ b/test/Transforms/CorrelatedValuePropagation/2010-09-26-MergeConstantRange.ll @@ -0,0 +1,82 @@ +; RUN: opt < %s -jump-threading -correlated-propagation + +%struct.S2 = type {} + +@g_128 = external global %struct.S2, align 1 +@g_106 = external global i16, align 2 + +define void @int328(i16 signext %p_82) noreturn nounwind ssp { +entry: + %tobool3 = icmp eq i16 %p_82, 0 + br label %for.cond.outer + +for.cond.outer: ; preds = %for.cond.loopexit, %entry + br label %for.cond + +for.cond.loopexit: ; preds = %bb.nph, %for.cond9.preheader + br label %for.cond.outer + +for.cond.loopexit4.us-lcssa: ; preds = %if.then + br label %for.cond.loopexit4 + +for.cond.loopexit4: ; preds = %for.cond.loopexit4.us-lcssa.us, %for.cond.loopexit4.us-lcssa + br label %for.cond.backedge + +for.cond: ; preds = %for.cond.backedge, %for.cond.outer + br i1 %tobool3, label %for.cond.split.us, label %for.cond.for.cond.split_crit_edge + +for.cond.for.cond.split_crit_edge: ; preds = %for.cond + br label %lbl_133 + +for.cond.split.us: ; preds = %for.cond + br label %lbl_133.us + +lbl_133.us: ; preds = %lbl_134.us, %for.cond.split.us + br i1 undef, label %if.else14.us-lcssa.us, label %if.then.us + +lbl_134.us: ; preds = %if.then.us + br i1 icmp eq (i16 ptrtoint (%struct.S2* @g_128 to i16), i16 0), label %for.cond9.preheader.us-lcssa.us, label %lbl_133.us + +if.then.us: ; preds = %lbl_133.us + br i1 true, label %for.cond.loopexit4.us-lcssa.us, label %lbl_134.us + +if.else14.us-lcssa.us: ; preds = %lbl_133.us + br label %if.else14 + +for.cond9.preheader.us-lcssa.us: ; preds = %lbl_134.us + br label %for.cond9.preheader + +for.cond.loopexit4.us-lcssa.us: ; preds = %if.then.us + br label %for.cond.loopexit4 + +lbl_133: ; preds = %lbl_134, %for.cond.for.cond.split_crit_edge + %l_109.0 = phi i16 [ 0, %for.cond.for.cond.split_crit_edge ], [ ptrtoint (%struct.S2* @g_128 to i16), %lbl_134 ] + %tobool = icmp eq i32 undef, 0 + br i1 %tobool, label %if.else14.us-lcssa, label %if.then + +if.then: ; preds = %lbl_133 + br i1 false, label %for.cond.loopexit4.us-lcssa, label %lbl_134 + +lbl_134: ; preds = %if.then + br i1 icmp eq (i16 ptrtoint (%struct.S2* @g_128 to i16), i16 0), label %for.cond9.preheader.us-lcssa, label %lbl_133 + +for.cond9.preheader.us-lcssa: ; preds = %lbl_134 + br label %for.cond9.preheader + +for.cond9.preheader: ; preds = %for.cond9.preheader.us-lcssa, %for.cond9.preheader.us-lcssa.us + br i1 undef, label %bb.nph, label %for.cond.loopexit + +bb.nph: ; preds = %for.cond9.preheader + br label %for.cond.loopexit + +if.else14.us-lcssa: ; preds = %lbl_133 + br label %if.else14 + +if.else14: ; preds = %if.else14.us-lcssa, %if.else14.us-lcssa.us + %l_109.0.lcssa = phi i16 [ %l_109.0, %if.else14.us-lcssa ], [ 0, %if.else14.us-lcssa.us ] + store i16 undef, i16* @g_106, align 2 + br label %for.cond.backedge + +for.cond.backedge: ; preds = %if.else14, %for.cond.loopexit4 + br label %for.cond +} diff --git a/test/Transforms/CorrelatedValuePropagation/basic.ll b/test/Transforms/CorrelatedValuePropagation/basic.ll new file mode 100644 index 0000000..270c048 --- /dev/null +++ b/test/Transforms/CorrelatedValuePropagation/basic.ll @@ -0,0 +1,82 @@ +; RUN: opt < %s -correlated-propagation -S | FileCheck %s +; PR2581 + +; CHECK: @test1 +define i32 @test1(i1 %C) nounwind { + br i1 %C, label %exit, label %body + +body: ; preds = %0 +; CHECK-NOT: select + %A = select i1 %C, i32 10, i32 11 ; <i32> [#uses=1] +; CHECK: ret i32 11 + ret i32 %A + +exit: ; preds = %0 +; CHECK: ret i32 10 + ret i32 10 +} + +; PR4420 +declare i1 @ext() +; CHECK: @test2 +define i1 @test2() { +entry: + %cond = tail call i1 @ext() ; <i1> [#uses=2] + br i1 %cond, label %bb1, label %bb2 + +bb1: ; preds = %entry + %cond2 = tail call i1 @ext() ; <i1> [#uses=1] + br i1 %cond2, label %bb3, label %bb2 + +bb2: ; preds = %bb1, %entry +; CHECK-NOT: phi i1 + %cond_merge = phi i1 [ %cond, %entry ], [ false, %bb1 ] ; <i1> [#uses=1] +; CHECK: ret i1 false + ret i1 %cond_merge + +bb3: ; preds = %bb1 + %res = tail call i1 @ext() ; <i1> [#uses=1] +; CHECK: ret i1 %res + ret i1 %res +} + +; PR4855 +@gv = internal constant i8 7 +; CHECK: @test3 +define i8 @test3(i8* %a) nounwind { +entry: + %cond = icmp eq i8* %a, @gv + br i1 %cond, label %bb2, label %bb + +bb: ; preds = %entry + ret i8 0 + +bb2: ; preds = %entry +; CHECK: %should_be_const = load i8* @gv + %should_be_const = load i8* %a + ret i8 %should_be_const +} + +; PR1757 +; CHECK: @test4 +define i32 @test4(i32) { +EntryBlock: +; CHECK: icmp sgt i32 %0, 2 + %.demorgan = icmp sgt i32 %0, 2 + br i1 %.demorgan, label %GreaterThanTwo, label %LessThanOrEqualToTwo + +GreaterThanTwo: +; CHECK-NOT: icmp eq i32 %0, 2 + icmp eq i32 %0, 2 +; CHECK: br i1 false + br i1 %1, label %Impossible, label %NotTwoAndGreaterThanTwo + +NotTwoAndGreaterThanTwo: + ret i32 2 + +Impossible: + ret i32 1 + +LessThanOrEqualToTwo: + ret i32 0 +}
\ No newline at end of file diff --git a/test/Transforms/CorrelatedValuePropagation/crash.ll b/test/Transforms/CorrelatedValuePropagation/crash.ll new file mode 100644 index 0000000..8636788 --- /dev/null +++ b/test/Transforms/CorrelatedValuePropagation/crash.ll @@ -0,0 +1,20 @@ +; RUN: opt < %s -correlated-propagation + +; PR8161 +define void @test1() nounwind ssp { +entry: + br label %for.end + +for.cond.us.us: ; preds = %for.cond.us.us + %cmp6.i.us.us = icmp sgt i32 1, 0 + %lor.ext.i.us.us = zext i1 %cmp6.i.us.us to i32 + %lor.ext.add.i.us.us = select i1 %cmp6.i.us.us, i32 %lor.ext.i.us.us, i32 undef + %conv.i.us.us = trunc i32 %lor.ext.add.i.us.us to i16 + %sext.us.us = shl i16 %conv.i.us.us, 8 + %conv6.us.us = ashr i16 %sext.us.us, 8 + %and.us.us = and i16 %conv6.us.us, %and.us.us + br i1 false, label %for.end, label %for.cond.us.us + +for.end: ; preds = %for.cond.us, %for.cond.us.us, %entry + ret void +} diff --git a/test/Transforms/ValuePropagation/dg.exp b/test/Transforms/CorrelatedValuePropagation/dg.exp index de42dad..de42dad 100644 --- a/test/Transforms/ValuePropagation/dg.exp +++ b/test/Transforms/CorrelatedValuePropagation/dg.exp diff --git a/test/Transforms/DeadStoreElimination/2008-07-28-load-store.ll b/test/Transforms/DeadStoreElimination/2008-07-28-load-store.ll index 9fcbf07..3675548 100644 --- a/test/Transforms/DeadStoreElimination/2008-07-28-load-store.ll +++ b/test/Transforms/DeadStoreElimination/2008-07-28-load-store.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -dse -S | not grep tmp5 +; RUN: opt < %s -basicaa -dse -S | not grep tmp5 ; PR2599 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" diff --git a/test/Transforms/DeadStoreElimination/PartialStore.ll b/test/Transforms/DeadStoreElimination/PartialStore.ll index ab1edf5..c97d481 100644 --- a/test/Transforms/DeadStoreElimination/PartialStore.ll +++ b/test/Transforms/DeadStoreElimination/PartialStore.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -dse -S | \ +; RUN: opt < %s -basicaa -dse -S | \ ; RUN: not grep {store i8} ; Ensure that the dead store is deleted in this case. It is wholely ; overwritten by the second store. diff --git a/test/Transforms/DeadStoreElimination/const-pointers.ll b/test/Transforms/DeadStoreElimination/const-pointers.ll index 728a118..7d57804 100644 --- a/test/Transforms/DeadStoreElimination/const-pointers.ll +++ b/test/Transforms/DeadStoreElimination/const-pointers.ll @@ -1,4 +1,4 @@ -; RUN: opt %s -dse -S | FileCheck %s +; RUN: opt %s -basicaa -dse -S | FileCheck %s %t = type { i32 } diff --git a/test/Transforms/DeadStoreElimination/context-sensitive.ll b/test/Transforms/DeadStoreElimination/context-sensitive.ll index 7954310..071d7e1 100644 --- a/test/Transforms/DeadStoreElimination/context-sensitive.ll +++ b/test/Transforms/DeadStoreElimination/context-sensitive.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -dse -S | not grep DEAD +; RUN: opt < %s -basicaa -dse -S | not grep DEAD target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" declare void @ext() diff --git a/test/Transforms/DeadStoreElimination/free.ll b/test/Transforms/DeadStoreElimination/free.ll index 8b81ee3..3c980cc 100644 --- a/test/Transforms/DeadStoreElimination/free.ll +++ b/test/Transforms/DeadStoreElimination/free.ll @@ -1,5 +1,11 @@ -; RUN: opt < %s -dse -S | not grep DEAD +; RUN: opt < %s -basicaa -dse -S | FileCheck %s +target datalayout = "e-p:64:64:64" + +; CHECK: @test +; CHECK-NEXT: bitcast +; CHECK-NEXT: @free +; CHECK-NEXT: ret void define void @test(i32* %Q, i32* %P) { %DEAD = load i32* %Q ; <i32> [#uses=1] store i32 %DEAD, i32* %P @@ -7,9 +13,28 @@ define void @test(i32* %Q, i32* %P) { ret void } +; CHECK: @test2 +; CHECK-NEXT: bitcast +; CHECK-NEXT: @free +; CHECK-NEXT: ret void define void @test2({i32, i32}* %P) { %Q = getelementptr {i32, i32} *%P, i32 0, i32 1 store i32 4, i32* %Q free {i32,i32}* %P ret void } + +; CHECK: @test4 +; CHECK-NOT: store +; CHECK: ret void +define void @test4() { + %m = call i8* @malloc(i64 24) + store i8 0, i8* %m + %m1 = getelementptr i8* %m, i64 1 + store i8 1, i8* %m1 + call void @free(i8* %m) + ret void +} + +declare void @free(i8*) +declare i8* @malloc(i64) diff --git a/test/Transforms/DeadStoreElimination/lifetime.ll b/test/Transforms/DeadStoreElimination/lifetime.ll index fd127d9..2b5cc5a 100644 --- a/test/Transforms/DeadStoreElimination/lifetime.ll +++ b/test/Transforms/DeadStoreElimination/lifetime.ll @@ -1,4 +1,4 @@ -; RUN: opt -S -dse < %s | FileCheck %s +; RUN: opt -S -basicaa -dse < %s | FileCheck %s target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" diff --git a/test/Transforms/DeadStoreElimination/no-targetdata.ll b/test/Transforms/DeadStoreElimination/no-targetdata.ll index 7e8f52a..6c7f940 100644 --- a/test/Transforms/DeadStoreElimination/no-targetdata.ll +++ b/test/Transforms/DeadStoreElimination/no-targetdata.ll @@ -1,4 +1,4 @@ -; RUN: opt %s -dse -S | FileCheck %s +; RUN: opt %s -basicaa -dse -S | FileCheck %s declare void @test1f() diff --git a/test/Transforms/DeadStoreElimination/simple.ll b/test/Transforms/DeadStoreElimination/simple.ll index d859640..d3f5c61 100644 --- a/test/Transforms/DeadStoreElimination/simple.ll +++ b/test/Transforms/DeadStoreElimination/simple.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -dse -S | not grep DEAD +; RUN: opt < %s -basicaa -dse -S | not grep DEAD target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" define void @test(i32* %Q, i32* %P) { diff --git a/test/Transforms/FunctionAttrs/2008-09-03-ReadNone.ll b/test/Transforms/FunctionAttrs/2008-09-03-ReadNone.ll index 535a1d0..946453f 100644 --- a/test/Transforms/FunctionAttrs/2008-09-03-ReadNone.ll +++ b/test/Transforms/FunctionAttrs/2008-09-03-ReadNone.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -functionattrs -S | grep readnone | count 4 +; RUN: opt < %s -basicaa -functionattrs -S | grep readnone | count 4 @x = global i32 0 declare i32 @e() readnone diff --git a/test/Transforms/FunctionAttrs/2008-09-03-ReadOnly.ll b/test/Transforms/FunctionAttrs/2008-09-03-ReadOnly.ll index b455fdd..22eca13 100644 --- a/test/Transforms/FunctionAttrs/2008-09-03-ReadOnly.ll +++ b/test/Transforms/FunctionAttrs/2008-09-03-ReadOnly.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -functionattrs -S | grep readonly | count 2 +; RUN: opt < %s -basicaa -functionattrs -S | grep readonly | count 2 define i32 @f() { entry: diff --git a/test/Transforms/FunctionAttrs/2008-10-04-LocalMemory.ll b/test/Transforms/FunctionAttrs/2008-10-04-LocalMemory.ll index c6c2e13..faac118 100644 --- a/test/Transforms/FunctionAttrs/2008-10-04-LocalMemory.ll +++ b/test/Transforms/FunctionAttrs/2008-10-04-LocalMemory.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -functionattrs -S | FileCheck %s +; RUN: opt < %s -basicaa -functionattrs -S | FileCheck %s %struct.X = type { i32*, i32* } diff --git a/test/Transforms/FunctionAttrs/2008-12-29-Constant.ll b/test/Transforms/FunctionAttrs/2008-12-29-Constant.ll index 672b5e1..9655da4 100644 --- a/test/Transforms/FunctionAttrs/2008-12-29-Constant.ll +++ b/test/Transforms/FunctionAttrs/2008-12-29-Constant.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -functionattrs -S | grep readnone +; RUN: opt < %s -basicaa -functionattrs -S | grep readnone @s = external constant i8 ; <i8*> [#uses=1] diff --git a/test/Transforms/FunctionAttrs/2010-10-30-volatile.ll b/test/Transforms/FunctionAttrs/2010-10-30-volatile.ll new file mode 100644 index 0000000..f21fabc --- /dev/null +++ b/test/Transforms/FunctionAttrs/2010-10-30-volatile.ll @@ -0,0 +1,10 @@ +; RUN: opt < %s -functionattrs -S | FileCheck %s +; PR8279 + +@g = constant i32 1 + +define void @foo() { +; CHECK: void @foo() { + %tmp = volatile load i32* @g + ret void +} diff --git a/test/Transforms/GVN/2007-07-25-InfiniteLoop.ll b/test/Transforms/GVN/2007-07-25-InfiniteLoop.ll index 2e0a101..9983374 100644 --- a/test/Transforms/GVN/2007-07-25-InfiniteLoop.ll +++ b/test/Transforms/GVN/2007-07-25-InfiniteLoop.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -gvn -S | not grep {tmp10 =} +; RUN: opt < %s -basicaa -gvn -S | not grep {tmp10 =} %struct.INT2 = type { i32, i32 } @blkshifts = external global %struct.INT2* ; <%struct.INT2**> [#uses=2] diff --git a/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll b/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll index 0be3379..14cb91b 100644 --- a/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll +++ b/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll @@ -1,30 +1,33 @@ -; RUN: opt < %s -gvn -S | grep {tmp17625.* = phi i32. } -; RUN: opt < %s -gvn -S | grep {tmp17631.* = phi i32. } +; RUN: opt < %s -basicaa -gvn -S | FileCheck %s -@last = external global [65 x i32*] ; <[65 x i32*]*> [#uses=1] +@last = external global [65 x i32*] define i32 @NextRootMove(i32 %wtm) { -cond_next95: ; preds = %cond_true85, %cond_true79, %cond_true73, %bb68 - %tmp17618 = load i32** getelementptr ([65 x i32*]* @last, i32 0, i32 1), align 4 ; <i32*> [#uses=0] +entry: + %tmp17618 = load i32** getelementptr ([65 x i32*]* @last, i32 0, i32 1), align 4 +; CHECK: entry: +; CHECK-NEXT: %tmp17618 = load +; CHECK-NOT: load +; CHECK-NOT: phi br label %cond_true116 -cond_true116: ; preds = %cond_true111 +cond_true116: br i1 false, label %cond_true128, label %cond_true145 -cond_true128: ; preds = %cond_true121 - %tmp17625 = load i32** getelementptr ([65 x i32*]* @last, i32 0, i32 1), align 4 ; <i32*> [#uses=0] +cond_true128: + %tmp17625 = load i32** getelementptr ([65 x i32*]* @last, i32 0, i32 1), align 4 br i1 false, label %bb98.backedge, label %return.loopexit -bb98.backedge: ; preds = %bb171, %cond_true145, %cond_true128 +bb98.backedge: br label %cond_true116 -cond_true145: ; preds = %cond_false - %tmp17631 = load i32** getelementptr ([65 x i32*]* @last, i32 0, i32 1), align 4 ; <i32*> [#uses=0] +cond_true145: + %tmp17631 = load i32** getelementptr ([65 x i32*]* @last, i32 0, i32 1), align 4 br i1 false, label %bb98.backedge, label %return.loopexit -return.loopexit: ; preds = %bb171, %cond_true145, %cond_true128 +return.loopexit: br label %return -return: ; preds = %return.loopexit, %cond_next95, %cond_true85 +return: ret i32 0 } diff --git a/test/Transforms/GVN/2007-07-31-NoDomInherit.ll b/test/Transforms/GVN/2007-07-31-NoDomInherit.ll index faa1157..f2c0012 100644 --- a/test/Transforms/GVN/2007-07-31-NoDomInherit.ll +++ b/test/Transforms/GVN/2007-07-31-NoDomInherit.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -gvn -S | grep {tmp47 = phi i32 } +; RUN: opt < %s -basicaa -gvn -S | grep {tmp47 = phi i32 } %struct.anon = type { i32 (i32, i32, i32)*, i32, i32, [3 x i32], i8*, i8*, i8* } @debug = external constant i32 ; <i32*> [#uses=0] diff --git a/test/Transforms/GVN/2007-07-31-RedundantPhi.ll b/test/Transforms/GVN/2007-07-31-RedundantPhi.ll index 0d1d8bc..a570e35 100644 --- a/test/Transforms/GVN/2007-07-31-RedundantPhi.ll +++ b/test/Transforms/GVN/2007-07-31-RedundantPhi.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -gvn -S | not grep {tmp701 =} +; RUN: opt < %s -basicaa -gvn -S | not grep {tmp701 =} @img_width = external global i16 ; <i16*> [#uses=2] diff --git a/test/Transforms/GVN/2008-07-02-Unreachable.ll b/test/Transforms/GVN/2008-07-02-Unreachable.ll index 361c155..be69cfc 100644 --- a/test/Transforms/GVN/2008-07-02-Unreachable.ll +++ b/test/Transforms/GVN/2008-07-02-Unreachable.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -gvn -S | grep {ret i8 \[%\]tmp3} +; RUN: opt < %s -basicaa -gvn -S | grep {ret i8 \[%\]tmp3} ; PR2503 @g_3 = external global i8 ; <i8*> [#uses=2] diff --git a/test/Transforms/GVN/2009-07-13-MemDepSortFail.ll b/test/Transforms/GVN/2009-07-13-MemDepSortFail.ll index 641e920..f079108 100644 --- a/test/Transforms/GVN/2009-07-13-MemDepSortFail.ll +++ b/test/Transforms/GVN/2009-07-13-MemDepSortFail.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -gvn | llvm-dis ; PR4256 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:32:32" -target triple = "i386-linux-gnu" +target triple = "i386-pc-linux-gnu" %llvm.dbg.anchor.type = type { i32, i32 } %struct.cset = type { i8*, i8, i8, i32, i8* } %struct.lmat = type { %struct.re_guts*, i32, %llvm.dbg.anchor.type*, i8*, i8*, i8*, i8*, i8**, i32, i8*, i8*, i8*, i8*, i8* } diff --git a/test/Transforms/GVN/2010-03-31-RedundantPHIs.ll b/test/Transforms/GVN/2010-03-31-RedundantPHIs.ll index 066e303..d6e1c6b 100644 --- a/test/Transforms/GVN/2010-03-31-RedundantPHIs.ll +++ b/test/Transforms/GVN/2010-03-31-RedundantPHIs.ll @@ -1,4 +1,7 @@ -; RUN: opt < %s -gvn -enable-full-load-pre -S | FileCheck %s +; RUN: opt < %s -basicaa -gvn -S | FileCheck %s + +; CHECK-NOT: load +; CHECK-NOT: phi define i8* @cat(i8* %s1, ...) nounwind { entry: @@ -29,18 +32,11 @@ bb10: ; preds = %bb8 br label %bb11 bb11: ; preds = %bb10, %bb9 -; CHECK: bb11: -; CHECK: phi -; CHECK-NOT: phi br label %bb12 bb12: ; preds = %bb11, %bb6 -; CHECK: bb12: -; CHECK: phi -; CHECK-NOT: phi br i1 undef, label %bb8, label %bb13 bb13: ; preds = %bb12 -; CHECK: bb13: ret i8* undef } diff --git a/test/Transforms/GVN/2010-11-13-Simplify.ll b/test/Transforms/GVN/2010-11-13-Simplify.ll new file mode 100644 index 0000000..07585a2 --- /dev/null +++ b/test/Transforms/GVN/2010-11-13-Simplify.ll @@ -0,0 +1,15 @@ +; RUN: opt < %s -basicaa -gvn -S | FileCheck %s + +declare i32 @foo(i32) readnone + +define i1 @bar() { +; CHECK: @bar + %a = call i32 @foo (i32 0) readnone + %b = call i32 @foo (i32 0) readnone + %c = and i32 %a, %b + %x = call i32 @foo (i32 %a) readnone + %y = call i32 @foo (i32 %c) readnone + %z = icmp eq i32 %x, %y + ret i1 %z +; CHECK: ret i1 true +} diff --git a/test/Transforms/GVN/calls-nonlocal.ll b/test/Transforms/GVN/calls-nonlocal.ll index f0edf09..24ef2e9 100644 --- a/test/Transforms/GVN/calls-nonlocal.ll +++ b/test/Transforms/GVN/calls-nonlocal.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -gvn -S | grep strlen | count 2 +; RUN: opt < %s -basicaa -gvn -S | grep strlen | count 2 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" diff --git a/test/Transforms/GVN/condprop.ll b/test/Transforms/GVN/condprop.ll index e212d79..f7bcacd 100644 --- a/test/Transforms/GVN/condprop.ll +++ b/test/Transforms/GVN/condprop.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -gvn -S | grep {br i1 false} +; RUN: opt < %s -basicaa -gvn -S | grep {br i1 false} @a = external global i32 ; <i32*> [#uses=7] diff --git a/test/Transforms/GVN/invariant-simple.ll b/test/Transforms/GVN/invariant-simple.ll index 0a4182c..98ea48c 100644 --- a/test/Transforms/GVN/invariant-simple.ll +++ b/test/Transforms/GVN/invariant-simple.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -gvn -S | FileCheck %s +; RUN: opt < %s -basicaa -gvn -S | 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-darwin7" diff --git a/test/Transforms/GVN/lifetime-simple.ll b/test/Transforms/GVN/lifetime-simple.ll index 48e5bc8..02f7bcc 100644 --- a/test/Transforms/GVN/lifetime-simple.ll +++ b/test/Transforms/GVN/lifetime-simple.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -gvn -S | FileCheck %s +; RUN: opt < %s -basicaa -gvn -S | 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-darwin7" diff --git a/test/Transforms/GVN/load-constant-mem.ll b/test/Transforms/GVN/load-constant-mem.ll index 87f33ea..314c806 100644 --- a/test/Transforms/GVN/load-constant-mem.ll +++ b/test/Transforms/GVN/load-constant-mem.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -gvn -instcombine -S | grep {ret i32 0} +; RUN: opt < %s -basicaa -gvn -instcombine -S | grep {ret i32 0} ; PR4189 @G = external constant [4 x i32] diff --git a/test/Transforms/GVN/load-pre-licm.ll b/test/Transforms/GVN/load-pre-licm.ll new file mode 100644 index 0000000..63541ad --- /dev/null +++ b/test/Transforms/GVN/load-pre-licm.ll @@ -0,0 +1,39 @@ +; RUN: opt -S -basicaa -gvn < %s | 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-n8:16:32" +target triple = "i386-apple-darwin11.0.0" + +@sortlist = external global [5001 x i32], align 4 + +define void @Bubble() nounwind noinline { +; CHECK: entry: +; CHECK-NEXT: %tmp7.pre = load i32 +entry: + br label %while.body5 + +; CHECK: while.body5: +; CHECK: %tmp7 = phi i32 +; CHECK-NOT: %tmp7 = load i32 +while.body5: + %indvar = phi i32 [ 0, %entry ], [ %tmp6, %if.end ] + %tmp5 = add i32 %indvar, 2 + %arrayidx9 = getelementptr [5001 x i32]* @sortlist, i32 0, i32 %tmp5 + %tmp6 = add i32 %indvar, 1 + %arrayidx = getelementptr [5001 x i32]* @sortlist, i32 0, i32 %tmp6 + %tmp7 = load i32* %arrayidx, align 4 + %tmp10 = load i32* %arrayidx9, align 4 + %cmp11 = icmp sgt i32 %tmp7, %tmp10 + br i1 %cmp11, label %if.then, label %if.end + +; CHECK: if.then: +if.then: + store i32 %tmp10, i32* %arrayidx, align 4 + store i32 %tmp7, i32* %arrayidx9, align 4 + br label %if.end + +if.end: + %exitcond = icmp eq i32 %tmp6, 100 + br i1 %exitcond, label %while.end.loopexit, label %while.body5 + +while.end.loopexit: + ret void +} diff --git a/test/Transforms/GVN/lpre-call-wrap-2.ll b/test/Transforms/GVN/lpre-call-wrap-2.ll index 79512a3..e39f3ed 100644 --- a/test/Transforms/GVN/lpre-call-wrap-2.ll +++ b/test/Transforms/GVN/lpre-call-wrap-2.ll @@ -1,4 +1,4 @@ -; RUN: opt -S -gvn -enable-load-pre %s | FileCheck %s +; RUN: opt -S -basicaa -gvn -enable-load-pre %s | FileCheck %s ; ; The partially redundant load in bb1 should be hoisted to "bb". This comes ; from this C code (GCC PR 23455): diff --git a/test/Transforms/GVN/mixed.ll b/test/Transforms/GVN/mixed.ll index 5152f68..6bfada2 100644 --- a/test/Transforms/GVN/mixed.ll +++ b/test/Transforms/GVN/mixed.ll @@ -1,5 +1,5 @@ -; RUN: opt < %s -gvn -S | not grep DEADLOAD -; RUN: opt < %s -gvn -S | not grep DEADGEP +; RUN: opt < %s -basicaa -gvn -S | not grep DEADLOAD +; RUN: opt < %s -basicaa -gvn -S | not grep DEADGEP define i32 @main(i32** %p) { block1: diff --git a/test/Transforms/GVN/non-local-offset.ll b/test/Transforms/GVN/non-local-offset.ll new file mode 100644 index 0000000..8eaa999 --- /dev/null +++ b/test/Transforms/GVN/non-local-offset.ll @@ -0,0 +1,59 @@ +; RUN: opt -basicaa -gvn -S < %s | FileCheck %s + +target datalayout = "e-p:64:64:64" + +; GVN should ignore the store to p[1] to see that the load from p[0] is +; fully redundant. + +; CHECK: @yes +; CHECK: if.then: +; CHECK-NEXT: store i32 0, i32* %q +; CHECK-NEXT: ret void + +define void @yes(i1 %c, i32* %p, i32* %q) nounwind { +entry: + store i32 0, i32* %p + %p1 = getelementptr inbounds i32* %p, i64 1 + store i32 1, i32* %p1 + br i1 %c, label %if.else, label %if.then + +if.then: + %t = load i32* %p + store i32 %t, i32* %q + ret void + +if.else: + ret void +} + +; GVN should ignore the store to p[1] to see that the first load from p[0] is +; fully redundant. However, the second load is larger, so it's not a simple +; redundancy. + +; CHECK: @watch_out_for_size_change +; CHECK: if.then: +; CHECK-NEXT: store i32 0, i32* %q +; CHECK-NEXT: ret void +; CHECK: if.else: +; CHECK: load i64* %pc +; CHECK: store i64 + +define void @watch_out_for_size_change(i1 %c, i32* %p, i32* %q) nounwind { +entry: + store i32 0, i32* %p + %p1 = getelementptr inbounds i32* %p, i64 1 + store i32 1, i32* %p1 + br i1 %c, label %if.else, label %if.then + +if.then: + %t = load i32* %p + store i32 %t, i32* %q + ret void + +if.else: + %pc = bitcast i32* %p to i64* + %qc = bitcast i32* %q to i64* + %t64 = load i64* %pc + store i64 %t64, i64* %qc + ret void +} diff --git a/test/Transforms/GVN/nonescaping-malloc.ll b/test/Transforms/GVN/nonescaping-malloc.ll index 5a42d95..1d50205 100644 --- a/test/Transforms/GVN/nonescaping-malloc.ll +++ b/test/Transforms/GVN/nonescaping-malloc.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -gvn -stats -disable-output |& grep {Number of loads deleted} +; RUN: opt < %s -basicaa -gvn -stats -disable-output |& grep {Number of loads deleted} ; rdar://7363102 ; GVN should be able to eliminate load %tmp22.i, because it is redundant with diff --git a/test/Transforms/GVN/null-aliases-nothing.ll b/test/Transforms/GVN/null-aliases-nothing.ll index 4d533bb..9e4ae18 100644 --- a/test/Transforms/GVN/null-aliases-nothing.ll +++ b/test/Transforms/GVN/null-aliases-nothing.ll @@ -1,4 +1,4 @@ -; RUN: opt %s -gvn -S | FileCheck %s +; RUN: opt %s -basicaa -gvn -S | FileCheck %s %t = type { i32 } declare void @test1f(i8*) diff --git a/test/Transforms/GVN/pre-load.ll b/test/Transforms/GVN/pre-load.ll index d40a467..bf4add4 100644 --- a/test/Transforms/GVN/pre-load.ll +++ b/test/Transforms/GVN/pre-load.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -gvn -enable-load-pre -S | FileCheck %s +; RUN: opt < %s -basicaa -gvn -enable-load-pre -S | FileCheck %s 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-n8:16:32:64" define i32 @test1(i32* %p, i1 %C) { diff --git a/test/Transforms/GVN/pre-single-pred.ll b/test/Transforms/GVN/pre-single-pred.ll index 706a16b..f1f5c71 100644 --- a/test/Transforms/GVN/pre-single-pred.ll +++ b/test/Transforms/GVN/pre-single-pred.ll @@ -1,4 +1,13 @@ -; RUN: opt < %s -gvn -enable-load-pre -S | not grep {tmp3 = load} +; RUN: opt < %s -gvn -enable-load-pre -S | FileCheck %s +; This testcase assumed we'll PRE the load into %for.cond, but we don't actually +; verify that doing so is safe. If there didn't _happen_ to be a load in +; %for.end, we would actually be lengthening the execution on some paths, and +; we were never actually checking that case. Now we actually do perform some +; conservative checking to make sure we don't make paths longer, but we don't +; currently get this case, which we got lucky on previously. +; +; Now that that faulty assumption is corrected, test that we DON'T incorrectly +; hoist the load. Doing the right thing for the wrong reasons is still a bug. @p = external global i32 define i32 @f(i32 %n) nounwind { @@ -13,6 +22,8 @@ for.cond: ; preds = %for.inc, %entry for.cond.for.end_crit_edge: ; preds = %for.cond br label %for.end +; CHECK: for.body: +; CHECK-NEXT: %tmp3 = load i32* @p for.body: ; preds = %for.cond %tmp3 = load i32* @p ; <i32> [#uses=1] %dec = add i32 %tmp3, -1 ; <i32> [#uses=2] @@ -20,6 +31,7 @@ for.body: ; preds = %for.cond %cmp6 = icmp slt i32 %dec, 0 ; <i1> [#uses=1] br i1 %cmp6, label %for.body.for.end_crit_edge, label %for.inc +; CHECK: for.body.for.end_crit_edge: for.body.for.end_crit_edge: ; preds = %for.body br label %for.end diff --git a/test/Transforms/GVN/rle-must-alias.ll b/test/Transforms/GVN/rle-must-alias.ll index d61eb81..4797240 100644 --- a/test/Transforms/GVN/rle-must-alias.ll +++ b/test/Transforms/GVN/rle-must-alias.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -gvn -S | grep {DEAD = phi i32 } +; RUN: opt < %s -basicaa -gvn -S | grep {DEAD = phi i32 } ; GVN should eliminate the fully redundant %9 GEP which ; allows DEAD to be removed. This is PR3198. diff --git a/test/Transforms/GVN/rle-nonlocal.ll b/test/Transforms/GVN/rle-nonlocal.ll index 5c73dad..6b74e9a 100644 --- a/test/Transforms/GVN/rle-nonlocal.ll +++ b/test/Transforms/GVN/rle-nonlocal.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -gvn -S | FileCheck %s +; RUN: opt < %s -basicaa -gvn -S | FileCheck %s define i32 @main(i32** %p) { block1: diff --git a/test/Transforms/GVN/rle-semidominated.ll b/test/Transforms/GVN/rle-semidominated.ll index 04e8c38..c6cd1fd 100644 --- a/test/Transforms/GVN/rle-semidominated.ll +++ b/test/Transforms/GVN/rle-semidominated.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -gvn -S | grep {DEAD = phi i32 } +; RUN: opt < %s -basicaa -gvn -S | grep {DEAD = phi i32 } define i32 @main(i32* %p) { block1: diff --git a/test/Transforms/GVN/rle.ll b/test/Transforms/GVN/rle.ll index d656c1a..2e43321 100644 --- a/test/Transforms/GVN/rle.ll +++ b/test/Transforms/GVN/rle.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -gvn -S | FileCheck %s +; RUN: opt < %s -basicaa -gvn -S | FileCheck %s ; 32-bit little endian target. 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" diff --git a/test/Transforms/GlobalOpt/2008-07-17-addrspace.ll b/test/Transforms/GlobalOpt/2008-07-17-addrspace.ll index 5e64f80..390e77a 100644 --- a/test/Transforms/GlobalOpt/2008-07-17-addrspace.ll +++ b/test/Transforms/GlobalOpt/2008-07-17-addrspace.ll @@ -4,7 +4,7 @@ ; RUN: opt < %s -globalopt -S > %t ; Check that the new global values still have their address space -; RUN: cat %t | grep global.*addrspace +; RUN: cat %t | grep addrspace.*global @struct = internal addrspace(1) global { i32, i32 } zeroinitializer @array = internal addrspace(1) global [ 2 x i32 ] zeroinitializer diff --git a/test/Transforms/GlobalOpt/2010-10-19-WeakOdr.ll b/test/Transforms/GlobalOpt/2010-10-19-WeakOdr.ll new file mode 100644 index 0000000..ad5b440 --- /dev/null +++ b/test/Transforms/GlobalOpt/2010-10-19-WeakOdr.ll @@ -0,0 +1,16 @@ +; RUN: opt < %s -globalopt -S | FileCheck %s + +; PR8389: Globals with weak_odr linkage type must not be modified + +; CHECK: weak_odr global i32 0 + +@SomeVar = weak_odr global i32 0 + +@llvm.global_ctors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @CTOR } ] + +define internal void @CTOR() { + store i32 23, i32* @SomeVar + ret void +} + + diff --git a/test/Transforms/GlobalOpt/crash.ll b/test/Transforms/GlobalOpt/crash.ll index 701472c..bb1fc84 100644 --- a/test/Transforms/GlobalOpt/crash.ll +++ b/test/Transforms/GlobalOpt/crash.ll @@ -40,3 +40,18 @@ xx: } declare noalias i8* @malloc(i64) nounwind + + +; PR8063 +@permute_bitrev.bitrev = internal global i32* null, align 8 +define void @permute_bitrev() nounwind { +entry: + %tmp = load i32** @permute_bitrev.bitrev, align 8 + %conv = sext i32 0 to i64 + %mul = mul i64 %conv, 4 + %call = call i8* @malloc(i64 %mul) + %0 = bitcast i8* %call to i32* + store i32* %0, i32** @permute_bitrev.bitrev, align 8 + ret void +} + diff --git a/test/Transforms/GlobalOpt/ctor-list-opt.ll b/test/Transforms/GlobalOpt/ctor-list-opt.ll index 887e7ee..7e90bc1 100644 --- a/test/Transforms/GlobalOpt/ctor-list-opt.ll +++ b/test/Transforms/GlobalOpt/ctor-list-opt.ll @@ -74,7 +74,7 @@ define void @setto(i32* %P, i32 %V) { declare double @cos(double) define internal void @CTOR8() { - %X = call double @cos( double 1.000000e+00 ) ; <double> [#uses=1] + %X = call double @cos( double 0.000000e+00 ) ; <double> [#uses=1] store double %X, double* @D ret void } diff --git a/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll b/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll index f4bab35..bd174a8 100644 --- a/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll +++ b/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll @@ -21,10 +21,10 @@ define internal i32 @vfu2(%struct.MYstr* byval align 4 %u) nounwind readonly { entry: %0 = getelementptr %struct.MYstr* %u, i32 0, i32 1 ; <i32*> [#uses=1] %1 = load i32* %0 -; CHECK: load i32* getelementptr inbounds (%struct.MYstr* @mystr, i32 0, i32 1) ; <i32> [#uses=1] +; CHECK: load i32* getelementptr inbounds (%struct.MYstr* @mystr, i32 0, i32 1) %2 = getelementptr %struct.MYstr* %u, i32 0, i32 0 ; <i8*> [#uses=1] %3 = load i8* %2 -; CHECK: load i8* getelementptr inbounds (%struct.MYstr* @mystr, i32 0, i32 0) ; <i8> [#uses=1] +; CHECK: load i8* getelementptr inbounds (%struct.MYstr* @mystr, i32 0, i32 0) %4 = zext i8 %3 to i32 %5 = add i32 %4, %1 ret i32 %5 diff --git a/test/Transforms/IndVarSimplify/2003-12-10-IndVarDeadCode.ll b/test/Transforms/IndVarSimplify/2003-12-10-IndVarDeadCode.ll deleted file mode 100644 index c8f97e3..0000000 --- a/test/Transforms/IndVarSimplify/2003-12-10-IndVarDeadCode.ll +++ /dev/null @@ -1,25 +0,0 @@ -; The induction variable canonicalization pass shouldn't leave dead -; instructions laying around! -; -; RUN: opt < %s -indvars -S | \ -; RUN: not grep {#uses=0} - -define i32 @mul(i32 %x, i32 %y) { -entry: - br label %tailrecurse - -tailrecurse: ; preds = %endif, %entry - %accumulator.tr = phi i32 [ %x, %entry ], [ %tmp.9, %endif ] ; <i32> [#uses=2] - %y.tr = phi i32 [ %y, %entry ], [ %tmp.8, %endif ] ; <i32> [#uses=2] - %tmp.1 = icmp eq i32 %y.tr, 0 ; <i1> [#uses=1] - br i1 %tmp.1, label %return, label %endif - -endif: ; preds = %tailrecurse - %tmp.8 = add i32 %y.tr, -1 ; <i32> [#uses=1] - %tmp.9 = add i32 %accumulator.tr, %x ; <i32> [#uses=1] - br label %tailrecurse - -return: ; preds = %tailrecurse - ret i32 %accumulator.tr -} - diff --git a/test/Transforms/IndVarSimplify/2009-05-24-useafterfree.ll b/test/Transforms/IndVarSimplify/2009-05-24-useafterfree.ll index d73eee8..d211e3b 100644 --- a/test/Transforms/IndVarSimplify/2009-05-24-useafterfree.ll +++ b/test/Transforms/IndVarSimplify/2009-05-24-useafterfree.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -indvars ; PR4258 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:32:32" -target triple = "i386-linux-gnu" +target triple = "i386-pc-linux-gnu" define void @0(i32*, i32*, i32, i32) nounwind { br i1 false, label %bb.nph1.preheader, label %.outer._crit_edge diff --git a/test/Transforms/IndVarSimplify/loop-invariant-step.ll b/test/Transforms/IndVarSimplify/loop-invariant-step.ll deleted file mode 100644 index 2d2d1fe..0000000 --- a/test/Transforms/IndVarSimplify/loop-invariant-step.ll +++ /dev/null @@ -1,33 +0,0 @@ -; RUN: opt < %s -loop-index-split -instcombine -indvars -disable-output -; PR4455 - -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" - -declare i8* @fast_memcpy(i8*, i8*, i64) - -define void @dvdsub_decode() nounwind { -entry: ; preds = %bb1 - br label %LoopA - -LoopA: ; preds = %LoopA, %entry - %x1.0.i17 = phi i32 [ %t0, %LoopA ], [ 0, %entry ] ; <i32> [#uses=2] - %t0 = add i32 %x1.0.i17, 1 ; <i32> [#uses=1] - br i1 undef, label %LoopA, label %middle - -middle: ; preds = %LoopA - %t1 = sub i32 0, %x1.0.i17 ; <i32> [#uses=1] - %t2 = add i32 %t1, 1 ; <i32> [#uses=1] - br label %LoopB - -LoopB: ; preds = %LoopB, %bb.nph.i27 - %y.029.i = phi i32 [ 0, %middle ], [ %t7, %LoopB ] ; <i32> [#uses=2] - %t3 = mul i32 %y.029.i, %t2 ; <i32> [#uses=1] - %t4 = sext i32 %t3 to i64 ; <i64> [#uses=1] - %t5 = getelementptr i8* null, i64 %t4 ; <i8*> [#uses=1] - %t6 = call i8* @fast_memcpy(i8* %t5, i8* undef, i64 undef) nounwind ; <i8*> [#uses=0] - %t7 = add i32 %y.029.i, 1 ; <i32> [#uses=1] - br i1 undef, label %LoopB, label %exit - -exit: - ret void -} diff --git a/test/Transforms/IndVarSimplify/loop_evaluate10.ll b/test/Transforms/IndVarSimplify/loop_evaluate10.ll index 4ec4aca..269478a 100644 --- a/test/Transforms/IndVarSimplify/loop_evaluate10.ll +++ b/test/Transforms/IndVarSimplify/loop_evaluate10.ll @@ -5,7 +5,7 @@ ; exit is taken. Indvars should correctly compute the exit values. 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-linux-gnu" +target triple = "x86_64-pc-linux-gnu" %struct..0anon = type <{ i8, [3 x i8] }> define i32 @main() nounwind { diff --git a/test/Transforms/Inline/devirtualize-3.ll b/test/Transforms/Inline/devirtualize-3.ll index 0a50786..c32be4e 100644 --- a/test/Transforms/Inline/devirtualize-3.ll +++ b/test/Transforms/Inline/devirtualize-3.ll @@ -1,4 +1,4 @@ -; RUN: opt -inline -S -scalarrepl -gvn -instcombine %s | FileCheck %s +; RUN: opt -basicaa -inline -S -scalarrepl -gvn -instcombine %s | FileCheck %s ; PR5009 ; CHECK: define i32 @main() diff --git a/test/Transforms/Inline/devirtualize.ll b/test/Transforms/Inline/devirtualize.ll index 9ed4b69..51ea4ba 100644 --- a/test/Transforms/Inline/devirtualize.ll +++ b/test/Transforms/Inline/devirtualize.ll @@ -1,4 +1,4 @@ -; RUN: opt -S -inline -scalarrepl -instcombine -simplifycfg -instcombine -gvn -globaldce %s | FileCheck %s +; RUN: opt -S -basicaa -inline -scalarrepl -instcombine -simplifycfg -instcombine -gvn -globaldce %s | FileCheck %s 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-n8:16:32:64" target triple = "x86_64-apple-darwin10.0.0" diff --git a/test/Transforms/Inline/gvn-inline-iteration.ll b/test/Transforms/Inline/gvn-inline-iteration.ll index 32144d4..e502fd5 100644 --- a/test/Transforms/Inline/gvn-inline-iteration.ll +++ b/test/Transforms/Inline/gvn-inline-iteration.ll @@ -1,4 +1,4 @@ -; RUN: opt -inline -gvn %s -S -max-cg-scc-iterations=1 | FileCheck %s +; RUN: opt -basicaa -inline -gvn %s -S -max-cg-scc-iterations=1 | FileCheck %s ; rdar://6295824 and PR6724 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-n8:16:32:64" diff --git a/test/Transforms/InstCombine/2010-07-19-sqrt.ll b/test/Transforms/InstCombine/2010-07-19-sqrt.ll deleted file mode 100644 index 6505382..0000000 --- a/test/Transforms/InstCombine/2010-07-19-sqrt.ll +++ /dev/null @@ -1,16 +0,0 @@ -; RUN: opt -S -instcombine %s | FileCheck %s - -define float @foo(float %x) nounwind readnone ssp { -entry: -; CHECK-NOT: fpext -; CHECK-NOT: sqrt( -; CHECK: sqrtf( -; CHECK-NOT: fptrunc - %conv = fpext float %x to double ; <double> [#uses=1] - %call = tail call double @sqrt(double %conv) nounwind ; <double> [#uses=1] - %conv1 = fptrunc double %call to float ; <float> [#uses=1] -; CHECK: ret float - ret float %conv1 -} - -declare double @sqrt(double) readnone diff --git a/test/Transforms/InstCombine/2010-08-19-StoreNarrowing.ll b/test/Transforms/InstCombine/2010-08-19-StoreNarrowing.ll deleted file mode 100644 index d4d5289..0000000 --- a/test/Transforms/InstCombine/2010-08-19-StoreNarrowing.ll +++ /dev/null @@ -1,21 +0,0 @@ -; RUN: opt -S -instcombine %s | not grep and -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-n8:16:32:64" -target triple = "x86_64-apple-darwin10.0.0" - -%class.A = type { i8, [3 x i8] } - -define void @_ZN1AC2Ev(%class.A* %this) nounwind ssp align 2 { -entry: - %0 = bitcast %class.A* %this to i32* ; <i32*> [#uses=5] - %1 = load i32* %0, align 4 ; <i32> [#uses=1] - %2 = and i32 %1, -8 ; <i32> [#uses=2] - store i32 %2, i32* %0, align 4 - %3 = and i32 %2, -57 ; <i32> [#uses=1] - %4 = or i32 %3, 8 ; <i32> [#uses=2] - store i32 %4, i32* %0, align 4 - %5 = and i32 %4, -65 ; <i32> [#uses=2] - store i32 %5, i32* %0, align 4 - %6 = and i32 %5, -129 ; <i32> [#uses=1] - store i32 %6, i32* %0, align 4 - ret void -} diff --git a/test/Transforms/InstCombine/2010-11-01-lshr-mask.ll b/test/Transforms/InstCombine/2010-11-01-lshr-mask.ll new file mode 100644 index 0000000..d74c70e --- /dev/null +++ b/test/Transforms/InstCombine/2010-11-01-lshr-mask.ll @@ -0,0 +1,20 @@ +; RUN: opt -instcombine -S < %s | FileCheck %s +; <rdar://problem/8606771> + +define i32 @main(i32 %argc) nounwind ssp { +entry: + %tmp3151 = trunc i32 %argc to i8 + %tmp3161 = or i8 %tmp3151, -17 + %tmp3162 = and i8 %tmp3151, 122 + %tmp3163 = xor i8 %tmp3162, -17 + %tmp4114 = shl i8 %tmp3163, 6 + %tmp4115 = xor i8 %tmp4114, %tmp3163 + %tmp4120 = xor i8 %tmp3161, %tmp4115 +; CHECK: lshr i8 %tmp4115, 1 +; CHECK-NOT: shl i8 %tmp4126, 6 + %tmp4126 = lshr i8 %tmp4120, 7 + %tmp4127 = mul i8 %tmp4126, 64 + %tmp4086 = zext i8 %tmp4127 to i32 +; CHECK: ret i32 + ret i32 %tmp4086 +} diff --git a/test/Transforms/InstCombine/and2.ll b/test/Transforms/InstCombine/and2.ll index a5a6574..d898ea3 100644 --- a/test/Transforms/InstCombine/and2.ll +++ b/test/Transforms/InstCombine/and2.ll @@ -8,3 +8,21 @@ define i1 @test1(double %X, double %Y) { ret i1 %bothcond ; CHECK: fcmp ord double %Y, %X } + +define i1 @test2(i1 %X, i1 %Y) { + %a = and i1 %X, %Y + %b = and i1 %a, %X + ret i1 %b +; CHECK: @test2 +; CHECK-NEXT: and i1 %X, %Y +; CHECK-NEXT: ret +} + +define i32 @test3(i32 %X, i32 %Y) { + %a = and i32 %X, %Y + %b = and i32 %Y, %a + ret i32 %b +; CHECK: @test3 +; CHECK-NEXT: and i32 %X, %Y +; CHECK-NEXT: ret +} diff --git a/test/Transforms/InstCombine/bit-checks.ll b/test/Transforms/InstCombine/bit-checks.ll index d774c09..79a096f 100644 --- a/test/Transforms/InstCombine/bit-checks.ll +++ b/test/Transforms/InstCombine/bit-checks.ll @@ -23,4 +23,350 @@ entry: %or.cond = or i1 %tobool, %tobool3 ; <i1> [#uses=1] %storemerge = select i1 %or.cond, i32 0, i32 1 ; <i32> [#uses=1] ret i32 %storemerge -}
\ No newline at end of file +} + +; tests to check combining (icmp eq (A & B), C) & (icmp eq (A & D), E) +; tests to check if (icmp eq (A & B), 0) is treated like (icmp eq (A & B), B) +; if B is a single bit constant + +; (icmp eq (A & B), 0) & (icmp eq (A & D), 0) -> (icmp eq (A & (B|D)), 0) +define i32 @main3(i32 %argc, i8** nocapture %argv) nounwind readnone ssp { +entry: + %and = and i32 %argc, 7 ; <i32> [#uses=1] + %tobool = icmp eq i32 %and, 0 ; <i1> [#uses=1] + %and2 = and i32 %argc, 48 ; <i32> [#uses=1] + %tobool3 = icmp eq i32 %and2, 0 ; <i1> [#uses=1] + %and.cond = and i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %and.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +define i32 @main3b(i32 %argc, i8** nocapture %argv) nounwind readnone ssp { +entry: + %and = and i32 %argc, 7 ; <i32> [#uses=1] + %tobool = icmp eq i32 %and, 0 ; <i1> [#uses=1] + %and2 = and i32 %argc, 16 ; <i32> [#uses=1] + %tobool3 = icmp ne i32 %and2, 16 ; <i1> [#uses=1] + %and.cond = and i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %and.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +define i32 @main3e_like(i32 %argc, i32 %argc2, i32 %argc3, i8** nocapture %argv) + nounwind readnone ssp { +entry: + %and = and i32 %argc, %argc2 ; <i32> [#uses=1] + %tobool = icmp eq i32 %and, 0 ; <i1> [#uses=1] + %and2 = and i32 %argc, %argc3 ; <i32> [#uses=1] + %tobool3 = icmp eq i32 %and2, 0 ; <i1> [#uses=1] + %and.cond = and i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %and.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +; (icmp ne (A & B), 0) | (icmp ne (A & D), 0) -> (icmp ne (A & (B|D)), 0) +define i32 @main3c(i32 %argc, i8** nocapture %argv) nounwind readnone ssp { +entry: + %and = and i32 %argc, 7 ; <i32> [#uses=1] + %tobool = icmp ne i32 %and, 0 ; <i1> [#uses=1] + %and2 = and i32 %argc, 48 ; <i32> [#uses=1] + %tobool3 = icmp ne i32 %and2, 0 ; <i1> [#uses=1] + %or.cond = or i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %or.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +define i32 @main3d(i32 %argc, i8** nocapture %argv) nounwind readnone ssp { +entry: + %and = and i32 %argc, 7 ; <i32> [#uses=1] + %tobool = icmp ne i32 %and, 0 ; <i1> [#uses=1] + %and2 = and i32 %argc, 16 ; <i32> [#uses=1] + %tobool3 = icmp eq i32 %and2, 16 ; <i1> [#uses=1] + %or.cond = or i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %or.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +define i32 @main3f_like(i32 %argc, i32 %argc2, i32 %argc3, i8** nocapture %argv) + nounwind readnone ssp { +entry: + %and = and i32 %argc, %argc2 ; <i32> [#uses=1] + %tobool = icmp ne i32 %and, 0 ; <i1> [#uses=1] + %and2 = and i32 %argc, %argc3 ; <i32> [#uses=1] + %tobool3 = icmp ne i32 %and2, 0 ; <i1> [#uses=1] + %or.cond = or i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %or.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +; (icmp eq (A & B), B) & (icmp eq (A & D), D) -> (icmp eq (A & (B|D)), (B|D)) +define i32 @main4(i32 %argc, i8** nocapture %argv) nounwind readnone ssp { +entry: + %and = and i32 %argc, 7 ; <i32> [#uses=1] + %tobool = icmp eq i32 %and, 7 ; <i1> [#uses=1] + %and2 = and i32 %argc, 48 ; <i32> [#uses=1] + %tobool3 = icmp eq i32 %and2, 48 ; <i1> [#uses=1] + %and.cond = and i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %and.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +define i32 @main4b(i32 %argc, i8** nocapture %argv) nounwind readnone ssp { +entry: + %and = and i32 %argc, 7 ; <i32> [#uses=1] + %tobool = icmp eq i32 %and, 7 ; <i1> [#uses=1] + %and2 = and i32 %argc, 16 ; <i32> [#uses=1] + %tobool3 = icmp ne i32 %and2, 0 ; <i1> [#uses=1] + %and.cond = and i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %and.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +define i32 @main4e_like(i32 %argc, i32 %argc2, i32 %argc3, i8** nocapture %argv) + nounwind readnone ssp { +entry: + %and = and i32 %argc, %argc2 ; <i32> [#uses=1] + %tobool = icmp eq i32 %and, %argc2 ; <i1> [#uses=1] + %and2 = and i32 %argc, %argc3 ; <i32> [#uses=1] + %tobool3 = icmp eq i32 %and2, %argc3 ; <i1> [#uses=1] + %and.cond = and i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %and.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +; (icmp ne (A & B), B) | (icmp ne (A & D), D) -> (icmp ne (A & (B|D)), (B|D)) +define i32 @main4c(i32 %argc, i8** nocapture %argv) nounwind readnone ssp { +entry: + %and = and i32 %argc, 7 ; <i32> [#uses=1] + %tobool = icmp ne i32 %and, 7 ; <i1> [#uses=1] + %and2 = and i32 %argc, 48 ; <i32> [#uses=1] + %tobool3 = icmp ne i32 %and2, 48 ; <i1> [#uses=1] + %or.cond = or i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %or.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +define i32 @main4d(i32 %argc, i8** nocapture %argv) nounwind readnone ssp { +entry: + %and = and i32 %argc, 7 ; <i32> [#uses=1] + %tobool = icmp ne i32 %and, 7 ; <i1> [#uses=1] + %and2 = and i32 %argc, 16 ; <i32> [#uses=1] + %tobool3 = icmp eq i32 %and2, 0 ; <i1> [#uses=1] + %or.cond = or i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %or.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +define i32 @main4f_like(i32 %argc, i32 %argc2, i32 %argc3, i8** nocapture %argv) + nounwind readnone ssp { +entry: + %and = and i32 %argc, %argc2 ; <i32> [#uses=1] + %tobool = icmp ne i32 %and, %argc2 ; <i1> [#uses=1] + %and2 = and i32 %argc, %argc3 ; <i32> [#uses=1] + %tobool3 = icmp ne i32 %and2, %argc3 ; <i1> [#uses=1] + %or.cond = or i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %or.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +; (icmp eq (A & B), A) & (icmp eq (A & D), A) -> (icmp eq (A & (B&D)), A) +define i32 @main5_like(i32 %argc, i32 %argc2, i8** nocapture %argv) + nounwind readnone ssp { +entry: + %and = and i32 %argc, 7 ; <i32> [#uses=1] + %tobool = icmp eq i32 %and, 7 ; <i1> [#uses=1] + %and2 = and i32 %argc2, 7 ; <i32> [#uses=1] + %tobool3 = icmp eq i32 %and2, 7 ; <i1> [#uses=1] + %and.cond = and i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %and.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +define i32 @main5e_like(i32 %argc, i32 %argc2, i32 %argc3, i8** nocapture %argv) + nounwind readnone ssp { +entry: + %and = and i32 %argc, %argc2 ; <i32> [#uses=1] + %tobool = icmp eq i32 %and, %argc ; <i1> [#uses=1] + %and2 = and i32 %argc, %argc3 ; <i32> [#uses=1] + %tobool3 = icmp eq i32 %and2, %argc ; <i1> [#uses=1] + %and.cond = and i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %and.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +; (icmp ne (A & B), A) | (icmp ne (A & D), A) -> (icmp ne (A & (B&D)), A) +define i32 @main5c_like(i32 %argc, i32 %argc2, i8** nocapture %argv) + nounwind readnone ssp { +entry: + %and = and i32 %argc, 7 ; <i32> [#uses=1] + %tobool = icmp ne i32 %and, 7 ; <i1> [#uses=1] + %and2 = and i32 %argc2, 7 ; <i32> [#uses=1] + %tobool3 = icmp ne i32 %and2, 7 ; <i1> [#uses=1] + %or.cond = or i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %or.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +define i32 @main5f_like(i32 %argc, i32 %argc2, i32 %argc3, i8** nocapture %argv) + nounwind readnone ssp { +entry: + %and = and i32 %argc, %argc2 ; <i32> [#uses=1] + %tobool = icmp ne i32 %and, %argc ; <i1> [#uses=1] + %and2 = and i32 %argc, %argc3 ; <i32> [#uses=1] + %tobool3 = icmp ne i32 %and2, %argc ; <i1> [#uses=1] + %or.cond = or i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %or.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +; (icmp eq (A & B), C) & (icmp eq (A & D), E) -> (icmp eq (A & (B|D)), (C|E)) +; if B, C, D, E are constant, and it's possible +define i32 @main6(i32 %argc, i8** nocapture %argv) nounwind readnone ssp { +entry: + %and = and i32 %argc, 7 ; <i32> [#uses=1] + %tobool = icmp eq i32 %and, 3 ; <i1> [#uses=1] + %and2 = and i32 %argc, 48 ; <i32> [#uses=1] + %tobool3 = icmp eq i32 %and2, 16 ; <i1> [#uses=1] + %and.cond = and i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %and.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +define i32 @main6b(i32 %argc, i8** nocapture %argv) nounwind readnone ssp { +entry: + %and = and i32 %argc, 7 ; <i32> [#uses=1] + %tobool = icmp eq i32 %and, 3 ; <i1> [#uses=1] + %and2 = and i32 %argc, 16 ; <i32> [#uses=1] + %tobool3 = icmp ne i32 %and2, 0 ; <i1> [#uses=1] + %and.cond = and i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %and.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +; (icmp ne (A & B), C) | (icmp ne (A & D), E) -> (icmp ne (A & (B|D)), (C|E)) +; if B, C, D, E are constant, and it's possible +define i32 @main6c(i32 %argc, i8** nocapture %argv) nounwind readnone ssp { +entry: + %and = and i32 %argc, 7 ; <i32> [#uses=1] + %tobool = icmp ne i32 %and, 3 ; <i1> [#uses=1] + %and2 = and i32 %argc, 48 ; <i32> [#uses=1] + %tobool3 = icmp ne i32 %and2, 16 ; <i1> [#uses=1] + %or.cond = or i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %or.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +define i32 @main6d(i32 %argc, i8** nocapture %argv) nounwind readnone ssp { +entry: + %and = and i32 %argc, 7 ; <i32> [#uses=1] + %tobool = icmp ne i32 %and, 3 ; <i1> [#uses=1] + %and2 = and i32 %argc, 16 ; <i32> [#uses=1] + %tobool3 = icmp eq i32 %and2, 0 ; <i1> [#uses=1] + %or.cond = or i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %or.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +; test parameter permutations +; (B & A) == B & (D & A) == D +define i32 @main7a(i32 %argc, i32 %argc2, i32 %argc3, i8** nocapture %argv) + nounwind readnone ssp { +entry: + %and1 = and i32 %argc2, %argc ; <i32> [#uses=1] + %tobool = icmp eq i32 %and1, %argc2 ; <i1> [#uses=1] + %and2 = and i32 %argc3, %argc ; <i32> [#uses=1] + %tobool3 = icmp eq i32 %and2, %argc3 ; <i1> [#uses=1] + %and.cond = and i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %and.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +; B == (A & B) & D == (A & D) +define i32 @main7b(i32 %argc, i32 %argc2, i32 %argc3, i8** nocapture %argv) + nounwind readnone ssp { +entry: + %and1 = and i32 %argc, %argc2 ; <i32> [#uses=1] + %tobool = icmp eq i32 %argc2, %and1 ; <i1> [#uses=1] + %and2 = and i32 %argc, %argc3 ; <i32> [#uses=1] + %tobool3 = icmp eq i32 %argc3, %and2 ; <i1> [#uses=1] + %and.cond = and i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %and.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +; B == (B & A) & D == (D & A) +define i32 @main7c(i32 %argc, i32 %argc2, i32 %argc3, i8** nocapture %argv) + nounwind readnone ssp { +entry: + %and1 = and i32 %argc2, %argc ; <i32> [#uses=1] + %tobool = icmp eq i32 %argc2, %and1 ; <i1> [#uses=1] + %and2 = and i32 %argc3, %argc ; <i32> [#uses=1] + %tobool3 = icmp eq i32 %argc3, %and2 ; <i1> [#uses=1] + %and.cond = and i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %and.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +; (A & (B & C)) == (B & C) & (A & (D & E)) == (D & E) +define i32 @main7d(i32 %argc, i32 %argc2, i32 %argc3, + i32 %argc4, i32 %argc5, i8** nocapture %argv) + nounwind readnone ssp { +entry: + %bc = and i32 %argc2, %argc4 ; <i32> [#uses=1] + %de = and i32 %argc3, %argc5 ; <i32> [#uses=1] + %and1 = and i32 %argc, %bc ; <i32> [#uses=1] + %tobool = icmp eq i32 %and1, %bc ; <i1> [#uses=1] + %and2 = and i32 %argc, %de ; <i32> [#uses=1] + %tobool3 = icmp eq i32 %and2, %de ; <i1> [#uses=1] + %and.cond = and i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %and.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +; ((B & C) & A) == (B & C) & ((D & E) & A) == (D & E) +define i32 @main7e(i32 %argc, i32 %argc2, i32 %argc3, + i32 %argc4, i32 %argc5, i8** nocapture %argv) + nounwind readnone ssp { +entry: + %bc = and i32 %argc2, %argc4 ; <i32> [#uses=1] + %de = and i32 %argc3, %argc5 ; <i32> [#uses=1] + %and1 = and i32 %bc, %argc ; <i32> [#uses=1] + %tobool = icmp eq i32 %and1, %bc ; <i1> [#uses=1] + %and2 = and i32 %de, %argc ; <i32> [#uses=1] + %tobool3 = icmp eq i32 %and2, %de ; <i1> [#uses=1] + %and.cond = and i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %and.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +; (B & C) == (A & (B & C)) & (D & E) == (A & (D & E)) +define i32 @main7f(i32 %argc, i32 %argc2, i32 %argc3, + i32 %argc4, i32 %argc5, i8** nocapture %argv) + nounwind readnone ssp { +entry: + %bc = and i32 %argc2, %argc4 ; <i32> [#uses=1] + %de = and i32 %argc3, %argc5 ; <i32> [#uses=1] + %and1 = and i32 %argc, %bc ; <i32> [#uses=1] + %tobool = icmp eq i32 %bc, %and1 ; <i1> [#uses=1] + %and2 = and i32 %argc, %de ; <i32> [#uses=1] + %tobool3 = icmp eq i32 %de, %and2 ; <i1> [#uses=1] + %and.cond = and i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %and.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} + +; (B & C) == ((B & C) & A) & (D & E) == ((D & E) & A) +define i32 @main7g(i32 %argc, i32 %argc2, i32 %argc3, + i32 %argc4, i32 %argc5, i8** nocapture %argv) + nounwind readnone ssp { +entry: + %bc = and i32 %argc2, %argc4 ; <i32> [#uses=1] + %de = and i32 %argc3, %argc5 ; <i32> [#uses=1] + %and1 = and i32 %bc, %argc ; <i32> [#uses=1] + %tobool = icmp eq i32 %bc, %and1 ; <i1> [#uses=1] + %and2 = and i32 %de, %argc ; <i32> [#uses=1] + %tobool3 = icmp eq i32 %de, %and2 ; <i1> [#uses=1] + %and.cond = and i1 %tobool, %tobool3 ; <i1> [#uses=1] + %storemerge = select i1 %and.cond, i32 0, i32 1 ; <i32> [#uses=1] + ret i32 %storemerge +} diff --git a/test/Transforms/InstCombine/bitcast-store.ll b/test/Transforms/InstCombine/bitcast-store.ll new file mode 100644 index 0000000..e4a61e9 --- /dev/null +++ b/test/Transforms/InstCombine/bitcast-store.ll @@ -0,0 +1,21 @@ +; RUN: opt -S -instcombine < %s | FileCheck %s + +; Instcombine should preserve metadata and alignment while +; folding a bitcast into a store. + +; CHECK: store i32 (...)** bitcast (i8** getelementptr inbounds ([5 x i8*]* @G, i64 0, i64 2) to i32 (...)**), i32 (...)*** %0, align 16, !tag !0 + +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-n8:16:32:64" + +%struct.A = type { i32 (...)** } + +@G = external constant [5 x i8*] + +define void @foo(%struct.A* %a) nounwind { +entry: + %0 = bitcast %struct.A* %a to i8*** + store i8** getelementptr inbounds ([5 x i8*]* @G, i64 0, i64 2), i8*** %0, align 16, !tag !0 + ret void +} + +!0 = metadata !{metadata !"hello"} diff --git a/test/Transforms/InstCombine/cast.ll b/test/Transforms/InstCombine/cast.ll index 102d2f0..7547877 100644 --- a/test/Transforms/InstCombine/cast.ll +++ b/test/Transforms/InstCombine/cast.ll @@ -437,8 +437,8 @@ define i64 @test47(i8 %A) { ret i64 %E ; CHECK: @test47 ; CHECK-NEXT: %B = sext i8 %A to i64 -; CHECK-NEXT: %C = or i64 %B, 42 -; CHECK-NEXT: %E = and i64 %C, 4294967295 +; CHECK-NEXT: %C = and i64 %B, 4294967253 +; CHECK-NEXT: %E = or i64 %C, 42 ; CHECK-NEXT: ret i64 %E } @@ -508,8 +508,8 @@ define i32 @test52(i64 %A) { ret i32 %E ; CHECK: @test52 ; CHECK-NEXT: %B = trunc i64 %A to i32 -; CHECK-NEXT: %C = or i32 %B, 32962 -; CHECK-NEXT: %D = and i32 %C, 40186 +; CHECK-NEXT: %C = and i32 %B, 7224 +; CHECK-NEXT: %D = or i32 %C, 32962 ; CHECK-NEXT: ret i32 %D } @@ -521,8 +521,8 @@ define i64 @test53(i32 %A) { ret i64 %E ; CHECK: @test53 ; CHECK-NEXT: %B = zext i32 %A to i64 -; CHECK-NEXT: %C = or i64 %B, 32962 -; CHECK-NEXT: %D = and i64 %C, 40186 +; CHECK-NEXT: %C = and i64 %B, 7224 +; CHECK-NEXT: %D = or i64 %C, 32962 ; CHECK-NEXT: ret i64 %D } @@ -534,8 +534,8 @@ define i32 @test54(i64 %A) { ret i32 %E ; CHECK: @test54 ; CHECK-NEXT: %B = trunc i64 %A to i32 -; CHECK-NEXT: %C = or i32 %B, -32574 -; CHECK-NEXT: %D = and i32 %C, -25350 +; CHECK-NEXT: %C = and i32 %B, 7224 +; CHECK-NEXT: %D = or i32 %C, -32574 ; CHECK-NEXT: ret i32 %D } @@ -547,8 +547,8 @@ define i64 @test55(i32 %A) { ret i64 %E ; CHECK: @test55 ; CHECK-NEXT: %B = zext i32 %A to i64 -; CHECK-NEXT: %C = or i64 %B, -32574 -; CHECK-NEXT: %D = and i64 %C, -25350 +; CHECK-NEXT: %C = and i64 %B, 7224 +; CHECK-NEXT: %D = or i64 %C, -32574 ; CHECK-NEXT: ret i64 %D } @@ -584,8 +584,8 @@ define i64 @test58(i64 %A) nounwind { ; CHECK: @test58 ; CHECK-NEXT: %C = lshr i64 %A, 8 -; CHECK-NEXT: %D = or i64 %C, 128 -; CHECK-NEXT: %E = and i64 %D, 16777215 +; CHECK-NEXT: %D = and i64 %C, 16777087 +; CHECK-NEXT: %E = or i64 %D, 128 ; CHECK-NEXT: ret i64 %E } diff --git a/test/Transforms/InstCombine/crash.ll b/test/Transforms/InstCombine/crash.ll index 30d467e..a600af0 100644 --- a/test/Transforms/InstCombine/crash.ll +++ b/test/Transforms/InstCombine/crash.ll @@ -252,3 +252,36 @@ entry: %conv6 = zext i1 %cmp5 to i32 ; <i32> [#uses=0] ret void } + +%s1 = type { %s2, %s2, [6 x %s2], i32, i32, i32, [1 x i32], [0 x i8] } +%s2 = type { i64 } +define void @test13() nounwind ssp { +entry: + %0 = getelementptr inbounds %s1* null, i64 0, i32 2, i64 0, i32 0 + %1 = bitcast i64* %0 to i32* + %2 = getelementptr inbounds %s1* null, i64 0, i32 2, i64 1, i32 0 + %.pre = load i32* %1, align 8 + %3 = lshr i32 %.pre, 19 + %brmerge = or i1 undef, undef + %4 = and i32 %3, 3 + %5 = add nsw i32 %4, 1 + %6 = shl i32 %5, 19 + %7 = add i32 %6, 1572864 + %8 = and i32 %7, 1572864 + %9 = load i64* %2, align 8 + %trunc156 = trunc i64 %9 to i32 + %10 = and i32 %trunc156, -1537 + %11 = and i32 %10, -6145 + %12 = or i32 %11, 2048 + %13 = and i32 %12, -24577 + %14 = or i32 %13, 16384 + %15 = or i32 %14, 98304 + store i32 %15, i32* undef, align 8 + %16 = and i32 %15, -1572865 + %17 = or i32 %16, %8 + store i32 %17, i32* undef, align 8 + %18 = and i32 %17, -449 + %19 = or i32 %18, 64 + store i32 %19, i32* undef, align 8 + unreachable +} diff --git a/test/Transforms/InstCombine/fold-calls.ll b/test/Transforms/InstCombine/fold-calls.ll new file mode 100644 index 0000000..504f874 --- /dev/null +++ b/test/Transforms/InstCombine/fold-calls.ll @@ -0,0 +1,19 @@ +; RUN: opt -instcombine -S < %s | FileCheck %s + +; This shouldn't fold, because sin(inf) is invalid. +; CHECK: @foo +; CHECK: %t = call double @sin(double 0x7FF0000000000000) +define double @foo() { + %t = call double @sin(double 0x7FF0000000000000) + ret double %t +} + +; This should fold. +; CHECK: @bar +; CHECK: ret double 0.0 +define double @bar() { + %t = call double @sin(double 0.0) + ret double %t +} + +declare double @sin(double) diff --git a/test/Transforms/InstCombine/memcpy.ll b/test/Transforms/InstCombine/memcpy.ll index 2e7b2c0..8a2e3aa 100644 --- a/test/Transforms/InstCombine/memcpy.ll +++ b/test/Transforms/InstCombine/memcpy.ll @@ -1,10 +1,19 @@ ; RUN: opt < %s -instcombine -S | FileCheck %s -declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind -define void @test4(i8* %a) { - tail call void @llvm.memcpy.i32( i8* %a, i8* %a, i32 100, i32 1 ) +define void @test1(i8* %a) { + tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %a, i8* %a, i32 100, i32 1, i1 false) ret void -} -; CHECK: define void @test4 +; CHECK: define void @test1 ; CHECK-NEXT: ret void +} + + +; PR8267 +define void @test2(i8* %a) { + tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %a, i8* %a, i32 100, i32 1, i1 true) + ret void +; CHECK: define void @test2 +; CHECK-NEXT: call void @llvm.memcpy +} diff --git a/test/Transforms/InstCombine/neon-intrinsics.ll b/test/Transforms/InstCombine/neon-intrinsics.ll new file mode 100644 index 0000000..3ad09cc --- /dev/null +++ b/test/Transforms/InstCombine/neon-intrinsics.ll @@ -0,0 +1,25 @@ +; RUN: opt < %s -instcombine -S | FileCheck %s + +; The alignment arguments for NEON load/store intrinsics can be increased +; by instcombine. Check for this. + +; CHECK: vld4.v2i32({{.*}}, i32 32) +; CHECK: vst4.v2i32({{.*}}, i32 16) + +@x = common global [8 x i32] zeroinitializer, align 32 +@y = common global [8 x i32] zeroinitializer, align 16 + +%struct.__neon_int32x2x4_t = type { <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32> } + +define void @test() nounwind ssp { + %tmp1 = call %struct.__neon_int32x2x4_t @llvm.arm.neon.vld4.v2i32(i8* bitcast ([8 x i32]* @x to i8*), i32 1) + %tmp2 = extractvalue %struct.__neon_int32x2x4_t %tmp1, 0 + %tmp3 = extractvalue %struct.__neon_int32x2x4_t %tmp1, 1 + %tmp4 = extractvalue %struct.__neon_int32x2x4_t %tmp1, 2 + %tmp5 = extractvalue %struct.__neon_int32x2x4_t %tmp1, 3 + call void @llvm.arm.neon.vst4.v2i32(i8* bitcast ([8 x i32]* @y to i8*), <2 x i32> %tmp2, <2 x i32> %tmp3, <2 x i32> %tmp4, <2 x i32> %tmp5, i32 1) + ret void +} + +declare %struct.__neon_int32x2x4_t @llvm.arm.neon.vld4.v2i32(i8*, i32) nounwind readonly +declare void @llvm.arm.neon.vst4.v2i32(i8*, <2 x i32>, <2 x i32>, <2 x i32>, <2 x i32>, i32) nounwind diff --git a/test/Transforms/InstCombine/or.ll b/test/Transforms/InstCombine/or.ll index c3526b7..500cad2 100644 --- a/test/Transforms/InstCombine/or.ll +++ b/test/Transforms/InstCombine/or.ll @@ -316,8 +316,8 @@ entry: %E = or i32 %D, %C ret i32 %E ; CHECK: @test30 -; CHECK: %B = or i32 %A, 32962 -; CHECK: %E = and i32 %B, -25350 +; CHECK: %D = and i32 %A, -58312 +; CHECK: %E = or i32 %D, 32962 ; CHECK: ret i32 %E } @@ -332,8 +332,8 @@ define i64 @test31(i64 %A) nounwind readnone ssp noredzone { %F = or i64 %D, %E ret i64 %F ; CHECK: @test31 -; CHECK-NEXT: %bitfield = or i64 %A, 32962 -; CHECK-NEXT: %F = and i64 %bitfield, 4294941946 +; CHECK-NEXT: %E1 = and i64 %A, 4294908984 +; CHECK-NEXT: %F = or i64 %E1, 32962 ; CHECK-NEXT: ret i64 %F } @@ -350,3 +350,29 @@ define <4 x i32> @test32(<4 x i1> %and.i1352, <4 x i32> %vecinit6.i176, <4 x i32 ; CHECK: or <4 x i32> %and.i, %and.i129 } +define i1 @test33(i1 %X, i1 %Y) { + %a = or i1 %X, %Y + %b = or i1 %a, %X + ret i1 %b +; CHECK: @test33 +; CHECK-NEXT: or i1 %X, %Y +; CHECK-NEXT: ret +} + +define i32 @test34(i32 %X, i32 %Y) { + %a = or i32 %X, %Y + %b = or i32 %Y, %a + ret i32 %b +; CHECK: @test34 +; CHECK-NEXT: or i32 %X, %Y +; CHECK-NEXT: ret +} + +define i32 @test35(i32 %a, i32 %b) { + %1 = or i32 %a, 1135 + %2 = or i32 %1, %b + ret i32 %2 + ; CHECK: @test35 + ; CHECK-NEXT: or i32 %a, %b + ; CHECK-NEXT: or i32 %1, 1135 +} diff --git a/test/Transforms/InstCombine/phi.ll b/test/Transforms/InstCombine/phi.ll index fc321e9..c3e034f 100644 --- a/test/Transforms/InstCombine/phi.ll +++ b/test/Transforms/InstCombine/phi.ll @@ -402,3 +402,89 @@ if.else: ; preds = %entry store i32 %tmp5, i32* %res br label %if.end } + +; PR4413 +declare i32 @ext() +; CHECK: @test17 +define i32 @test17(i1 %a) { +entry: + br i1 %a, label %bb1, label %bb2 + +bb1: ; preds = %entry + %0 = tail call i32 @ext() ; <i32> [#uses=1] + br label %bb2 + +bb2: ; preds = %bb1, %entry + %cond = phi i1 [ true, %bb1 ], [ false, %entry ] ; <i1> [#uses=1] +; CHECK-NOT: %val = phi i32 [ %0, %bb1 ], [ 0, %entry ] + %val = phi i32 [ %0, %bb1 ], [ 0, %entry ] ; <i32> [#uses=1] + %res = select i1 %cond, i32 %val, i32 0 ; <i32> [#uses=1] +; CHECK: ret i32 %cond + ret i32 %res +} + +define i1 @test18(i1 %cond) { + %zero = alloca i32 + %one = alloca i32 + br i1 %cond, label %true, label %false +true: + br label %ret +false: + br label %ret +ret: + %ptr = phi i32* [ %zero, %true ] , [ %one, %false ] + %isnull = icmp eq i32* %ptr, null + ret i1 %isnull +; CHECK: @test18 +; CHECK: ret i1 false +} + +define i1 @test19(i1 %cond, double %x) { + br i1 %cond, label %true, label %false +true: + br label %ret +false: + br label %ret +ret: + %p = phi double [ %x, %true ], [ 0x7FF0000000000000, %false ]; RHS = +infty + %cmp = fcmp ule double %x, %p + ret i1 %cmp +; CHECK: @test19 +; CHECK: ret i1 true +} + +define i1 @test20(i1 %cond) { + %a = alloca i32 + %b = alloca i32 + %c = alloca i32 + br i1 %cond, label %true, label %false +true: + br label %ret +false: + br label %ret +ret: + %p = phi i32* [ %a, %true ], [ %b, %false ] + %r = icmp eq i32* %p, %c + ret i1 %r +; CHECK: @test20 +; CHECK: ret i1 false +} + +define i1 @test21(i1 %c1, i1 %c2) { + %a = alloca i32 + %b = alloca i32 + %c = alloca i32 + br i1 %c1, label %true, label %false +true: + br label %loop +false: + br label %loop +loop: + %p = phi i32* [ %a, %true ], [ %b, %false ], [ %p, %loop ] + %r = icmp eq i32* %p, %c + br i1 %c2, label %ret, label %loop +ret: + ret i1 %r +; CHECK: @test21 +; CHECK: ret i1 false +} diff --git a/test/Transforms/InstCombine/pr8547.ll b/test/Transforms/InstCombine/pr8547.ll new file mode 100644 index 0000000..f26035c --- /dev/null +++ b/test/Transforms/InstCombine/pr8547.ll @@ -0,0 +1,26 @@ +; RUN: opt < %s -instcombine -S | FileCheck %s +; Converting the 2 shifts to SHL 6 without the AND is wrong. PR 8547. + +@g_2 = global i32 0, align 4 +@.str = constant [10 x i8] c"g_2 = %d\0A\00" + +declare i32 @printf(i8*, ...) + +define i32 @main() nounwind { +codeRepl: + br label %for.cond + +for.cond: ; preds = %for.cond, %codeRepl + %storemerge = phi i32 [ 0, %codeRepl ], [ 5, %for.cond ] + store i32 %storemerge, i32* @g_2, align 4 + %shl = shl i32 %storemerge, 30 + %conv2 = lshr i32 %shl, 24 +; CHECK: %0 = shl i32 %storemerge, 6 +; CHECK: %conv2 = and i32 %0, 64 + %tobool = icmp eq i32 %conv2, 0 + br i1 %tobool, label %for.cond, label %codeRepl2 + +codeRepl2: ; preds = %for.cond + %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str, i64 0, i64 0), i32 %conv2) nounwind + ret i32 0 +}
\ No newline at end of file diff --git a/test/Transforms/InstCombine/select-crash.ll b/test/Transforms/InstCombine/select-crash.ll new file mode 100644 index 0000000..8ee3369 --- /dev/null +++ b/test/Transforms/InstCombine/select-crash.ll @@ -0,0 +1,20 @@ +; RUN: opt < %s -instcombine -S | FileCheck %s +; Formerly crashed, PR8490. + +define fastcc double @gimp_operation_color_balance_map(float %value, double %highlights) nounwind readnone inlinehint { +entry: +; CHECK: gimp_operation_color_balance_map +; CHECK: fsub double -0.000000 + %conv = fpext float %value to double + %div = fdiv double %conv, 1.600000e+01 + %add = fadd double %div, 1.000000e+00 + %div1 = fdiv double 1.000000e+00, %add + %sub = fsub double 1.075000e+00, %div1 + %sub24 = fsub double 1.000000e+00, %sub + %add26 = fadd double %sub, 1.000000e+00 + %cmp86 = fcmp ogt double %highlights, 0.000000e+00 + %cond90 = select i1 %cmp86, double %sub24, double %add26 + %mul91 = fmul double %highlights, %cond90 + %add94 = fadd double undef, %mul91 + ret double %add94 +} diff --git a/test/Transforms/InstCombine/select.ll b/test/Transforms/InstCombine/select.ll index 246a7bc..120d158 100644 --- a/test/Transforms/InstCombine/select.ll +++ b/test/Transforms/InstCombine/select.ll @@ -470,3 +470,42 @@ define i32 @test37(i32 %x) { ; CHECK: or i32 {{.*}}, 1 ; CHECK: ret } + +define i1 @test38(i1 %cond) { + %zero = alloca i32 + %one = alloca i32 + %ptr = select i1 %cond, i32* %zero, i32* %one + %isnull = icmp eq i32* %ptr, null + ret i1 %isnull +; CHECK: @test38 +; CHECK: ret i1 false +} + +define i1 @test39(i1 %cond, double %x) { + %s = select i1 %cond, double %x, double 0x7FF0000000000000 ; RHS = +infty + %cmp = fcmp ule double %x, %s + ret i1 %cmp +; CHECK: @test39 +; CHECK: ret i1 true +} + +define i1 @test40(i1 %cond) { + %a = alloca i32 + %b = alloca i32 + %c = alloca i32 + %s = select i1 %cond, i32* %a, i32* %b + %r = icmp eq i32* %s, %c + ret i1 %r +; CHECK: @test40 +; CHECK: ret i1 false +} + +define i32 @test41(i1 %cond, i32 %x, i32 %y) { + %z = and i32 %x, %y + %s = select i1 %cond, i32 %y, i32 %z + %r = and i32 %x, %s + ret i32 %r +; CHECK: @test41 +; CHECK: %r = and i32 %x, %y +; CHECK: ret i32 %r +} diff --git a/test/Transforms/InstCombine/sqrt.ll b/test/Transforms/InstCombine/sqrt.ll new file mode 100644 index 0000000..69e511b --- /dev/null +++ b/test/Transforms/InstCombine/sqrt.ll @@ -0,0 +1,32 @@ +; RUN: opt -S -instcombine %s | FileCheck %s + +define float @test1(float %x) nounwind readnone ssp { +entry: +; CHECK: @test1 +; CHECK-NOT: fpext +; CHECK-NOT: sqrt( +; CHECK: sqrtf( +; CHECK-NOT: fptrunc + %conv = fpext float %x to double ; <double> [#uses=1] + %call = tail call double @sqrt(double %conv) readnone nounwind ; <double> [#uses=1] + %conv1 = fptrunc double %call to float ; <float> [#uses=1] +; CHECK: ret float + ret float %conv1 +} + +declare double @sqrt(double) + +; PR8096 +define float @test2(float %x) nounwind readnone ssp { +entry: +; CHECK: @test2 +; CHECK-NOT: fpext +; CHECK-NOT: sqrt( +; CHECK: sqrtf( +; CHECK-NOT: fptrunc + %conv = fpext float %x to double ; <double> [#uses=1] + %call = tail call double @sqrt(double %conv) nounwind ; <double> [#uses=1] + %conv1 = fptrunc double %call to float ; <float> [#uses=1] +; CHECK: ret float + ret float %conv1 +} diff --git a/test/Transforms/InstCombine/urem-simplify-bug.ll b/test/Transforms/InstCombine/urem-simplify-bug.ll index 7c2b4b0..229f1a8 100644 --- a/test/Transforms/InstCombine/urem-simplify-bug.ll +++ b/test/Transforms/InstCombine/urem-simplify-bug.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -instcombine -S | grep {= or i32 %x, -5 } +; RUN: opt < %s -instcombine -S | grep {= or i32 %x, -5} @.str = internal constant [5 x i8] c"foo\0A\00" ; <[5 x i8]*> [#uses=1] @.str1 = internal constant [5 x i8] c"bar\0A\00" ; <[5 x i8]*> [#uses=1] diff --git a/test/Transforms/InstCombine/vec_shuffle.ll b/test/Transforms/InstCombine/vec_shuffle.ll index 5132a8f..bd36e9e 100644 --- a/test/Transforms/InstCombine/vec_shuffle.ll +++ b/test/Transforms/InstCombine/vec_shuffle.ll @@ -87,3 +87,26 @@ define <4 x i8> @test9(<16 x i8> %tmp6) nounwind { %tmp9 = shufflevector <4 x i8> %tmp7, <4 x i8> undef, <4 x i32> < i32 3, i32 1, i32 2, i32 0 > ; <<4 x i8>> [#uses=1] ret <4 x i8> %tmp9 } + +; Same as test9, but make sure that "undef" mask values are not confused with +; mask values of 2*N, where N is the mask length. These shuffles should not +; be folded (because [8,9,4,8] may not be a mask supported by the target). +define <4 x i8> @test9a(<16 x i8> %tmp6) nounwind { +; CHECK: @test9a +; CHECK-NEXT: shufflevector +; CHECK-NEXT: shufflevector +; CHECK-NEXT: ret + %tmp7 = shufflevector <16 x i8> %tmp6, <16 x i8> undef, <4 x i32> < i32 undef, i32 9, i32 4, i32 8 > ; <<4 x i8>> [#uses=1] + %tmp9 = shufflevector <4 x i8> %tmp7, <4 x i8> undef, <4 x i32> < i32 3, i32 1, i32 2, i32 0 > ; <<4 x i8>> [#uses=1] + ret <4 x i8> %tmp9 +} + +; Redundant vector splats should be removed. Radar 8597790. +define <4 x i32> @test10(<4 x i32> %tmp5) nounwind { +; CHECK: @test10 +; CHECK-NEXT: shufflevector +; CHECK-NEXT: ret + %tmp6 = shufflevector <4 x i32> %tmp5, <4 x i32> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef> + %tmp7 = shufflevector <4 x i32> %tmp6, <4 x i32> undef, <4 x i32> zeroinitializer + ret <4 x i32> %tmp7 +} diff --git a/test/Transforms/InstCombine/xor2.ll b/test/Transforms/InstCombine/xor2.ll index 67f05ef..89f00bd 100644 --- a/test/Transforms/InstCombine/xor2.ll +++ b/test/Transforms/InstCombine/xor2.ll @@ -34,7 +34,7 @@ define i32 @test2(i32 %tmp1) { define i32 @test3(i32 %tmp1) { ; CHECK: @test3 ; CHECK-NEXT: and i32 %tmp1, 32 -; CHECK-NEXT: or i32 %tmp, 8 +; CHECK-NEXT: or i32 %ovm, 8 ; CHECK-NEXT: ret i32 %ovm = or i32 %tmp1, 145 %ov31 = and i32 %ovm, 177 diff --git a/test/Transforms/JumpThreading/2010-08-26-and.ll b/test/Transforms/JumpThreading/2010-08-26-and.ll index 17a0aba..2d6caf7 100644 --- a/test/Transforms/JumpThreading/2010-08-26-and.ll +++ b/test/Transforms/JumpThreading/2010-08-26-and.ll @@ -1,4 +1,4 @@ -; RUN: opt -jump-threading -enable-jump-threading-lvi -S < %s | FileCheck %s +; RUN: opt -jump-threading -S < %s | FileCheck %s 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-n8:16:32:64" target triple = "x86_64-apple-darwin10.0.0" diff --git a/test/Transforms/JumpThreading/basic.ll b/test/Transforms/JumpThreading/basic.ll index ab1ab73..4627137 100644 --- a/test/Transforms/JumpThreading/basic.ll +++ b/test/Transforms/JumpThreading/basic.ll @@ -1,4 +1,4 @@ -; RUN: opt %s -jump-threading -S -enable-jump-threading-lvi | FileCheck %s +; RUN: opt %s -jump-threading -S | FileCheck %s declare i32 @f1() declare i32 @f2() @@ -421,4 +421,58 @@ F2: ; CHECK-NEXT: br i1 %N, label %T2, label %F2 } +; CHECK: @test14 +define i32 @test14(i32 %in) { +entry: + %A = icmp eq i32 %in, 0 +; CHECK: br i1 %A, label %right_ret, label %merge + br i1 %A, label %left, label %right + +; CHECK-NOT: left: +left: + br label %merge + +; CHECK-NOT: right: +right: + %B = call i32 @f1() + br label %merge + +merge: +; CHECK-NOT: %C = phi i32 [%in, %left], [%B, %right] + %C = phi i32 [%in, %left], [%B, %right] + %D = add i32 %C, 1 + %E = icmp eq i32 %D, 2 + br i1 %E, label %left_ret, label %right_ret + +; CHECK: left_ret: +left_ret: + ret i32 0 + +right_ret: + ret i32 1 +} + +; PR5652 +; CHECK: @test15 +define i32 @test15(i32 %len) { +entry: +; CHECK: icmp ult i32 %len, 13 + %tmp = icmp ult i32 %len, 13 + br i1 %tmp, label %check, label %exit0 + +exit0: + ret i32 0 + +check: + %tmp9 = icmp ult i32 %len, 21 + br i1 %tmp9, label %exit1, label %exit2 + +exit2: +; CHECK-NOT: ret i32 2 + ret i32 2 + +exit1: + ret i32 1 +; CHECK: } +} diff --git a/test/Transforms/JumpThreading/crash.ll b/test/Transforms/JumpThreading/crash.ll index cfd9042..aed51a1 100644 --- a/test/Transforms/JumpThreading/crash.ll +++ b/test/Transforms/JumpThreading/crash.ll @@ -461,3 +461,53 @@ if.end: ret void } +define void @test17() { +entry: + br i1 undef, label %bb269.us.us, label %bb269.us.us.us + +bb269.us.us.us: + %indvar = phi i64 [ %indvar.next, %bb287.us.us.us ], [ 0, %entry ] + %0 = icmp eq i16 undef, 0 + br i1 %0, label %bb287.us.us.us, label %bb286.us.us.us + +bb287.us.us.us: + %indvar.next = add i64 %indvar, 1 + %exitcond = icmp eq i64 %indvar.next, 4 + br i1 %exitcond, label %bb288.bb289.loopexit_crit_edge, label %bb269.us.us.us + +bb286.us.us.us: + unreachable + +bb269.us.us: + unreachable + +bb288.bb289.loopexit_crit_edge: + unreachable +} + +; PR 8247 +%struct.S1 = type { i8, i8 } +@func_89.l_245 = internal constant %struct.S1 { i8 33, i8 6 }, align 1 +define void @func_89(i16 zeroext %p_90, %struct.S1* nocapture %p_91, i32* nocapture %p_92) nounwind ssp { +entry: + store i32 0, i32* %p_92, align 4 + br i1 false, label %lbl_260, label %if.else + +if.else: ; preds = %entry + br label %for.cond + +for.cond: ; preds = %lbl_260, %if.else + %l_245.0 = phi i16 [ %l_245.1, %lbl_260 ], [ 33, %if.else ] + %l_261.0 = phi i32 [ %and, %lbl_260 ], [ 255, %if.else ] + %tobool21 = icmp ult i16 %l_245.0, 256 + br i1 %tobool21, label %if.end, label %lbl_260 + +lbl_260: ; preds = %for.cond, %entry + %l_245.1 = phi i16 [ 1569, %entry ], [ %l_245.0, %for.cond ] + %l_261.1 = phi i32 [ 255, %entry ], [ %l_261.0, %for.cond ] + %and = and i32 %l_261.1, 1 + br label %for.cond + +if.end: ; preds = %for.cond + ret void +} diff --git a/test/Transforms/JumpThreading/lvi-load.ll b/test/Transforms/JumpThreading/lvi-load.ll index 0bf4187..2a4cf92 100644 --- a/test/Transforms/JumpThreading/lvi-load.ll +++ b/test/Transforms/JumpThreading/lvi-load.ll @@ -1,4 +1,4 @@ -; RUN: opt -S -jump-threading -enable-jump-threading-lvi -dce < %s | FileCheck %s +; RUN: opt -S -jump-threading -dce < %s | FileCheck %s 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-n8:16:32:64" target triple = "x86_64-apple-darwin10.4" diff --git a/test/Transforms/LICM/2008-07-22-LoadGlobalConstant.ll b/test/Transforms/LICM/2008-07-22-LoadGlobalConstant.ll index 10b00ba..d4df26e 100644 --- a/test/Transforms/LICM/2008-07-22-LoadGlobalConstant.ll +++ b/test/Transforms/LICM/2008-07-22-LoadGlobalConstant.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -licm -S | FileCheck %s +; RUN: opt < %s -basicaa -licm -S | FileCheck %s @a = external constant float* diff --git a/test/Transforms/LICM/2009-03-25-AliasSetTracker.ll b/test/Transforms/LICM/2009-03-25-AliasSetTracker.ll deleted file mode 100644 index d1fe48c..0000000 --- a/test/Transforms/LICM/2009-03-25-AliasSetTracker.ll +++ /dev/null @@ -1,39 +0,0 @@ - -; RUN: opt < %s -licm -loop-index-split -instcombine -disable-output - - %struct.FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct.FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i32, i32, [40 x i8] } - %struct._IO_marker = type { %struct._IO_marker*, %struct.FILE*, i32 } -@"\01LC81" = external constant [4 x i8] ; <[4 x i8]*> [#uses=1] - -define fastcc void @hex_dump_internal(i8* %avcl, %struct.FILE* %f, i32 %level, i8* nocapture %buf, i32 %size) nounwind { -entry: - br i1 false, label %bb4, label %return - -bb4: ; preds = %bb30, %entry - br label %bb6 - -bb6: ; preds = %bb15, %bb4 - %j.0.reg2mem.0 = phi i32 [ %2, %bb15 ], [ 0, %bb4 ] ; <i32> [#uses=2] - %0 = icmp slt i32 %j.0.reg2mem.0, 0 ; <i1> [#uses=1] - br i1 %0, label %bb7, label %bb13 - -bb7: ; preds = %bb6 - br label %bb15 - -bb13: ; preds = %bb6 - %1 = tail call i32 @fwrite(i8* getelementptr ([4 x i8]* @"\01LC81", i32 0, i32 0), i32 1, i32 3, i8* null) nounwind ; <i32> [#uses=0] - br label %bb15 - -bb15: ; preds = %bb13, %bb7 - %2 = add i32 %j.0.reg2mem.0, 1 ; <i32> [#uses=2] - %3 = icmp sgt i32 %2, 15 ; <i1> [#uses=1] - br i1 %3, label %bb30, label %bb6 - -bb30: ; preds = %bb15 - br i1 false, label %bb4, label %return - -return: ; preds = %bb30, %entry - ret void -} - -declare i32 @fwrite(i8* nocapture, i32, i32, i8* nocapture) nounwind diff --git a/test/Transforms/LICM/crash.ll b/test/Transforms/LICM/crash.ll new file mode 100644 index 0000000..88be5c4 --- /dev/null +++ b/test/Transforms/LICM/crash.ll @@ -0,0 +1,61 @@ +; RUN: opt -licm %s -disable-output + +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-n8:16:32:64" +target triple = "x86_64-apple-darwin10.0.0" + + +; PR8068 +@g_12 = external global i8, align 1 +define void @test1() nounwind ssp { +entry: + br label %for.body + +for.body: ; preds = %for.cond, %bb.nph + store i8 0, i8* @g_12, align 1 + %tmp6 = load i8* @g_12, align 1 + br label %for.cond + +for.cond: ; preds = %for.body + store i8 %tmp6, i8* @g_12, align 1 + br i1 false, label %for.cond.for.end10_crit_edge, label %for.body + +for.cond.for.end10_crit_edge: ; preds = %for.cond + br label %for.end10 + +for.end10: ; preds = %for.cond.for.end10_crit_edge, %entry + ret void +} + +; PR8067 +@g_8 = external global i32, align 4 + +define void @test2() noreturn nounwind ssp { +entry: + br label %for.body + +for.body: ; preds = %for.body, %entry + %tmp7 = load i32* @g_8, align 4 + store i32* @g_8, i32** undef, align 16 + store i32 undef, i32* @g_8, align 4 + br label %for.body +} + +; PR8102 +define void @test3() { +entry: + %__first = alloca { i32* } + br i1 undef, label %for.cond, label %for.end + +for.cond: ; preds = %for.cond, %entry + %tmp1 = getelementptr { i32*}* %__first, i32 0, i32 0 + %tmp2 = load i32** %tmp1, align 4 + %call = tail call i32* @test3helper(i32* %tmp2) + %tmp3 = getelementptr { i32*}* %__first, i32 0, i32 0 + store i32* %call, i32** %tmp3, align 4 + br i1 false, label %for.cond, label %for.end + +for.end: ; preds = %for.cond, %entry + ret void +} + +declare i32* @test3helper(i32*) diff --git a/test/Transforms/LICM/hoisting.ll b/test/Transforms/LICM/hoisting.ll index e7d36af..6f28d53 100644 --- a/test/Transforms/LICM/hoisting.ll +++ b/test/Transforms/LICM/hoisting.ll @@ -48,3 +48,19 @@ Out: ; preds = %Loop %C = sub i32 %A, %B ; <i32> [#uses=1] ret i32 %C } + + +; This loop invariant instruction should be constant folded, not hoisted. +define i32 @test3(i1 %c) { +; CHECK: define i32 @test3 +; CHECK: call void @foo2(i32 6) + %A = load i32* @X ; <i32> [#uses=2] + br label %Loop +Loop: + %B = add i32 4, 2 ; <i32> [#uses=2] + call void @foo2( i32 %B ) + br i1 %c, label %Loop, label %Out +Out: ; preds = %Loop + %C = sub i32 %A, %B ; <i32> [#uses=1] + ret i32 %C +} diff --git a/test/Transforms/LICM/scalar_promote.ll b/test/Transforms/LICM/scalar_promote.ll index ef28c38..67ad5bc 100644 --- a/test/Transforms/LICM/scalar_promote.ll +++ b/test/Transforms/LICM/scalar_promote.ll @@ -1,4 +1,6 @@ -; RUN: opt < %s -licm -S | FileCheck %s +; RUN: opt < %s -basicaa -licm -S | FileCheck %s +target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" + @X = global i32 7 ; <i32*> [#uses=4] define void @test1(i32 %i) { @@ -32,23 +34,21 @@ Entry: br label %Loop ; CHECK: @test2 ; CHECK: Entry: -; CHECK-NEXT: %X1 = getelementptr i32* @X, i64 0 -; CHECK-NEXT: %X2 = getelementptr i32* @X, i64 0 -; CHECK-NEXT: %X1.promoted = load i32* %X1 +; CHECK-NEXT: %.promoted = load i32* getelementptr inbounds (i32* @X, i64 1) ; CHECK-NEXT: br label %Loop Loop: ; preds = %Loop, %0 - %X1 = getelementptr i32* @X, i64 0 ; <i32*> [#uses=1] + %X1 = getelementptr i32* @X, i64 1 ; <i32*> [#uses=1] %A = load i32* %X1 ; <i32> [#uses=1] %V = add i32 %A, 1 ; <i32> [#uses=1] - %X2 = getelementptr i32* @X, i64 0 ; <i32*> [#uses=1] + %X2 = getelementptr i32* @X, i64 1 ; <i32*> [#uses=1] store i32 %V, i32* %X2 br i1 false, label %Loop, label %Exit Exit: ; preds = %Loop ret void ; CHECK: Exit: -; CHECK-NEXT: store i32 %V, i32* %X1 +; CHECK-NEXT: store i32 %V, i32* getelementptr inbounds (i32* @X, i64 1) ; CHECK-NEXT: ret void } @@ -71,3 +71,50 @@ Out: ; preds = %Loop ret void } +; PR8041 +define void @test4(i8* %x, i8 %n) { +; CHECK: @test4 + %handle1 = alloca i8* + %handle2 = alloca i8* + store i8* %x, i8** %handle1 + br label %loop + +loop: + %tmp = getelementptr i8* %x, i64 8 + store i8* %tmp, i8** %handle2 + br label %subloop + +subloop: + %count = phi i8 [ 0, %loop ], [ %nextcount, %subloop ] + %offsetx2 = load i8** %handle2 + store i8 %n, i8* %offsetx2 + %newoffsetx2 = getelementptr i8* %offsetx2, i64 -1 + store i8* %newoffsetx2, i8** %handle2 + %nextcount = add i8 %count, 1 + %innerexitcond = icmp sge i8 %nextcount, 8 + br i1 %innerexitcond, label %innerexit, label %subloop + +; Should have promoted 'handle2' accesses. +; CHECK: subloop: +; CHECK-NEXT: phi i8* [ +; CHECK-NEXT: %count = phi i8 [ +; CHECK-NEXT: store i8 %n +; CHECK-NOT: store +; CHECK: br i1 + +innerexit: + %offsetx1 = load i8** %handle1 + %val = load i8* %offsetx1 + %cond = icmp eq i8 %val, %n + br i1 %cond, label %exit, label %loop + +; Should not have promoted offsetx1 loads. +; CHECK: innerexit: +; CHECK: %val = load i8* %offsetx1 +; CHECK: %cond = icmp eq i8 %val, %n +; CHECK: br i1 %cond, label %exit, label %loop + +exit: + ret void +} + diff --git a/test/Transforms/LICM/sinking.ll b/test/Transforms/LICM/sinking.ll index 11112eb..68e4b64 100644 --- a/test/Transforms/LICM/sinking.ll +++ b/test/Transforms/LICM/sinking.ll @@ -233,3 +233,17 @@ Out: ; preds = %Loop ; CHECK-NEXT: ret i32 %tmp.6 } +; Should delete, not sink, dead instructions. +define void @test11() { + br label %Loop +Loop: + %dead = getelementptr %Ty* @X2, i64 0, i32 0 + br i1 false, label %Loop, label %Out +Out: + ret void +; CHECK: @test11 +; CHECK: Out: +; CHECK-NEXT: ret void +} + + diff --git a/test/Transforms/LoopIndexSplit/2007-09-21-LoopBound.ll b/test/Transforms/LoopIndexSplit/2007-09-21-LoopBound.ll deleted file mode 100644 index d922ecb..0000000 --- a/test/Transforms/LoopIndexSplit/2007-09-21-LoopBound.ll +++ /dev/null @@ -1,63 +0,0 @@ -; PR1692 -; RUN: opt < %s -loop-index-split -disable-output - %struct.CLAUSE_HELP = type { i32, i32, i32, i32, i32*, i32, %struct.LIST_NODE*, %struct.LIST_NODE*, i32, i32, %struct.LITERAL_HELP**, i32, i32, i32, i32 } - %struct.LIST_NODE = type { %struct.LIST_NODE*, i8* } - %struct.LITERAL_HELP = type { i32, i32, i32, %struct.CLAUSE_HELP*, %struct.term* } - %struct.anon = type { %struct.LIST_NODE* } - %struct.st = type { %struct.subst*, %struct.LIST_NODE*, %struct.LIST_NODE*, i16, i16 } - %struct.subst = type { %struct.subst*, i32, %struct.term* } - %struct.term = type { i32, %struct.anon, %struct.LIST_NODE*, i32, i32 } - -define %struct.LIST_NODE* @inf_HyperResolvents(%struct.CLAUSE_HELP* %Clause, %struct.subst* %Subst, %struct.LIST_NODE* %Restlits, i32 %GlobalMaxVar, %struct.LIST_NODE* %FoundMap, i32 %StrictlyMaximal, { %struct.st*, [3001 x %struct.term*], [4000 x %struct.term*], i32 }* %Index, i32* %Flags, i32* %Precedence) { -entry: - br i1 false, label %cond_next44, label %bb37 - -bb37: ; preds = %entry - ret %struct.LIST_NODE* null - -cond_next44: ; preds = %entry - br i1 false, label %bb29.i, label %bb.i31 - -bb.i31: ; preds = %cond_next44 - ret %struct.LIST_NODE* null - -bb29.i: ; preds = %cond_next44 - br i1 false, label %cond_next89.i, label %bb34.i - -bb34.i: ; preds = %bb29.i - ret %struct.LIST_NODE* null - -cond_next89.i: ; preds = %bb29.i - br i1 false, label %clause_LiteralGetIndex.exit70.i, label %bb.i59.i - -bb.i59.i: ; preds = %cond_next89.i - ret %struct.LIST_NODE* null - -clause_LiteralGetIndex.exit70.i: ; preds = %cond_next89.i - br label %bb3.i.i - -bb3.i.i: ; preds = %bb3.i.i, %clause_LiteralGetIndex.exit70.i - br i1 false, label %bb40.i.i, label %bb3.i.i - -subst_Apply.exit.i.i: ; preds = %bb40.i.i - %tmp21.i.i = icmp sgt i32 %j.0.i.i, 0 ; <i1> [#uses=1] - br i1 %tmp21.i.i, label %cond_false.i47.i, label %cond_true24.i.i - -cond_true24.i.i: ; preds = %subst_Apply.exit.i.i - br label %cond_next37.i.i - -cond_false.i47.i: ; preds = %subst_Apply.exit.i.i - br label %cond_next37.i.i - -cond_next37.i.i: ; preds = %cond_false.i47.i, %cond_true24.i.i - %tmp39.i.i = add i32 %j.0.i.i, 1 ; <i32> [#uses=1] - br label %bb40.i.i - -bb40.i.i: ; preds = %cond_next37.i.i, %bb3.i.i - %j.0.i.i = phi i32 [ %tmp39.i.i, %cond_next37.i.i ], [ 0, %bb3.i.i ] ; <i32> [#uses=3] - %tmp43.i.i = icmp sgt i32 %j.0.i.i, 0 ; <i1> [#uses=1] - br i1 %tmp43.i.i, label %inf_CopyHyperElectron.exit.i, label %subst_Apply.exit.i.i - -inf_CopyHyperElectron.exit.i: ; preds = %bb40.i.i - ret %struct.LIST_NODE* null -} diff --git a/test/Transforms/LoopIndexSplit/2007-09-24-UpdateIterationSpace.ll b/test/Transforms/LoopIndexSplit/2007-09-24-UpdateIterationSpace.ll deleted file mode 100644 index 3ebd9b3..0000000 --- a/test/Transforms/LoopIndexSplit/2007-09-24-UpdateIterationSpace.ll +++ /dev/null @@ -1,57 +0,0 @@ - -; Update loop iteraton space to eliminate condition inside loop. -; RUN: opt < %s -loop-index-split -S | not grep bothcond -define void @test(float* %x, i32 %ndat, float** %y, float %xcen, i32 %xmin, i32 %xmax, float %sigmal, float %contribution) { -entry: - %tmp519 = icmp sgt i32 %xmin, %xmax ; <i1> [#uses=1] - br i1 %tmp519, label %return, label %bb.preheader - -bb.preheader: ; preds = %entry - %tmp3031 = fpext float %contribution to double ; <double> [#uses=1] - %tmp32 = fmul double %tmp3031, 5.000000e-01 ; <double> [#uses=1] - %tmp3839 = fpext float %sigmal to double ; <double> [#uses=1] - br label %bb - -bb: ; preds = %bb.preheader, %cond_next45 - %i.01.0 = phi i32 [ %tmp47, %cond_next45 ], [ 0, %bb.preheader ] ; <i32> [#uses=6] - %tmp2 = icmp sgt i32 %i.01.0, -1 ; <i1> [#uses=1] - %tmp6 = icmp slt i32 %i.01.0, %ndat ; <i1> [#uses=1] - %bothcond = and i1 %tmp2, %tmp6 ; <i1> [#uses=1] - br i1 %bothcond, label %cond_true9, label %cond_next45 - -cond_true9: ; preds = %bb - %tmp12 = getelementptr float* %x, i32 %i.01.0 ; <float*> [#uses=1] - %tmp13 = load float* %tmp12, align 4 ; <float> [#uses=1] - %tmp15 = fsub float %xcen, %tmp13 ; <float> [#uses=1] - %tmp16 = tail call float @fabsf( float %tmp15 ) ; <float> [#uses=1] - %tmp18 = fdiv float %tmp16, %sigmal ; <float> [#uses=1] - %tmp21 = load float** %y, align 4 ; <float*> [#uses=2] - %tmp27 = getelementptr float* %tmp21, i32 %i.01.0 ; <float*> [#uses=1] - %tmp28 = load float* %tmp27, align 4 ; <float> [#uses=1] - %tmp2829 = fpext float %tmp28 to double ; <double> [#uses=1] - %tmp34 = fsub float -0.000000e+00, %tmp18 ; <float> [#uses=1] - %tmp3435 = fpext float %tmp34 to double ; <double> [#uses=1] - %tmp36 = tail call double @exp( double %tmp3435 ) ; <double> [#uses=1] - %tmp37 = fmul double %tmp32, %tmp36 ; <double> [#uses=1] - %tmp40 = fdiv double %tmp37, %tmp3839 ; <double> [#uses=1] - %tmp41 = fadd double %tmp2829, %tmp40 ; <double> [#uses=1] - %tmp4142 = fptrunc double %tmp41 to float ; <float> [#uses=1] - %tmp44 = getelementptr float* %tmp21, i32 %i.01.0 ; <float*> [#uses=1] - store float %tmp4142, float* %tmp44, align 4 - br label %cond_next45 - -cond_next45: ; preds = %bb, %cond_true9 - %tmp47 = add i32 %i.01.0, 1 ; <i32> [#uses=2] - %tmp51 = icmp sgt i32 %tmp47, %xmax ; <i1> [#uses=1] - br i1 %tmp51, label %return.loopexit, label %bb - -return.loopexit: ; preds = %cond_next45 - br label %return - -return: ; preds = %return.loopexit, %entry - ret void -} - -declare float @fabsf(float) - -declare double @exp(double) diff --git a/test/Transforms/LoopIndexSplit/2007-09-25-UpdateIterationSpace-2.ll b/test/Transforms/LoopIndexSplit/2007-09-25-UpdateIterationSpace-2.ll deleted file mode 100644 index 8f4ee24..0000000 --- a/test/Transforms/LoopIndexSplit/2007-09-25-UpdateIterationSpace-2.ll +++ /dev/null @@ -1,60 +0,0 @@ -; PR714 -; Update loop iteraton space to eliminate condition inside loop. -; RUN: opt < %s -loop-index-split -S | not grep bothcond - -define void @test(float* %x, i32 %ndat, float** %y, float %xcen, i32 %xmin, i32 %xmax, float %sigmal, float %contribution) { -entry: - %tmp5310 = icmp sgt i32 %xmin, %xmax ; <i1> [#uses=1] - br i1 %tmp5310, label %return, label %bb.preheader - -bb.preheader: ; preds = %entry - %tmp3031 = fpext float %contribution to double ; <double> [#uses=1] - %tmp32 = fmul double %tmp3031, 5.000000e-01 ; <double> [#uses=1] - %tmp3839 = fpext float %sigmal to double ; <double> [#uses=1] - br label %bb - -bb: ; preds = %cond_next45, %bb.preheader - %k.06.0 = phi i32 [ 0, %bb.preheader ], [ %indvar.next, %cond_next45 ] ; <i32> [#uses=4] - %i.01.0 = add i32 %k.06.0, %xmin ; <i32> [#uses=4] - %tmp2 = icmp sgt i32 %i.01.0, -1 ; <i1> [#uses=1] - %tmp6 = icmp slt i32 %i.01.0, %ndat ; <i1> [#uses=1] - %bothcond = and i1 %tmp2, %tmp6 ; <i1> [#uses=1] - br i1 %bothcond, label %cond_true9, label %cond_next45 - -cond_true9: ; preds = %bb - %tmp12 = getelementptr float* %x, i32 %i.01.0 ; <float*> [#uses=1] - %tmp13 = load float* %tmp12, align 4 ; <float> [#uses=1] - %tmp15 = fsub float %xcen, %tmp13 ; <float> [#uses=1] - %tmp16 = tail call float @fabsf(float %tmp15) ; <float> [#uses=1] - %tmp18 = fdiv float %tmp16, %sigmal ; <float> [#uses=1] - %tmp21 = load float** %y, align 4 ; <float*> [#uses=2] - %tmp27 = getelementptr float* %tmp21, i32 %k.06.0 ; <float*> [#uses=1] - %tmp28 = load float* %tmp27, align 4 ; <float> [#uses=1] - %tmp2829 = fpext float %tmp28 to double ; <double> [#uses=1] - %tmp34 = fsub float -0.000000e+00, %tmp18 ; <float> [#uses=1] - %tmp3435 = fpext float %tmp34 to double ; <double> [#uses=1] - %tmp36 = tail call double @exp(double %tmp3435) ; <double> [#uses=1] - %tmp37 = fmul double %tmp32, %tmp36 ; <double> [#uses=1] - %tmp40 = fdiv double %tmp37, %tmp3839 ; <double> [#uses=1] - %tmp41 = fadd double %tmp2829, %tmp40 ; <double> [#uses=1] - %tmp4142 = fptrunc double %tmp41 to float ; <float> [#uses=1] - %tmp44 = getelementptr float* %tmp21, i32 %k.06.0 ; <float*> [#uses=1] - store float %tmp4142, float* %tmp44, align 4 - br label %cond_next45 - -cond_next45: ; preds = %cond_true9, %bb - %tmp47 = add i32 %i.01.0, 1 ; <i32> [#uses=1] - %tmp53 = icmp sgt i32 %tmp47, %xmax ; <i1> [#uses=1] - %indvar.next = add i32 %k.06.0, 1 ; <i32> [#uses=1] - br i1 %tmp53, label %return.loopexit, label %bb - -return.loopexit: ; preds = %cond_next45 - br label %return - -return: ; preds = %return.loopexit, %entry - ret void -} - -declare float @fabsf(float) - -declare double @exp(double) diff --git a/test/Transforms/LoopIndexSplit/2008-01-28-IndDecrement.ll b/test/Transforms/LoopIndexSplit/2008-01-28-IndDecrement.ll deleted file mode 100644 index 1550bc7..0000000 --- a/test/Transforms/LoopIndexSplit/2008-01-28-IndDecrement.ll +++ /dev/null @@ -1,46 +0,0 @@ -; RUN: opt < %s -loop-index-split -disable-output -stats |& \ -; RUN: not grep "loop-index-split" - -; Induction variable decrement is not yet handled. -; pr1912.bc -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-darwin9" - %struct.cset = type { i8*, i8, i8, i32, i8* } - %struct.parse = type { i8*, i8*, i32, i32*, i32, i32, i32, %struct.re_guts*, [10 x i32], [10 x i32] } - %struct.re_guts = type { i32, i32*, i32, i32, %struct.cset*, i8*, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i8*, i32, i32, i32, i32, [1 x i8] } - -define fastcc void @p_bracket(%struct.parse* %p) { -entry: - br i1 false, label %bb160, label %bb195 - -bb160: ; preds = %entry - br i1 false, label %bb.i169, label %bb9.i - -bb195: ; preds = %entry - ret void - -bb.i169: ; preds = %bb160 - br i1 false, label %bb372, label %bb565 - -bb9.i: ; preds = %bb160 - ret void - -bb372: ; preds = %bb418, %bb.i169 - %i1.0.reg2mem.0 = phi i32 [ %i1.0, %bb418 ], [ 0, %bb.i169 ] ; <i32> [#uses=2] - %tmp3.i.i.i170 = icmp ult i32 %i1.0.reg2mem.0, 128 ; <i1> [#uses=1] - br i1 %tmp3.i.i.i170, label %bb.i.i173, label %bb13.i.i - -bb.i.i173: ; preds = %bb372 - br label %bb418 - -bb13.i.i: ; preds = %bb372 - br label %bb418 - -bb418: ; preds = %bb13.i.i, %bb.i.i173 - %i1.0 = add i32 %i1.0.reg2mem.0, -1 ; <i32> [#uses=2] - %tmp420 = icmp sgt i32 %i1.0, -1 ; <i1> [#uses=1] - br i1 %tmp420, label %bb372, label %bb565 - -bb565: ; preds = %bb418, %bb.i169 - ret void -} diff --git a/test/Transforms/LoopIndexSplit/2008-02-08-Crash.ll b/test/Transforms/LoopIndexSplit/2008-02-08-Crash.ll deleted file mode 100644 index 3cfd6c9..0000000 --- a/test/Transforms/LoopIndexSplit/2008-02-08-Crash.ll +++ /dev/null @@ -1,48 +0,0 @@ -; RUN: opt < %s -loop-index-split -disable-output -; PR 1995 - -define void @add_blkdev_randomness(i32 %major) nounwind { -entry: - br label %bb - -bb: ; preds = %bb39, %entry - %A.0.reg2mem.0 = phi i32 [ undef, %entry ], [ %TEMP.0, %bb39 ] ; <i32> [#uses=1] - %D.0.reg2mem.0 = phi i32 [ undef, %entry ], [ %C.0.reg2mem.0, %bb39 ] ; <i32> [#uses=3] - %C.0.reg2mem.0 = phi i32 [ undef, %entry ], [ %tmp34, %bb39 ] ; <i32> [#uses=4] - %TEMP.1.reg2mem.0 = phi i32 [ undef, %entry ], [ %TEMP.0, %bb39 ] ; <i32> [#uses=1] - %i.0.reg2mem.0 = phi i32 [ 0, %entry ], [ %tmp38, %bb39 ] ; <i32> [#uses=3] - %B.0.reg2mem.0 = phi i32 [ undef, %entry ], [ %A.0.reg2mem.0, %bb39 ] ; <i32> [#uses=5] - %tmp1 = icmp slt i32 %i.0.reg2mem.0, 40 ; <i1> [#uses=1] - br i1 %tmp1, label %bb3, label %bb12 - -bb3: ; preds = %bb - %tmp6 = xor i32 %C.0.reg2mem.0, %D.0.reg2mem.0 ; <i32> [#uses=1] - %tmp8 = and i32 %B.0.reg2mem.0, %tmp6 ; <i32> [#uses=1] - %tmp10 = xor i32 %tmp8, %D.0.reg2mem.0 ; <i32> [#uses=1] - %tmp11 = add i32 %tmp10, 1518500249 ; <i32> [#uses=1] - br label %bb39 - -bb12: ; preds = %bb - %tmp14 = icmp slt i32 %i.0.reg2mem.0, 60 ; <i1> [#uses=1] - br i1 %tmp14, label %bb17, label %bb39 - -bb17: ; preds = %bb12 - %tmp20 = and i32 %B.0.reg2mem.0, %C.0.reg2mem.0 ; <i32> [#uses=1] - %tmp23 = xor i32 %B.0.reg2mem.0, %C.0.reg2mem.0 ; <i32> [#uses=1] - %tmp25 = and i32 %tmp23, %D.0.reg2mem.0 ; <i32> [#uses=1] - %tmp26 = add i32 %tmp20, -1894007588 ; <i32> [#uses=1] - %tmp27 = add i32 %tmp26, %tmp25 ; <i32> [#uses=1] - br label %bb39 - -bb39: ; preds = %bb12, %bb3, %bb17 - %TEMP.0 = phi i32 [ %tmp27, %bb17 ], [ %tmp11, %bb3 ], [ %TEMP.1.reg2mem.0, %bb12 ] ; <i32> [#uses=2] - %tmp31 = lshr i32 %B.0.reg2mem.0, 2 ; <i32> [#uses=1] - %tmp33 = shl i32 %B.0.reg2mem.0, 30 ; <i32> [#uses=1] - %tmp34 = or i32 %tmp31, %tmp33 ; <i32> [#uses=1] - %tmp38 = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=2] - %tmp41 = icmp slt i32 %tmp38, 80 ; <i1> [#uses=1] - br i1 %tmp41, label %bb, label %return - -return: ; preds = %bb39 - ret void -} diff --git a/test/Transforms/LoopIndexSplit/2008-02-13-ExitValueNum.ll b/test/Transforms/LoopIndexSplit/2008-02-13-ExitValueNum.ll deleted file mode 100644 index 980a42f..0000000 --- a/test/Transforms/LoopIndexSplit/2008-02-13-ExitValueNum.ll +++ /dev/null @@ -1,67 +0,0 @@ -; RUN: opt < %s -disable-output -loop-index-split -; PR 2011 - %struct.CLAUSE_HELP = type { i32, i32, i32, i32, i32*, i32, %struct.LIST_NODE*, %struct.LIST_NODE*, i32, i32, %struct.LITERAL_HELP**, i32, i32, i32, i32 } - %struct.LIST_NODE = type { %struct.LIST_NODE*, i8* } - %struct.LITERAL_HELP = type { i32, i32, i32, %struct.CLAUSE_HELP*, %struct.term* } - %struct.anon = type { %struct.LIST_NODE* } - %struct.st = type { %struct.subst*, %struct.LIST_NODE*, %struct.LIST_NODE*, i16, i16 } - %struct.subst = type { %struct.subst*, i32, %struct.term* } - %struct.term = type { i32, %struct.anon, %struct.LIST_NODE*, i32, i32 } - -define fastcc %struct.LIST_NODE* @inf_HyperResolvents(%struct.CLAUSE_HELP* %Clause, %struct.subst* %Subst, %struct.LIST_NODE* %Restlits, i32 %GlobalMaxVar, %struct.LIST_NODE* %FoundMap, i32 %StrictlyMaximal, { %struct.st*, [3001 x %struct.term*], [4000 x %struct.term*], i32 }* %Index, i32* %Flags, i32* %Precedence) nounwind { -entry: - br i1 false, label %bb960, label %bb885 - -bb885: ; preds = %entry - ret %struct.LIST_NODE* null - -bb960: ; preds = %entry - br i1 false, label %bb1097, label %bb1005.preheader - -bb1005.preheader: ; preds = %bb960 - ret %struct.LIST_NODE* null - -bb1097: ; preds = %bb960 - br i1 false, label %bb1269.preheader, label %bb1141.preheader - -bb1141.preheader: ; preds = %bb1097 - ret %struct.LIST_NODE* null - -bb1269.preheader: ; preds = %bb1097 - br i1 false, label %bb1318, label %bb1281 - -bb1281: ; preds = %bb1269.preheader - ret %struct.LIST_NODE* null - -bb1318: ; preds = %bb1269.preheader - br i1 false, label %bb1459, label %bb.nph52 - -bb.nph52: ; preds = %bb1318 - ret %struct.LIST_NODE* null - -bb1459: ; preds = %bb1318 - br i1 false, label %bb1553, label %bb.nph62 - -bb.nph62: ; preds = %bb1459 - ret %struct.LIST_NODE* null - -bb1553: ; preds = %bb1669, %bb1459 - %j295.0.reg2mem.0 = phi i32 [ %storemerge110, %bb1669 ], [ 0, %bb1459 ] ; <i32> [#uses=2] - %tmp1629 = icmp sgt i32 %j295.0.reg2mem.0, 0 ; <i1> [#uses=1] - br i1 %tmp1629, label %bb1649, label %bb1632 - -bb1632: ; preds = %bb1553 - br label %bb1669 - -bb1649: ; preds = %bb1553 - br label %bb1669 - -bb1669: ; preds = %bb1649, %bb1632 - %storemerge110 = add i32 %j295.0.reg2mem.0, 1 ; <i32> [#uses=2] - %tmp1672 = icmp sgt i32 %storemerge110, 0 ; <i1> [#uses=1] - br i1 %tmp1672, label %bb1678, label %bb1553 - -bb1678: ; preds = %bb1669 - ret %struct.LIST_NODE* null -} - diff --git a/test/Transforms/LoopIndexSplit/2008-02-13-LoopLatch.ll b/test/Transforms/LoopIndexSplit/2008-02-13-LoopLatch.ll deleted file mode 100644 index 9351caf..0000000 --- a/test/Transforms/LoopIndexSplit/2008-02-13-LoopLatch.ll +++ /dev/null @@ -1,72 +0,0 @@ -; RUN: opt < %s -loop-index-split -disable-output -; PR 2011 - %struct.CLAUSE_HELP = type { i32, i32, i32, i32, i32*, i32, %struct.LIST_NODE*, %struct.LIST_NODE*, i32, i32, %struct.LITERAL_HELP**, i32, i32, i32, i32 } - %struct.LIST_NODE = type { %struct.LIST_NODE*, i8* } - %struct.LITERAL_HELP = type { i32, i32, i32, %struct.CLAUSE_HELP*, %struct.term* } - %struct.anon = type { %struct.LIST_NODE* } - %struct.st = type { %struct.subst*, %struct.LIST_NODE*, %struct.LIST_NODE*, i16, i16 } - %struct.subst = type { %struct.subst*, i32, %struct.term* } - %struct.term = type { i32, %struct.anon, %struct.LIST_NODE*, i32, i32 } - -define fastcc %struct.LIST_NODE* @inf_HyperResolvents(%struct.CLAUSE_HELP* %Clause, %struct.subst* %Subst, %struct.LIST_NODE* %Restlits, i32 %GlobalMaxVar, %struct.LIST_NODE* %FoundMap, i32 %StrictlyMaximal, { %struct.st*, [3001 x %struct.term*], [4000 x %struct.term*], i32 }* %Index, i32* %Flags, i32* %Precedence) nounwind { -entry: - br i1 false, label %bb960, label %bb885 - -bb885: ; preds = %entry - ret %struct.LIST_NODE* null - -bb960: ; preds = %entry - br i1 false, label %bb1097, label %bb1005.preheader - -bb1005.preheader: ; preds = %bb960 - ret %struct.LIST_NODE* null - -bb1097: ; preds = %bb960 - br i1 false, label %bb1269.preheader, label %bb1141.preheader - -bb1141.preheader: ; preds = %bb1097 - ret %struct.LIST_NODE* null - -bb1269.preheader: ; preds = %bb1097 - br i1 false, label %bb1318, label %bb1281 - -bb1281: ; preds = %bb1269.preheader - ret %struct.LIST_NODE* null - -bb1318: ; preds = %bb1269.preheader - br i1 false, label %bb1459, label %bb.nph52 - -bb.nph52: ; preds = %bb1318 - ret %struct.LIST_NODE* null - -bb1459: ; preds = %bb1318 - br i1 false, label %bb1553, label %bb.nph62 - -bb.nph62: ; preds = %bb1459 - ret %struct.LIST_NODE* null - -bb1553: ; preds = %bb1669, %bb1459 - %j295.0.reg2mem.0 = phi i32 [ %storemerge110, %bb1669 ], [ 0, %bb1459 ] ; <i32> [#uses=2] - br i1 false, label %bb1588, label %bb1616 - -bb1588: ; preds = %bb1553 - br label %bb1616 - -bb1616: ; preds = %bb1588, %bb1553 - %tmp1629 = icmp sgt i32 %j295.0.reg2mem.0, 0 ; <i1> [#uses=1] - br i1 %tmp1629, label %bb1649, label %bb1632 - -bb1632: ; preds = %bb1616 - br label %bb1669 - -bb1649: ; preds = %bb1616 - br label %bb1669 - -bb1669: ; preds = %bb1649, %bb1632 - %storemerge110 = add i32 %j295.0.reg2mem.0, 1 ; <i32> [#uses=2] - %tmp1672 = icmp sgt i32 %storemerge110, 0 ; <i1> [#uses=1] - br i1 %tmp1672, label %bb1678, label %bb1553 - -bb1678: ; preds = %bb1669 - ret %struct.LIST_NODE* null -} diff --git a/test/Transforms/LoopIndexSplit/2008-02-13-LoopLatchPHI.ll b/test/Transforms/LoopIndexSplit/2008-02-13-LoopLatchPHI.ll deleted file mode 100644 index 6d6defa..0000000 --- a/test/Transforms/LoopIndexSplit/2008-02-13-LoopLatchPHI.ll +++ /dev/null @@ -1,74 +0,0 @@ -; RUN: opt < %s -loop-index-split -disable-output -; PR 2011 - %struct.CLAUSE_HELP = type { i32, i32, i32, i32, i32*, i32, %struct.LIST_NODE*, %struct.LIST_NODE*, i32, i32, %struct.LITERAL_HELP**, i32, i32, i32, i32 } - %struct.LIST_NODE = type { %struct.LIST_NODE*, i8* } - %struct.LITERAL_HELP = type { i32, i32, i32, %struct.CLAUSE_HELP*, %struct.term* } - %struct.anon = type { %struct.LIST_NODE* } - %struct.st = type { %struct.subst*, %struct.LIST_NODE*, %struct.LIST_NODE*, i16, i16 } - %struct.subst = type { %struct.subst*, i32, %struct.term* } - %struct.term = type { i32, %struct.anon, %struct.LIST_NODE*, i32, i32 } - -define fastcc %struct.LIST_NODE* @inf_HyperResolvents(%struct.CLAUSE_HELP* %Clause, %struct.subst* %Subst, %struct.LIST_NODE* %Restlits, i32 %GlobalMaxVar, %struct.LIST_NODE* %FoundMap, i32 %StrictlyMaximal, { %struct.st*, [3001 x %struct.term*], [4000 x %struct.term*], i32 }* %Index, i32* %Flags, i32* %Precedence) nounwind { -entry: - br i1 false, label %bb960, label %bb885 - -bb885: ; preds = %entry - ret %struct.LIST_NODE* null - -bb960: ; preds = %entry - br i1 false, label %bb1097, label %bb1005.preheader - -bb1005.preheader: ; preds = %bb960 - ret %struct.LIST_NODE* null - -bb1097: ; preds = %bb960 - br i1 false, label %bb1269.preheader, label %bb1141.preheader - -bb1141.preheader: ; preds = %bb1097 - ret %struct.LIST_NODE* null - -bb1269.preheader: ; preds = %bb1097 - br i1 false, label %bb1318, label %bb1281 - -bb1281: ; preds = %bb1269.preheader - ret %struct.LIST_NODE* null - -bb1318: ; preds = %bb1269.preheader - br i1 false, label %bb1459, label %bb.nph52 - -bb.nph52: ; preds = %bb1318 - ret %struct.LIST_NODE* null - -bb1459: ; preds = %bb1318 - br i1 false, label %bb1553, label %bb.nph62 - -bb.nph62: ; preds = %bb1459 - ret %struct.LIST_NODE* null - -bb1553: ; preds = %bb1669, %bb1459 - %j295.0.reg2mem.0 = phi i32 [ %storemerge110, %bb1669 ], [ 0, %bb1459 ] ; <i32> [#uses=2] - %Constraint403.2.reg2mem.0 = phi %struct.LIST_NODE* [ %Constraint403.1.reg2mem.0, %bb1669 ], [ null, %bb1459 ] ; <%struct.LIST_NODE*> [#uses=1] - br i1 false, label %bb1588, label %bb1616 - -bb1588: ; preds = %bb1553 - br label %bb1616 - -bb1616: ; preds = %bb1588, %bb1553 - %tmp1629 = icmp sgt i32 %j295.0.reg2mem.0, 0 ; <i1> [#uses=1] - br i1 %tmp1629, label %bb1649, label %bb1632 - -bb1632: ; preds = %bb1616 - br label %bb1669 - -bb1649: ; preds = %bb1616 - br label %bb1669 - -bb1669: ; preds = %bb1649, %bb1632 - %Constraint403.1.reg2mem.0 = phi %struct.LIST_NODE* [ null, %bb1632 ], [ %Constraint403.2.reg2mem.0, %bb1649 ] ; <%struct.LIST_NODE*> [#uses=1] - %storemerge110 = add i32 %j295.0.reg2mem.0, 1 ; <i32> [#uses=2] - %tmp1672 = icmp sgt i32 %storemerge110, 0 ; <i1> [#uses=1] - br i1 %tmp1672, label %bb1678, label %bb1553 - -bb1678: ; preds = %bb1669 - ret %struct.LIST_NODE* null -} diff --git a/test/Transforms/LoopIndexSplit/2008-02-14-Crash.ll b/test/Transforms/LoopIndexSplit/2008-02-14-Crash.ll deleted file mode 100644 index f1a03e2..0000000 --- a/test/Transforms/LoopIndexSplit/2008-02-14-Crash.ll +++ /dev/null @@ -1,464 +0,0 @@ -; RUN: opt < %s -loop-index-split -disable-output -; PR 2030 - %struct.FULL = type { i32, i32, [1000 x float*] } - -define i32 @matgen(%struct.FULL* %a, float** %x, float** %b, float** %bt, i32** %ipvt, i32 %test_case, i32 %scale) { -entry: - br i1 false, label %bb, label %entry.bb30_crit_edge - -entry.bb30_crit_edge: ; preds = %entry - br label %bb30 - -bb: ; preds = %entry - br label %bb14 - -bb6: ; preds = %bb14 - br label %bb14 - -bb14: ; preds = %bb6, %bb - br i1 false, label %bb6, label %bb22 - -bb22: ; preds = %bb14 - br label %bb30 - -bb30: ; preds = %bb22, %entry.bb30_crit_edge - switch i32 %test_case, label %bb648 [ - i32 1, label %bb30.bb32_crit_edge - i32 2, label %bb30.bb32_crit_edge1 - i32 3, label %bb30.bb32_crit_edge2 - i32 4, label %bb30.bb108_crit_edge - i32 5, label %bb30.bb108_crit_edge3 - i32 6, label %bb30.bb142_crit_edge - i32 7, label %bb30.bb142_crit_edge4 - i32 8, label %bb30.bb142_crit_edge5 - i32 9, label %bb234 - i32 10, label %bb292 - i32 11, label %bb353 - i32 12, label %bb419 - i32 13, label %bb485 - i32 14, label %bb567 - ] - -bb30.bb142_crit_edge5: ; preds = %bb30 - br label %bb142 - -bb30.bb142_crit_edge4: ; preds = %bb30 - br label %bb142 - -bb30.bb142_crit_edge: ; preds = %bb30 - br label %bb142 - -bb30.bb108_crit_edge3: ; preds = %bb30 - br label %bb108 - -bb30.bb108_crit_edge: ; preds = %bb30 - br label %bb108 - -bb30.bb32_crit_edge2: ; preds = %bb30 - br label %bb32 - -bb30.bb32_crit_edge1: ; preds = %bb30 - br label %bb32 - -bb30.bb32_crit_edge: ; preds = %bb30 - br label %bb32 - -bb32: ; preds = %bb30.bb32_crit_edge, %bb30.bb32_crit_edge1, %bb30.bb32_crit_edge2 - br i1 false, label %bb53, label %bb52 - -bb52: ; preds = %bb32 - br label %bb739 - -bb53: ; preds = %bb32 - br label %bb101 - -bb58: ; preds = %bb101 - br label %bb92 - -bb64: ; preds = %bb92 - br i1 false, label %bb64.bb87_crit_edge, label %bb72 - -bb64.bb87_crit_edge: ; preds = %bb64 - br label %bb87 - -bb72: ; preds = %bb64 - br i1 false, label %bb72.bb87_crit_edge, label %bb79 - -bb72.bb87_crit_edge: ; preds = %bb72 - br label %bb87 - -bb79: ; preds = %bb72 - br label %bb87 - -bb87: ; preds = %bb79, %bb72.bb87_crit_edge, %bb64.bb87_crit_edge - br label %bb92 - -bb92: ; preds = %bb87, %bb58 - br i1 false, label %bb64, label %bb98 - -bb98: ; preds = %bb92 - br label %bb101 - -bb101: ; preds = %bb98, %bb53 - br i1 false, label %bb58, label %bb107 - -bb107: ; preds = %bb101 - br label %bb651 - -bb108: ; preds = %bb30.bb108_crit_edge, %bb30.bb108_crit_edge3 - br i1 false, label %bb125, label %bb124 - -bb124: ; preds = %bb108 - br label %bb739 - -bb125: ; preds = %bb108 - br i1 false, label %bb138, label %bb139 - -bb138: ; preds = %bb125 - br label %bb140 - -bb139: ; preds = %bb125 - br label %bb140 - -bb140: ; preds = %bb139, %bb138 - br label %bb651 - -bb142: ; preds = %bb30.bb142_crit_edge, %bb30.bb142_crit_edge4, %bb30.bb142_crit_edge5 - br i1 false, label %bb161, label %bb160 - -bb160: ; preds = %bb142 - br label %bb739 - -bb161: ; preds = %bb142 - br i1 false, label %bb170, label %bb161.bb171_crit_edge - -bb161.bb171_crit_edge: ; preds = %bb161 - br label %bb171 - -bb170: ; preds = %bb161 - br label %bb171 - -bb171: ; preds = %bb170, %bb161.bb171_crit_edge - br i1 false, label %bb176, label %bb171.bb177_crit_edge - -bb171.bb177_crit_edge: ; preds = %bb171 - br label %bb177 - -bb176: ; preds = %bb171 - br label %bb177 - -bb177: ; preds = %bb176, %bb171.bb177_crit_edge - br label %bb227 - -bb178: ; preds = %bb227 - br label %bb218 - -bb184: ; preds = %bb218 - br i1 false, label %bb191, label %bb193 - -bb191: ; preds = %bb184 - br label %bb213 - -bb193: ; preds = %bb184 - br i1 false, label %bb200, label %bb203 - -bb200: ; preds = %bb193 - br label %bb213 - -bb203: ; preds = %bb193 - br i1 false, label %bb210, label %bb203.bb213_crit_edge - -bb203.bb213_crit_edge: ; preds = %bb203 - br label %bb213 - -bb210: ; preds = %bb203 - br label %bb213 - -bb213: ; preds = %bb210, %bb203.bb213_crit_edge, %bb200, %bb191 - br label %bb218 - -bb218: ; preds = %bb213, %bb178 - br i1 false, label %bb184, label %bb224 - -bb224: ; preds = %bb218 - br label %bb227 - -bb227: ; preds = %bb224, %bb177 - br i1 false, label %bb178, label %bb233 - -bb233: ; preds = %bb227 - br label %bb651 - -bb234: ; preds = %bb30 - br i1 false, label %bb253, label %bb252 - -bb252: ; preds = %bb234 - br label %bb739 - -bb253: ; preds = %bb234 - br label %bb285 - -bb258: ; preds = %bb285 - br label %bb276 - -bb264: ; preds = %bb276 - br label %bb276 - -bb276: ; preds = %bb264, %bb258 - br i1 false, label %bb264, label %bb282 - -bb282: ; preds = %bb276 - br label %bb285 - -bb285: ; preds = %bb282, %bb253 - br i1 false, label %bb258, label %bb291 - -bb291: ; preds = %bb285 - br label %bb651 - -bb292: ; preds = %bb30 - br i1 false, label %bb311, label %bb310 - -bb310: ; preds = %bb292 - br label %bb739 - -bb311: ; preds = %bb292 - br label %bb346 - -bb316: ; preds = %bb346 - br label %bb337 - -bb322: ; preds = %bb337 - br label %bb337 - -bb337: ; preds = %bb322, %bb316 - br i1 false, label %bb322, label %bb343 - -bb343: ; preds = %bb337 - br label %bb346 - -bb346: ; preds = %bb343, %bb311 - br i1 false, label %bb316, label %bb352 - -bb352: ; preds = %bb346 - br label %bb651 - -bb353: ; preds = %bb30 - br i1 false, label %bb372, label %bb371 - -bb371: ; preds = %bb353 - br label %bb739 - -bb372: ; preds = %bb353 - br label %bb412 - -bb377: ; preds = %bb412 - br label %bb403 - -bb383: ; preds = %bb403 - br i1 false, label %bb395, label %bb389 - -bb389: ; preds = %bb383 - br label %bb396 - -bb395: ; preds = %bb383 - br label %bb396 - -bb396: ; preds = %bb395, %bb389 - br label %bb403 - -bb403: ; preds = %bb396, %bb377 - br i1 false, label %bb383, label %bb409 - -bb409: ; preds = %bb403 - br label %bb412 - -bb412: ; preds = %bb409, %bb372 - br i1 false, label %bb377, label %bb418 - -bb418: ; preds = %bb412 - br label %bb651 - -bb419: ; preds = %bb30 - br i1 false, label %bb438, label %bb437 - -bb437: ; preds = %bb419 - br label %bb739 - -bb438: ; preds = %bb419 - br label %bb478 - -bb443: ; preds = %bb478 - br label %bb469 - -bb449: ; preds = %bb469 - br i1 false, label %bb461, label %bb455 - -bb455: ; preds = %bb449 - br label %bb462 - -bb461: ; preds = %bb449 - br label %bb462 - -bb462: ; preds = %bb461, %bb455 - br label %bb469 - -bb469: ; preds = %bb462, %bb443 - br i1 false, label %bb449, label %bb475 - -bb475: ; preds = %bb469 - br label %bb478 - -bb478: ; preds = %bb475, %bb438 - br i1 false, label %bb443, label %bb484 - -bb484: ; preds = %bb478 - br label %bb651 - -bb485: ; preds = %bb30 - br i1 false, label %bb504, label %bb503 - -bb503: ; preds = %bb485 - br label %bb739 - -bb504: ; preds = %bb485 - br label %bb560 - -bb513: ; preds = %bb560 - br label %bb551 - -bb519: ; preds = %bb551 - br i1 false, label %bb528, label %bb532 - -bb528: ; preds = %bb519 - br label %bb536 - -bb532: ; preds = %bb519 - br label %bb536 - -bb536: ; preds = %bb532, %bb528 - br label %bb551 - -bb551: ; preds = %bb536, %bb513 - br i1 false, label %bb519, label %bb557 - -bb557: ; preds = %bb551 - br label %bb560 - -bb560: ; preds = %bb557, %bb504 - br i1 false, label %bb513, label %bb566 - -bb566: ; preds = %bb560 - br label %bb651 - -bb567: ; preds = %bb30 - br i1 false, label %bb586, label %bb585 - -bb585: ; preds = %bb567 - br label %bb739 - -bb586: ; preds = %bb567 - br label %bb641 - -bb595: ; preds = %bb641 - br label %bb632 - -bb601: ; preds = %bb632 - %tmp604 = icmp sgt i32 %i.7, 0 ; <i1> [#uses=1] - br i1 %tmp604, label %bb607, label %bb611 - -bb607: ; preds = %bb601 - br label %bb615 - -bb611: ; preds = %bb601 - br label %bb615 - -bb615: ; preds = %bb611, %bb607 - %tmp629 = add i32 %i.7, 1 ; <i32> [#uses=1] - %tmp631 = getelementptr float* %col.7, i32 1 ; <float*> [#uses=1] - br label %bb632 - -bb632: ; preds = %bb615, %bb595 - %col.7 = phi float* [ null, %bb595 ], [ %tmp631, %bb615 ] ; <float*> [#uses=1] - %i.7 = phi i32 [ 0, %bb595 ], [ %tmp629, %bb615 ] ; <i32> [#uses=3] - %tmp635 = icmp slt i32 %i.7, 0 ; <i1> [#uses=1] - br i1 %tmp635, label %bb601, label %bb638 - -bb638: ; preds = %bb632 - br label %bb641 - -bb641: ; preds = %bb638, %bb586 - br i1 false, label %bb595, label %bb647 - -bb647: ; preds = %bb641 - br label %bb651 - -bb648: ; preds = %bb30 - br label %bb739 - -bb651: ; preds = %bb647, %bb566, %bb484, %bb418, %bb352, %bb291, %bb233, %bb140, %bb107 - br i1 false, label %bb658, label %bb651.bb661_crit_edge - -bb651.bb661_crit_edge: ; preds = %bb651 - br label %bb661 - -bb658: ; preds = %bb651 - br label %bb661 - -bb661: ; preds = %bb658, %bb651.bb661_crit_edge - br i1 false, label %bb666, label %bb661.bb686_crit_edge - -bb661.bb686_crit_edge: ; preds = %bb661 - br label %bb686 - -bb666: ; preds = %bb661 - br label %bb680 - -bb670: ; preds = %bb680 - br label %bb680 - -bb680: ; preds = %bb670, %bb666 - br i1 false, label %bb670, label %bb680.bb686_crit_edge - -bb680.bb686_crit_edge: ; preds = %bb680 - br label %bb686 - -bb686: ; preds = %bb680.bb686_crit_edge, %bb661.bb686_crit_edge - br i1 false, label %bb699, label %bb696 - -bb696: ; preds = %bb686 - br label %bb739 - -bb699: ; preds = %bb686 - br i1 false, label %bb712, label %bb709 - -bb709: ; preds = %bb699 - br label %bb739 - -bb712: ; preds = %bb699 - br i1 false, label %bb717, label %bb712.bb720_crit_edge - -bb712.bb720_crit_edge: ; preds = %bb712 - br label %bb720 - -bb717: ; preds = %bb712 - br label %bb720 - -bb720: ; preds = %bb717, %bb712.bb720_crit_edge - br i1 false, label %bb725, label %bb720.bb738_crit_edge - -bb720.bb738_crit_edge: ; preds = %bb720 - br label %bb738 - -bb725: ; preds = %bb720 - br label %bb738 - -bb738: ; preds = %bb725, %bb720.bb738_crit_edge - br label %bb739 - -bb739: ; preds = %bb738, %bb709, %bb696, %bb648, %bb585, %bb503, %bb437, %bb371, %bb310, %bb252, %bb160, %bb124, %bb52 - br label %return - -return: ; preds = %bb739 - ret i32 0 -} diff --git a/test/Transforms/LoopIndexSplit/2008-03-24-ExitPhi.ll b/test/Transforms/LoopIndexSplit/2008-03-24-ExitPhi.ll deleted file mode 100644 index ca22e50..0000000 --- a/test/Transforms/LoopIndexSplit/2008-03-24-ExitPhi.ll +++ /dev/null @@ -1,69 +0,0 @@ -; RUN: opt < %s -loop-index-split -disable-output -; Handle Exit block phis that do not have any use inside the loop. - - %struct.ATOM = type { double, double, double, double, double, double, i32, double, double, double, double, i8*, i8, [9 x i8], double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, [200 x i8*], [32 x i8*], [32 x i8], i32 } - %struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 } - %struct.__sFILEX = type opaque - %struct.__sbuf = type { i8*, i32 } - -define i32 @math([80 x i8]* %tokens, double* %fvalue, i32* %ivalue, %struct.FILE* %ip, %struct.FILE* %op, i32 %echo) nounwind { -entry: - br i1 false, label %bb.i, label %bb35.i -bb.i: ; preds = %entry - br i1 false, label %bb6.i, label %bb9.i -bb9.i: ; preds = %bb.i - ret i32 0 -bb35.i: ; preds = %entry - ret i32 0 -bb6.i: ; preds = %bb.i - br i1 false, label %a_l2_f.exit, label %bb16.i -bb16.i: ; preds = %bb6.i - ret i32 0 -a_l2_f.exit: ; preds = %bb6.i - br i1 false, label %bb7.i97, label %bb6.i71 -bb6.i71: ; preds = %a_l2_f.exit - ret i32 0 -bb7.i97: ; preds = %a_l2_f.exit - br i1 false, label %bb, label %bb18.i102 -bb18.i102: ; preds = %bb7.i97 - ret i32 0 -bb: ; preds = %bb7.i97 - br i1 false, label %bb38, label %AFOUND -bb38: ; preds = %bb - br i1 false, label %bb111, label %bb7.i120 -AFOUND: ; preds = %bb - ret i32 0 -bb7.i120: ; preds = %bb38 - ret i32 0 -bb111: ; preds = %bb38 - switch i32 0, label %bb574 [ - i32 1, label %bb158 - i32 0, label %bb166 - ] -bb158: ; preds = %bb111 - ret i32 0 -bb166: ; preds = %bb111 - ret i32 0 -bb574: ; preds = %bb111 - br i1 false, label %bb11.i249, label %bb600 -bb11.i249: ; preds = %bb574 - br i1 false, label %bb11.i265, label %bb596 -bb11.i265: ; preds = %bb590, %bb11.i249 - %i.1.reg2mem.0 = phi i32 [ %tmp589.reg2mem.0, %bb590 ], [ 0, %bb11.i249 ] ; <i32> [#uses=2] - %tmp13.i264 = icmp slt i32 %i.1.reg2mem.0, 1 ; <i1> [#uses=1] - br i1 %tmp13.i264, label %bb16.i267, label %bb30.i279 -bb16.i267: ; preds = %bb11.i265 - br label %bb590 -bb30.i279: ; preds = %bb11.i265 - br label %bb590 -bb590: ; preds = %bb30.i279, %bb16.i267 - %tmp5876282.reg2mem.0 = phi %struct.ATOM* [ null, %bb30.i279 ], [ null, %bb16.i267 ] ; <%struct.ATOM*> [#uses=1] - %tmp589.reg2mem.0 = add i32 %i.1.reg2mem.0, 1 ; <i32> [#uses=2] - %tmp593 = icmp slt i32 %tmp589.reg2mem.0, 0 ; <i1> [#uses=1] - br i1 %tmp593, label %bb11.i265, label %bb596 -bb596: ; preds = %bb590, %bb11.i249 - %ap.0.reg2mem.0 = phi %struct.ATOM* [ null, %bb11.i249 ], [ %tmp5876282.reg2mem.0, %bb590 ] ; <%struct.ATOM*> [#uses=0] - ret i32 0 -bb600: ; preds = %bb574 - ret i32 0 -} diff --git a/test/Transforms/LoopIndexSplit/2008-05-19-IndVar.ll b/test/Transforms/LoopIndexSplit/2008-05-19-IndVar.ll deleted file mode 100644 index 7447e6d..0000000 --- a/test/Transforms/LoopIndexSplit/2008-05-19-IndVar.ll +++ /dev/null @@ -1,40 +0,0 @@ -; RUN: opt < %s -loop-index-split -stats -disable-output | not grep "loop-index-split" -;PR2294 -@g_2 = external global i16 ; <i16*> [#uses=4] -@g_5 = external global i32 ; <i32*> [#uses=1] -@.str = external constant [4 x i8] ; <[4 x i8]*> [#uses=1] - -declare void @func_1() nounwind - -define i32 @main() nounwind { -entry: - %tmp101.i = load i16* @g_2, align 2 ; <i16> [#uses=1] - %tmp112.i = icmp sgt i16 %tmp101.i, 0 ; <i1> [#uses=1] - br i1 %tmp112.i, label %bb.preheader.i, label %func_1.exit -bb.preheader.i: ; preds = %entry - %g_2.promoted.i = load i16* @g_2 ; <i16> [#uses=1] - br label %bb.i -bb.i: ; preds = %bb6.i, %bb.preheader.i - %g_2.tmp.0.i = phi i16 [ %g_2.promoted.i, %bb.preheader.i ], [ %tmp8.i, %bb6.i ] ; <i16> [#uses=2] - %tmp2.i = icmp eq i16 %g_2.tmp.0.i, 0 ; <i1> [#uses=1] - br i1 %tmp2.i, label %bb4.i, label %bb6.i -bb4.i: ; preds = %bb.i - %tmp5.i = volatile load i32* @g_5, align 4 ; <i32> [#uses=0] - br label %bb6.i -bb6.i: ; preds = %bb4.i, %bb.i - %tmp8.i = add i16 %g_2.tmp.0.i, 1 ; <i16> [#uses=3] - %tmp11.i = icmp sgt i16 %tmp8.i, 42 ; <i1> [#uses=1] - br i1 %tmp11.i, label %bb.i, label %return.loopexit.i -return.loopexit.i: ; preds = %bb6.i - %tmp8.i.lcssa = phi i16 [ %tmp8.i, %bb6.i ] ; <i16> [#uses=1] - store i16 %tmp8.i.lcssa, i16* @g_2 - br label %func_1.exit -func_1.exit: ; preds = %return.loopexit.i, %entry - %tmp1 = load i16* @g_2, align 2 ; <i16> [#uses=1] - %tmp12 = sext i16 %tmp1 to i32 ; <i32> [#uses=1] - %tmp3 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i32 %tmp12 ) nounwind ; <i32> [#uses=0] - ret i32 0 -} - -declare i32 @printf(i8*, ...) nounwind - diff --git a/test/Transforms/LoopIndexSplit/2008-06-03-DomFrontier.ll b/test/Transforms/LoopIndexSplit/2008-06-03-DomFrontier.ll deleted file mode 100644 index 6f691de..0000000 --- a/test/Transforms/LoopIndexSplit/2008-06-03-DomFrontier.ll +++ /dev/null @@ -1,32 +0,0 @@ -; RUN: opt < %s -loop-rotate -loop-unswitch -loop-index-split -instcombine -disable-output -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" - %struct.__CFData = type opaque - %struct.__CFString = type opaque - -define %struct.__CFData* @WirelessCreatePSK(%struct.__CFString* %inPassphrase, %struct.__CFData* %inSSID) nounwind { -entry: - br label %bb52 - -bb52: ; preds = %bb142, %bb52, %entry - br i1 false, label %bb142, label %bb52 - -bb63: ; preds = %bb142, %bb131 - %t.0.reg2mem.0 = phi i32 [ %tmp133, %bb131 ], [ 0, %bb142 ] ; <i32> [#uses=2] - %tmp65 = icmp ult i32 %t.0.reg2mem.0, 16 ; <i1> [#uses=1] - br i1 %tmp65, label %bb68, label %bb89 - -bb68: ; preds = %bb63 - br label %bb131 - -bb89: ; preds = %bb63 - br label %bb131 - -bb131: ; preds = %bb89, %bb68 - %tmp133 = add i32 %t.0.reg2mem.0, 1 ; <i32> [#uses=2] - %tmp136 = icmp ult i32 %tmp133, 80 ; <i1> [#uses=1] - br i1 %tmp136, label %bb63, label %bb142 - -bb142: ; preds = %bb131, %bb52 - br i1 undef, label %bb63, label %bb52 -} diff --git a/test/Transforms/LoopIndexSplit/2008-07-08-MisCompilation.ll b/test/Transforms/LoopIndexSplit/2008-07-08-MisCompilation.ll deleted file mode 100644 index 1fcd960..0000000 --- a/test/Transforms/LoopIndexSplit/2008-07-08-MisCompilation.ll +++ /dev/null @@ -1,25 +0,0 @@ -; RUN: opt < %s -loop-index-split -stats -disable-output | not grep "1 loop-index-split" -; PR 2487 -@g_6 = external global i32 ; <i32*> [#uses=1] - -define void @func_1() nounwind { -entry: - br label %bb - -bb: ; preds = %bb4, %entry - %l_3.0 = phi i8 [ 0, %entry ], [ %tmp6, %bb4 ] ; <i8> [#uses=2] - %tmp1 = icmp eq i8 %l_3.0, 0 ; <i1> [#uses=1] - br i1 %tmp1, label %bb3, label %bb4 - -bb3: ; preds = %bb - store i32 1, i32* @g_6, align 4 - br label %bb4 - -bb4: ; preds = %bb3, %bb - %tmp6 = add i8 %l_3.0, 1 ; <i8> [#uses=2] - %tmp9 = icmp sgt i8 %tmp6, -1 ; <i1> [#uses=1] - br i1 %tmp9, label %bb, label %return - -return: ; preds = %bb4 - ret void -} diff --git a/test/Transforms/LoopIndexSplit/2008-09-17-IVUse.ll b/test/Transforms/LoopIndexSplit/2008-09-17-IVUse.ll deleted file mode 100644 index ee8e7a3..0000000 --- a/test/Transforms/LoopIndexSplit/2008-09-17-IVUse.ll +++ /dev/null @@ -1,78 +0,0 @@ -; RUN: opt < %s -loop-index-split -stats -disable-output | not grep "loop-index-split" -; PR 2791 -@g_40 = common global i32 0 ; <i32*> [#uses=1] -@g_192 = common global i32 0 ; <i32*> [#uses=2] -@"\01LC" = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1] - -define void @func_29() nounwind { -entry: - %0 = load i32* @g_40, align 4 ; <i32> [#uses=1] - %1 = icmp eq i32 %0, 0 ; <i1> [#uses=1] - %g_192.promoted = load i32* @g_192 ; <i32> [#uses=0] - br i1 %1, label %entry.split.us, label %entry.split - -entry.split.us: ; preds = %entry - br label %bb.us - -bb.us: ; preds = %bb5.us, %entry.split.us - %i.0.reg2mem.0.us = phi i32 [ 0, %entry.split.us ], [ %3, %bb5.us ] ; <i32> [#uses=2] - %2 = icmp eq i32 %i.0.reg2mem.0.us, 0 ; <i1> [#uses=1] - br i1 %2, label %bb1.us, label %bb5.us - -bb5.us: ; preds = %bb1.us, %bb4.us, %bb.us - %iftmp.0.0.us = phi i32 [ 0, %bb4.us ], [ 1, %bb.us ], [ 1, %bb1.us ] ; <i32> [#uses=1] - %3 = add i32 %i.0.reg2mem.0.us, 1 ; <i32> [#uses=3] - %4 = icmp ult i32 %3, 10 ; <i1> [#uses=1] - br i1 %4, label %bb.us, label %bb8.us - -bb4.us: ; preds = %bb1.us - br label %bb5.us - -bb1.us: ; preds = %bb.us - br i1 true, label %bb4.us, label %bb5.us - -bb8.us: ; preds = %bb5.us - %iftmp.0.0.lcssa.us = phi i32 [ %iftmp.0.0.us, %bb5.us ] ; <i32> [#uses=1] - %.lcssa.us = phi i32 [ %3, %bb5.us ] ; <i32> [#uses=1] - br label %bb8.split - -entry.split: ; preds = %entry - br label %bb - -bb: ; preds = %bb5, %entry.split - %i.0.reg2mem.0 = phi i32 [ 0, %entry.split ], [ %6, %bb5 ] ; <i32> [#uses=2] - %5 = icmp eq i32 %i.0.reg2mem.0, 0 ; <i1> [#uses=1] - br i1 %5, label %bb1, label %bb5 - -bb1: ; preds = %bb - br i1 false, label %bb4, label %bb5 - -bb4: ; preds = %bb1 - br label %bb5 - -bb5: ; preds = %bb1, %bb, %bb4 - %iftmp.0.0 = phi i32 [ 0, %bb4 ], [ 1, %bb ], [ 1, %bb1 ] ; <i32> [#uses=1] - %6 = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=3] - %7 = icmp ult i32 %6, 10 ; <i1> [#uses=1] - br i1 %7, label %bb, label %bb8 - -bb8: ; preds = %bb5 - %iftmp.0.0.lcssa = phi i32 [ %iftmp.0.0, %bb5 ] ; <i32> [#uses=1] - %.lcssa = phi i32 [ %6, %bb5 ] ; <i32> [#uses=1] - br label %bb8.split - -bb8.split: ; preds = %bb8.us, %bb8 - %iftmp.0.0.lcssa.us-lcssa = phi i32 [ %iftmp.0.0.lcssa, %bb8 ], [ %iftmp.0.0.lcssa.us, %bb8.us ] ; <i32> [#uses=1] - %.lcssa.us-lcssa = phi i32 [ %.lcssa, %bb8 ], [ %.lcssa.us, %bb8.us ] ; <i32> [#uses=1] - store i32 %iftmp.0.0.lcssa.us-lcssa, i32* @g_192 - %8 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), i32 %.lcssa.us-lcssa ) nounwind ; <i32> [#uses=0] - ret void -} - -declare i32 @printf(i8*, ...) nounwind - -define i32 @main() nounwind { -entry: - call void @func_29( ) nounwind - ret i32 0 -} diff --git a/test/Transforms/LoopIndexSplit/2008-09-20-Crash.ll b/test/Transforms/LoopIndexSplit/2008-09-20-Crash.ll deleted file mode 100644 index ef67736..0000000 --- a/test/Transforms/LoopIndexSplit/2008-09-20-Crash.ll +++ /dev/null @@ -1,38 +0,0 @@ -; RUN: opt < %s -loop-index-split -disable-output -; PR 2805 -@g_330 = common global i32 0 ; <i32*> [#uses=1] - -define i32 @func_45(i32 %p_47) nounwind { -entry: - br label %bb - -bb: ; preds = %bb3, %entry - %p_47_addr.0.reg2mem.0 = phi i32 [ 0, %entry ], [ %2, %bb3 ] ; <i32> [#uses=2] - %0 = icmp eq i32 %p_47_addr.0.reg2mem.0, 0 ; <i1> [#uses=1] - br i1 %0, label %bb2, label %bb1 - -bb1: ; preds = %bb - %1 = tail call i32 (...)* @func_70( i32 1 ) nounwind ; <i32> [#uses=0] - br label %bb3 - -bb2: ; preds = %bb - store i32 1, i32* @g_330, align 4 - br label %bb3 - -bb3: ; preds = %bb2, %bb1 - %2 = add i32 %p_47_addr.0.reg2mem.0, 1 ; <i32> [#uses=3] - %3 = icmp ult i32 %2, 22 ; <i1> [#uses=1] - br i1 %3, label %bb, label %bb6 - -bb6: ; preds = %bb3 - %.lcssa = phi i32 [ %2, %bb3 ] ; <i32> [#uses=1] - %4 = tail call i32 (...)* @func_95( i32 %.lcssa ) nounwind ; <i32> [#uses=1] - %5 = tail call i32 (...)* @func_56( i32 %4 ) nounwind ; <i32> [#uses=0] - ret i32 undef -} - -declare i32 @func_70(...) - -declare i32 @func_95(...) - -declare i32 @func_56(...) diff --git a/test/Transforms/LoopIndexSplit/2008-10-06-Crash.ll b/test/Transforms/LoopIndexSplit/2008-10-06-Crash.ll deleted file mode 100644 index cca54ad..0000000 --- a/test/Transforms/LoopIndexSplit/2008-10-06-Crash.ll +++ /dev/null @@ -1,31 +0,0 @@ -; RUN: opt < %s -loop-index-split -disable-output - %struct.RExC_state_t = type { i32, i8*, %struct.regexp*, i8*, i8*, i8*, i32, %struct.regnode*, %struct.regnode*, i32, i32, i32, i32, i32, i32, i32, i32, i32 } - %struct.SV = type { i8*, i32, i32 } - %struct.reg_data = type { i32, i8*, [1 x i8*] } - %struct.reg_substr_data = type { [3 x %struct.reg_substr_datum] } - %struct.reg_substr_datum = type { i32, i32, %struct.SV*, %struct.SV* } - %struct.regexp = type { i32*, i32*, %struct.regnode*, %struct.reg_substr_data*, i8*, %struct.reg_data*, i8*, i32*, i32, i32, i32, i32, i32, i32, i32, i32, [1 x %struct.regnode] } - %struct.regnode = type { i8, i8, i16 } - -define fastcc %struct.regnode* @S_regclass(%struct.RExC_state_t* %pRExC_state) nounwind { -entry: - br label %bb439 - -bb439: ; preds = %bb444, %entry - %value23.16.reg2mem.0 = phi i32 [ %3, %bb444 ], [ 0, %entry ] ; <i32> [#uses=3] - %0 = icmp ugt i32 %value23.16.reg2mem.0, 31 ; <i1> [#uses=1] - %1 = icmp ne i32 %value23.16.reg2mem.0, 127 ; <i1> [#uses=1] - %2 = and i1 %0, %1 ; <i1> [#uses=1] - br i1 %2, label %bb443, label %bb444 - -bb443: ; preds = %bb439 - br label %bb444 - -bb444: ; preds = %bb443, %bb439 - %3 = add i32 %value23.16.reg2mem.0, 1 ; <i32> [#uses=2] - %4 = icmp ugt i32 %3, 255 ; <i1> [#uses=1] - br i1 %4, label %bb675, label %bb439 - -bb675: ; preds = %bb444 - unreachable -} diff --git a/test/Transforms/LoopIndexSplit/2008-10-10-OneIteration.ll b/test/Transforms/LoopIndexSplit/2008-10-10-OneIteration.ll deleted file mode 100644 index 372fee5..0000000 --- a/test/Transforms/LoopIndexSplit/2008-10-10-OneIteration.ll +++ /dev/null @@ -1,66 +0,0 @@ -; RUN: opt < %s -loop-index-split -stats -disable-output |& grep "1 loop-index-split" -; PR 2869 - -@w = external global [2 x [2 x i32]] ; <[2 x [2 x i32]]*> [#uses=5] - -declare i32 @f() nounwind - -define i32 @main() noreturn nounwind { -entry: - br label %bb1.i.outer - -bb1.i.outer: ; preds = %bb5.i, %entry - %i.0.reg2mem.0.ph.i.ph = phi i32 [ 0, %entry ], [ %indvar.next1, %bb5.i ] ; <i32> [#uses=3] - br label %bb1.i - -bb1.i: ; preds = %bb3.i, %bb1.i.outer - %j.0.reg2mem.0.i = phi i32 [ 0, %bb1.i.outer ], [ %indvar.next, %bb3.i ] ; <i32> [#uses=3] - %0 = icmp eq i32 %i.0.reg2mem.0.ph.i.ph, %j.0.reg2mem.0.i ; <i1> [#uses=1] - br i1 %0, label %bb2.i, label %bb3.i - -bb2.i: ; preds = %bb1.i - %1 = getelementptr [2 x [2 x i32]]* @w, i32 0, i32 %i.0.reg2mem.0.ph.i.ph, i32 %j.0.reg2mem.0.i ; <i32*> [#uses=1] - store i32 1, i32* %1, align 4 - br label %bb3.i - -bb3.i: ; preds = %bb2.i, %bb1.i - %indvar.next = add i32 %j.0.reg2mem.0.i, 1 ; <i32> [#uses=2] - %exitcond = icmp eq i32 %indvar.next, 2 ; <i1> [#uses=1] - br i1 %exitcond, label %bb5.i, label %bb1.i - -bb5.i: ; preds = %bb3.i - %indvar.next1 = add i32 %i.0.reg2mem.0.ph.i.ph, 1 ; <i32> [#uses=2] - %exitcond2 = icmp eq i32 %indvar.next1, 2 ; <i1> [#uses=1] - br i1 %exitcond2, label %f.exit, label %bb1.i.outer - -f.exit: ; preds = %bb5.i - %2 = load i32* getelementptr ([2 x [2 x i32]]* @w, i32 0, i32 0, i32 0), align 4 ; <i32> [#uses=1] - %3 = icmp eq i32 %2, 1 ; <i1> [#uses=1] - br i1 %3, label %bb, label %bb3 - -bb: ; preds = %f.exit - %4 = load i32* getelementptr ([2 x [2 x i32]]* @w, i32 0, i32 1, i32 1), align 4 ; <i32> [#uses=1] - %5 = icmp eq i32 %4, 1 ; <i1> [#uses=1] - br i1 %5, label %bb1, label %bb3 - -bb1: ; preds = %bb - %6 = load i32* getelementptr ([2 x [2 x i32]]* @w, i32 0, i32 1, i32 0), align 4 ; <i32> [#uses=1] - %7 = icmp eq i32 %6, 0 ; <i1> [#uses=1] - br i1 %7, label %bb2, label %bb3 - -bb2: ; preds = %bb1 - %8 = load i32* getelementptr ([2 x [2 x i32]]* @w, i32 0, i32 0, i32 1), align 4 ; <i32> [#uses=1] - %9 = icmp eq i32 %8, 0 ; <i1> [#uses=1] - br i1 %9, label %bb4, label %bb3 - -bb3: ; preds = %bb2, %bb1, %bb, %f.exit - tail call void @abort() noreturn nounwind - unreachable - -bb4: ; preds = %bb2 - ret i32 0 -} - -declare void @abort() noreturn nounwind - -declare void @exit(i32) noreturn nounwind diff --git a/test/Transforms/LoopIndexSplit/2008-11-10-Sign.ll b/test/Transforms/LoopIndexSplit/2008-11-10-Sign.ll deleted file mode 100644 index 217ff52..0000000 --- a/test/Transforms/LoopIndexSplit/2008-11-10-Sign.ll +++ /dev/null @@ -1,69 +0,0 @@ -; RUN: opt < %s -loop-index-split -stats | not grep "loop-index-split" -; PR3029 - -@g_138 = common global i32 0 ; <i32*> [#uses=3] -@g_188 = common global i32 0 ; <i32*> [#uses=4] -@g_207 = common global i32 0 ; <i32*> [#uses=3] -@"\01LC" = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1] -@g_102 = common global i32 0 ; <i32*> [#uses=0] - -define i32 @func_119() nounwind { -entry: - %0 = volatile load i32* @g_138, align 4 ; <i32> [#uses=1] - ret i32 %0 -} - -define void @func_110(i32 %p_111) nounwind { -entry: - %0 = load i32* @g_188, align 4 ; <i32> [#uses=1] - %1 = icmp ugt i32 %0, -1572397472 ; <i1> [#uses=1] - br i1 %1, label %bb, label %bb1 - -bb: ; preds = %entry - %2 = volatile load i32* @g_138, align 4 ; <i32> [#uses=0] - ret void - -bb1: ; preds = %entry - store i32 1, i32* @g_207, align 4 - ret void -} - -define void @func_34() nounwind { -entry: - store i32 0, i32* @g_188 - %g_188.promoted = load i32* @g_188 ; <i32> [#uses=1] - br label %bb - -bb: ; preds = %func_110.exit, %entry - %g_188.tmp.0 = phi i32 [ %g_188.promoted, %entry ], [ %2, %func_110.exit ] ; <i32> [#uses=2] - %0 = icmp ugt i32 %g_188.tmp.0, -1572397472 ; <i1> [#uses=1] - br i1 %0, label %bb.i, label %bb1.i - -bb.i: ; preds = %bb - %1 = volatile load i32* @g_138, align 4 ; <i32> [#uses=0] - br label %func_110.exit - -bb1.i: ; preds = %bb - store i32 1, i32* @g_207, align 4 - br label %func_110.exit - -func_110.exit: ; preds = %bb.i, %bb1.i - %2 = add i32 %g_188.tmp.0, 1 ; <i32> [#uses=3] - %3 = icmp sgt i32 %2, 1 ; <i1> [#uses=1] - br i1 %3, label %return, label %bb - -return: ; preds = %func_110.exit - %.lcssa = phi i32 [ %2, %func_110.exit ] ; <i32> [#uses=1] - store i32 %.lcssa, i32* @g_188 - ret void -} - -define i32 @main() nounwind { -entry: - call void @func_34() nounwind - %0 = load i32* @g_207, align 4 ; <i32> [#uses=1] - %1 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), i32 %0) nounwind ; <i32> [#uses=0] - ret i32 0 -} - -declare i32 @printf(i8*, ...) nounwind diff --git a/test/Transforms/LoopIndexSplit/2009-03-02-UpdateIterationSpace-crash.ll b/test/Transforms/LoopIndexSplit/2009-03-02-UpdateIterationSpace-crash.ll deleted file mode 100644 index 9acf391..0000000 --- a/test/Transforms/LoopIndexSplit/2009-03-02-UpdateIterationSpace-crash.ll +++ /dev/null @@ -1,64 +0,0 @@ -; RUN: opt < %s -loop-index-split -disable-output - %struct.CGPoint = type { double, double } - %struct.IBCFMutableDictionary = type { %struct.NSMutableArray, %struct.__CFDictionary*, %struct.NSSortDescriptor*, %struct.NSSortDescriptor* } - %struct.IBInspectorMode = type opaque - %struct.IBInspectorModeView = type { %struct.NSView, %struct.NSArray*, %struct.IBCFMutableDictionary*, %struct.IBInspectorMode*, %struct.IBInspectorMode*, %struct.IBInspectorMode*, %struct.objc_selector*, %struct.NSObject* } - %struct.NSArray = type { %struct.NSObject } - %struct.NSImage = type { %struct.NSObject, %struct.NSArray*, %struct.CGPoint, %struct.__imageFlags, %struct.NSObject*, %struct._NSImageAuxiliary* } - %struct.NSMutableArray = type { %struct.NSArray } - %struct.NSObject = type { %struct.objc_class* } - %struct.NSRect = type { %struct.CGPoint, %struct.CGPoint } - %struct.NSResponder = type { %struct.NSObject, %struct.NSObject* } - %struct.NSSortDescriptor = type { %struct.NSObject, i64, %struct.NSArray*, %struct.objc_selector*, %struct.NSObject* } - %struct.NSURL = type { %struct.NSObject, %struct.NSArray*, %struct.NSURL*, i8*, i8* } - %struct.NSView = type { %struct.NSResponder, %struct.NSRect, %struct.NSRect, %struct.NSObject*, %struct.NSObject*, %struct.NSWindow*, %struct.NSObject*, %struct.NSObject*, %struct.NSObject*, %struct.NSObject*, %struct._NSViewAuxiliary*, %struct._VFlags, %struct.__VFlags2 } - %struct.NSWindow = type { %struct.NSResponder, %struct.NSRect, %struct.NSObject*, %struct.NSObject*, %struct.NSResponder*, %struct.NSView*, %struct.NSView*, %struct.NSObject*, %struct.NSObject*, i32, i64, i32, %struct.NSArray*, %struct.NSObject*, i8, i8, i8, i8, i8*, i8*, %struct.NSImage*, i32, %struct.NSMutableArray*, %struct.NSURL*, %struct.CGPoint*, %struct.NSArray*, %struct.NSArray*, %struct.__wFlags, %struct.NSObject*, %struct.NSView*, %struct.NSWindowAuxiliary* } - %struct.NSWindowAuxiliary = type opaque - %struct._NSImageAuxiliary = type opaque - %struct._NSViewAuxiliary = type opaque - %struct._VFlags = type <{ i8, i8, i8, i8 }> - %struct.__CFDictionary = type opaque - %struct.__VFlags2 = type <{ i32 }> - %struct.__imageFlags = type <{ i8, [3 x i8] }> - %struct.__wFlags = type <{ i8, i8, i8, i8, i8, i8, i8, i8 }> - %struct.objc_class = type opaque - %struct.objc_selector = type opaque - -define %struct.NSArray* @"\01-[IBInspectorModeView calculateModeRects]"(%struct.IBInspectorModeView* %self, %struct.objc_selector* %_cmd) optsize ssp { -entry: - br i1 false, label %bb7, label %bb - -bb: ; preds = %entry - br i1 false, label %bb.nph, label %bb7.loopexit - -bb.nph: ; preds = %bb - br label %bb1 - -bb1: ; preds = %bb6, %bb.nph - %midx.01 = phi i64 [ %3, %bb6 ], [ 0, %bb.nph ] ; <i64> [#uses=3] - %0 = icmp sge i64 %midx.01, 0 ; <i1> [#uses=1] - %1 = icmp sle i64 %midx.01, 0 ; <i1> [#uses=1] - %2 = and i1 %0, %1 ; <i1> [#uses=1] - br i1 %2, label %bb4, label %bb5 - -bb4: ; preds = %bb1 - br label %bb5 - -bb5: ; preds = %bb4, %bb1 - %modeWidth.0 = phi double [ 0.000000e+00, %bb1 ], [ 0.000000e+00, %bb4 ] ; <double> [#uses=0] - %3 = add i64 %midx.01, 1 ; <i64> [#uses=1] - br label %bb6 - -bb6: ; preds = %bb5 - %4 = icmp slt i64 0, 0 ; <i1> [#uses=1] - br i1 %4, label %bb1, label %bb6.bb7.loopexit_crit_edge - -bb6.bb7.loopexit_crit_edge: ; preds = %bb6 - br label %bb7.loopexit - -bb7.loopexit: ; preds = %bb6.bb7.loopexit_crit_edge, %bb - br label %bb7 - -bb7: ; preds = %bb7.loopexit, %entry - ret %struct.NSArray* null -} diff --git a/test/Transforms/LoopIndexSplit/2009-03-30-undef.ll b/test/Transforms/LoopIndexSplit/2009-03-30-undef.ll deleted file mode 100644 index deef941..0000000 --- a/test/Transforms/LoopIndexSplit/2009-03-30-undef.ll +++ /dev/null @@ -1,24 +0,0 @@ -; RUN: opt < %s -loop-index-split -S | not grep undef -define i32 @main() { -entry: - br label %header - -header: - %r = phi i32 [ 0, %entry ], [ %r3, %skip ] - %i = phi i32 [ 0, %entry ], [ %i1, %skip ] - %i99 = add i32 %i, 99 - %cond = icmp eq i32 %i99, 3 - br i1 %cond, label %body, label %skip - -body: - br label %skip - -skip: - %r3 = phi i32 [ %r, %header ], [ 3, %body ] - %i1 = add i32 %i, 1 - %exitcond = icmp eq i32 %i1, 10 - br i1 %exitcond, label %exit, label %header - -exit: - ret i32 %r3 -} diff --git a/test/Transforms/LoopIndexSplit/Crash-2007-08-17.ll b/test/Transforms/LoopIndexSplit/Crash-2007-08-17.ll deleted file mode 100644 index ad2b794..0000000 --- a/test/Transforms/LoopIndexSplit/Crash-2007-08-17.ll +++ /dev/null @@ -1,52 +0,0 @@ -; RUN: opt < %s -loop-index-split -disable-output - - %struct._edit_script = type { %struct._edit_script*, i32, i8 } - -define void @align_path(i8* %seq1, i8* %seq2, i32 %i1, i32 %j1, i32 %i2, i32 %j2, i32 %dist, %struct._edit_script** %head, %struct._edit_script** %tail, i32 %M, i32 %N) { -entry: - br label %bb354 - -bb354: ; preds = %bb511, %entry - br i1 false, label %bb495, label %bb368 - -bb368: ; preds = %bb354 - ret void - -bb495: ; preds = %bb495, %bb354 - br i1 false, label %bb511, label %bb495 - -bb511: ; preds = %bb495 - br i1 false, label %xmalloc.exit69, label %bb354 - -xmalloc.exit69: ; preds = %bb511 - br i1 false, label %bb556, label %bb542.preheader - -bb542.preheader: ; preds = %xmalloc.exit69 - ret void - -bb556: ; preds = %xmalloc.exit69 - br label %bb583 - -bb583: ; preds = %cond_next693, %bb556 - %k.4342.0 = phi i32 [ %tmp707, %cond_next693 ], [ 0, %bb556 ] ; <i32> [#uses=2] - %tmp586 = icmp eq i32 %k.4342.0, 0 ; <i1> [#uses=1] - br i1 %tmp586, label %cond_true589, label %cond_false608 - -cond_true589: ; preds = %bb583 - br label %cond_next693 - -cond_false608: ; preds = %bb583 - br i1 false, label %cond_next661, label %cond_next693 - -cond_next661: ; preds = %cond_false608 - br label %cond_next693 - -cond_next693: ; preds = %cond_next661, %cond_false608, %cond_true589 - %tmp705 = getelementptr i32* null, i32 0 ; <i32*> [#uses=0] - %tmp707 = add i32 %k.4342.0, 1 ; <i32> [#uses=2] - %tmp711 = icmp sgt i32 %tmp707, 0 ; <i1> [#uses=1] - br i1 %tmp711, label %bb726.preheader, label %bb583 - -bb726.preheader: ; preds = %cond_next693 - ret void -} diff --git a/test/Transforms/LoopIndexSplit/Crash-2007-12-03.ll b/test/Transforms/LoopIndexSplit/Crash-2007-12-03.ll deleted file mode 100644 index 187484a..0000000 --- a/test/Transforms/LoopIndexSplit/Crash-2007-12-03.ll +++ /dev/null @@ -1,44 +0,0 @@ -; RUN: opt < %s -loop-index-split -disable-output -; PR1828.bc -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:32:32" -target triple = "i686-pc-linux-gnu" - %RPyOpaque_RuntimeTypeInfo = type opaque* - %arraytype_Char_1 = type { i32, [0 x i8] } - %arraytype_Signed = type { i32, [0 x i32] } - %functiontype_11 = type %structtype_object* () - %functiontype_360 = type %structtype_rpy_string* (%structtype_pypy.rlib.rbigint.rbigint*, %structtype_rpy_string*, %structtype_rpy_string*, %structtype_rpy_string*) - %structtype_list_18 = type { i32, %arraytype_Signed* } - %structtype_object = type { %structtype_object_vtable* } - %structtype_object_vtable = type { i32, i32, %RPyOpaque_RuntimeTypeInfo*, %arraytype_Char_1*, %functiontype_11* } - %structtype_pypy.rlib.rbigint.rbigint = type { %structtype_object, %structtype_list_18*, i32 } - %structtype_rpy_string = type { i32, %arraytype_Char_1 } - -define fastcc %structtype_rpy_string* @pypy__format(%structtype_pypy.rlib.rbigint.rbigint* %a_1, %structtype_rpy_string* %digits_0, %structtype_rpy_string* %prefix_3, %structtype_rpy_string* %suffix_0) { -block0: - br i1 false, label %block67, label %block13 - -block13: ; preds = %block0 - ret %structtype_rpy_string* null - -block31: ; preds = %block67, %block44 - ret %structtype_rpy_string* null - -block42: ; preds = %block67, %block44 - %j_167.reg2mem.0 = phi i32 [ %v63822, %block44 ], [ 0, %block67 ] ; <i32> [#uses=1] - %v63822 = add i32 %j_167.reg2mem.0, -1 ; <i32> [#uses=3] - %v63823 = icmp slt i32 %v63822, 0 ; <i1> [#uses=1] - br i1 %v63823, label %block46, label %block43 - -block43: ; preds = %block42 - br label %block44 - -block44: ; preds = %block46, %block43 - %v6377959 = icmp sgt i32 %v63822, 0 ; <i1> [#uses=1] - br i1 %v6377959, label %block42, label %block31 - -block46: ; preds = %block42 - br label %block44 - -block67: ; preds = %block0 - br i1 false, label %block42, label %block31 -} diff --git a/test/Transforms/LoopIndexSplit/Crash2-2007-08-17.ll b/test/Transforms/LoopIndexSplit/Crash2-2007-08-17.ll deleted file mode 100644 index 098e407..0000000 --- a/test/Transforms/LoopIndexSplit/Crash2-2007-08-17.ll +++ /dev/null @@ -1,58 +0,0 @@ -; RUN: opt < %s -loop-index-split -disable-output - - %struct._edit_script = type { %struct._edit_script*, i32, i8 } - -define void @align_path(i8* %seq1, i8* %seq2, i32 %i1, i32 %j1, i32 %i2, i32 %j2, i32 %dist, %struct._edit_script** %head, %struct._edit_script** %tail, i32 %M, i32 %N) { -entry: - br label %bb354 - -bb354: ; preds = %bb511, %entry - br i1 false, label %bb495, label %bb368 - -bb368: ; preds = %bb354 - ret void - -bb495: ; preds = %bb495, %bb354 - br i1 false, label %bb511, label %bb495 - -bb511: ; preds = %bb495 - br i1 false, label %xmalloc.exit69, label %bb354 - -xmalloc.exit69: ; preds = %bb511 - br i1 false, label %bb556, label %bb542.preheader - -bb542.preheader: ; preds = %xmalloc.exit69 - ret void - -bb556: ; preds = %xmalloc.exit69 - br label %bb583 - -bb583: ; preds = %cond_next693, %bb556 - %k.4342.0 = phi i32 [ %tmp707, %cond_next693 ], [ 0, %bb556 ] ; <i32> [#uses=2] - %tmp586 = icmp eq i32 %k.4342.0, 0 ; <i1> [#uses=1] - br i1 %tmp586, label %cond_true589, label %cond_false608 - -cond_true589: ; preds = %bb583 - br label %cond_next693 - -cond_false608: ; preds = %bb583 - br i1 false, label %bb645, label %cond_next693 - -bb645: ; preds = %cond_false608 - br i1 false, label %bb684, label %cond_next661 - -cond_next661: ; preds = %bb645 - br i1 false, label %bb684, label %cond_next693 - -bb684: ; preds = %cond_next661, %bb645 - br label %cond_next693 - -cond_next693: ; preds = %bb684, %cond_next661, %cond_false608, %cond_true589 - %tmp705 = getelementptr i32* null, i32 0 ; <i32*> [#uses=0] - %tmp707 = add i32 %k.4342.0, 1 ; <i32> [#uses=2] - %tmp711 = icmp sgt i32 %tmp707, 0 ; <i1> [#uses=1] - br i1 %tmp711, label %bb726.preheader, label %bb583 - -bb726.preheader: ; preds = %cond_next693 - ret void -} diff --git a/test/Transforms/LoopIndexSplit/ExitCondition-2007-09-10.ll b/test/Transforms/LoopIndexSplit/ExitCondition-2007-09-10.ll deleted file mode 100644 index a04715a..0000000 --- a/test/Transforms/LoopIndexSplit/ExitCondition-2007-09-10.ll +++ /dev/null @@ -1,50 +0,0 @@ -; RUN: opt < %s -loop-index-split -disable-output - -@k = external global i32 ; <i32*> [#uses=2] - -define void @foobar(i32 %a, i32 %b) { -entry: - br label %bb - -bb: ; preds = %cond_next16, %entry - %i.01.0 = phi i32 [ 0, %entry ], [ %tmp18, %cond_next16 ] ; <i32> [#uses=5] - %tsum.18.0 = phi i32 [ 42, %entry ], [ %tsum.013.1, %cond_next16 ] ; <i32> [#uses=3] - %tmp1 = icmp slt i32 %i.01.0, 50 ; <i1> [#uses=1] - br i1 %tmp1, label %cond_true, label %cond_false - -cond_true: ; preds = %bb - %tmp4 = tail call i32 @foo( i32 %i.01.0 ) ; <i32> [#uses=1] - %tmp6 = add i32 %tmp4, %tsum.18.0 ; <i32> [#uses=2] - %tmp914 = load i32* @k, align 4 ; <i32> [#uses=1] - %tmp1015 = icmp eq i32 %tmp914, 0 ; <i1> [#uses=1] - br i1 %tmp1015, label %cond_next16, label %cond_true13 - -cond_false: ; preds = %bb - %tmp8 = tail call i32 @bar( i32 %i.01.0 ) ; <i32> [#uses=0] - %tmp9 = load i32* @k, align 4 ; <i32> [#uses=1] - %tmp10 = icmp eq i32 %tmp9, 0 ; <i1> [#uses=1] - br i1 %tmp10, label %cond_next16, label %cond_true13 - -cond_true13: ; preds = %cond_false, %cond_true - %tsum.013.0 = phi i32 [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false ] ; <i32> [#uses=1] - %tmp15 = tail call i32 @bar( i32 %i.01.0 ) ; <i32> [#uses=0] - br label %cond_next16 - -cond_next16: ; preds = %cond_false, %cond_true, %cond_true13 - %tsum.013.1 = phi i32 [ %tsum.013.0, %cond_true13 ], [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false ] ; <i32> [#uses=2] - %tmp18 = add i32 %i.01.0, 1 ; <i32> [#uses=3] - %tmp21 = icmp eq i32 %tmp18, 100 ; <i1> [#uses=1] - br i1 %tmp21, label %bb, label %bb24 - -bb24: ; preds = %cond_next16 - %tmp18.lcssa = phi i32 [ %tmp18, %cond_next16 ] ; <i32> [#uses=1] - %tsum.013.1.lcssa = phi i32 [ %tsum.013.1, %cond_next16 ] ; <i32> [#uses=1] - %tmp27 = tail call i32 @t( i32 %tmp18.lcssa, i32 %tsum.013.1.lcssa ) ; <i32> [#uses=0] - ret void -} - -declare i32 @foo(i32) - -declare i32 @bar(i32) - -declare i32 @t(i32, i32) diff --git a/test/Transforms/LoopIndexSplit/OneIterLoop-2007-08-17.ll b/test/Transforms/LoopIndexSplit/OneIterLoop-2007-08-17.ll deleted file mode 100644 index d18b3b7..0000000 --- a/test/Transforms/LoopIndexSplit/OneIterLoop-2007-08-17.ll +++ /dev/null @@ -1,67 +0,0 @@ -; Loop is elimianted -; RUN: opt < %s -loop-index-split -disable-output -stats |& \ -; RUN: grep "loop-index-split" | count 1 - %struct.anon = type { i32 } -@S1 = external global i32 ; <i32*> [#uses=1] -@W1 = external global i32 ; <i32*> [#uses=1] -@Y = weak global [100 x %struct.anon] zeroinitializer, align 32 ; <[100 x %struct.anon]*> [#uses=1] -@ti = external global i32 ; <i32*> [#uses=1] -@T2 = external global [100 x [100 x i32]] ; <[100 x [100 x i32]]*> [#uses=1] -@d = external global i32 ; <i32*> [#uses=1] -@T1 = external global i32 ; <i32*> [#uses=2] -@N2 = external global i32 ; <i32*> [#uses=2] - -define void @foo() { -entry: - %tmp = load i32* @S1, align 4 ; <i32> [#uses=4] - %tmp266 = load i32* @N2, align 4 ; <i32> [#uses=1] - %tmp288 = icmp ult i32 %tmp, %tmp266 ; <i1> [#uses=1] - br i1 %tmp288, label %bb.preheader, label %return - -bb.preheader: ; preds = %entry - %tmp1 = load i32* @W1, align 4 ; <i32> [#uses=1] - %tmp13 = load i32* @ti, align 4 ; <i32> [#uses=1] - %tmp18 = load i32* @d, align 4 ; <i32> [#uses=1] - %tmp26 = load i32* @N2, align 4 ; <i32> [#uses=2] - %T1.promoted = load i32* @T1 ; <i32> [#uses=1] - %tmp2 = add i32 %tmp, 1 ; <i32> [#uses=2] - %tmp4 = icmp ugt i32 %tmp2, %tmp26 ; <i1> [#uses=1] - %umax = select i1 %tmp4, i32 %tmp2, i32 %tmp26 ; <i32> [#uses=1] - %tmp5 = sub i32 0, %tmp ; <i32> [#uses=1] - %tmp6 = add i32 %umax, %tmp5 ; <i32> [#uses=1] - br label %bb - -bb: ; preds = %bb25, %bb.preheader - %indvar = phi i32 [ 0, %bb.preheader ], [ %indvar.next, %bb25 ] ; <i32> [#uses=2] - %T1.tmp.1 = phi i32 [ %T1.promoted, %bb.preheader ], [ %T1.tmp.0, %bb25 ] ; <i32> [#uses=3] - %tj.01.0 = add i32 %indvar, %tmp ; <i32> [#uses=3] - %tmp3 = icmp eq i32 %tj.01.0, %tmp1 ; <i1> [#uses=1] - br i1 %tmp3, label %cond_true, label %bb25 - -cond_true: ; preds = %bb - %tmp7 = getelementptr [100 x %struct.anon]* @Y, i32 0, i32 %tj.01.0, i32 0 ; <i32*> [#uses=1] - %tmp8 = load i32* %tmp7, align 4 ; <i32> [#uses=1] - %tmp9 = icmp sgt i32 %tmp8, 0 ; <i1> [#uses=1] - br i1 %tmp9, label %cond_true12, label %bb25 - -cond_true12: ; preds = %cond_true - %tmp16 = getelementptr [100 x [100 x i32]]* @T2, i32 0, i32 %tmp13, i32 %tj.01.0 ; <i32*> [#uses=1] - %tmp17 = load i32* %tmp16, align 4 ; <i32> [#uses=1] - %tmp19 = mul i32 %tmp18, %tmp17 ; <i32> [#uses=1] - %tmp21 = add i32 %tmp19, %T1.tmp.1 ; <i32> [#uses=1] - br label %bb25 - -bb25: ; preds = %cond_true12, %cond_true, %bb - %T1.tmp.0 = phi i32 [ %T1.tmp.1, %bb ], [ %T1.tmp.1, %cond_true ], [ %tmp21, %cond_true12 ] ; <i32> [#uses=2] - %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=2] - %exitcond = icmp ne i32 %indvar.next, %tmp6 ; <i1> [#uses=1] - br i1 %exitcond, label %bb, label %return.loopexit - -return.loopexit: ; preds = %bb25 - %T1.tmp.0.lcssa = phi i32 [ %T1.tmp.0, %bb25 ] ; <i32> [#uses=1] - store i32 %T1.tmp.0.lcssa, i32* @T1 - br label %return - -return: ; preds = %return.loopexit, %entry - ret void -} diff --git a/test/Transforms/LoopIndexSplit/OneIterLoop2-2007-08-17.ll b/test/Transforms/LoopIndexSplit/OneIterLoop2-2007-08-17.ll deleted file mode 100644 index ff73a5b..0000000 --- a/test/Transforms/LoopIndexSplit/OneIterLoop2-2007-08-17.ll +++ /dev/null @@ -1,69 +0,0 @@ -; Loop is elimianted. Save last value assignment. -; RUN: opt < %s -loop-index-split -disable-output -stats |& \ -; RUN: grep "loop-index-split" | count 1 - - %struct.anon = type { i32 } -@S1 = external global i32 ; <i32*> [#uses=1] -@W1 = external global i32 ; <i32*> [#uses=1] -@Y = weak global [100 x %struct.anon] zeroinitializer, align 32 ; <[100 x %struct.anon]*> [#uses=1] -@ti = external global i32 ; <i32*> [#uses=1] -@T2 = external global [100 x [100 x i32]] ; <[100 x [100 x i32]]*> [#uses=1] -@d = external global i32 ; <i32*> [#uses=1] -@T1 = external global i32 ; <i32*> [#uses=2] -@N1 = external global i32 ; <i32*> [#uses=2] - -define void @foo() { -entry: - %tmp = load i32* @S1, align 4 ; <i32> [#uses=4] - %tmp266 = load i32* @N1, align 4 ; <i32> [#uses=1] - %tmp288 = icmp ult i32 %tmp, %tmp266 ; <i1> [#uses=1] - br i1 %tmp288, label %bb.preheader, label %return - -bb.preheader: ; preds = %entry - %tmp1 = load i32* @W1, align 4 ; <i32> [#uses=1] - %tmp13 = load i32* @ti, align 4 ; <i32> [#uses=1] - %tmp18 = load i32* @d, align 4 ; <i32> [#uses=1] - %tmp26 = load i32* @N1, align 4 ; <i32> [#uses=2] - %T1.promoted = load i32* @T1 ; <i32> [#uses=1] - %tmp2 = add i32 %tmp, 1 ; <i32> [#uses=2] - %tmp4 = icmp ugt i32 %tmp2, %tmp26 ; <i1> [#uses=1] - %umax = select i1 %tmp4, i32 %tmp2, i32 %tmp26 ; <i32> [#uses=1] - %tmp5 = sub i32 0, %tmp ; <i32> [#uses=1] - %tmp6 = add i32 %umax, %tmp5 ; <i32> [#uses=1] - br label %bb - -bb: ; preds = %bb25, %bb.preheader - %indvar = phi i32 [ 0, %bb.preheader ], [ %indvar.next, %bb25 ] ; <i32> [#uses=2] - %T1.tmp.1 = phi i32 [ %T1.promoted, %bb.preheader ], [ %T1.tmp.0, %bb25 ] ; <i32> [#uses=3] - %tj.01.0 = add i32 %indvar, %tmp ; <i32> [#uses=3] - %tmp24 = add i32 %tj.01.0, 1 ; <i32> [#uses=1] - %tmp3 = icmp eq i32 %tmp24, %tmp1 ; <i1> [#uses=1] - br i1 %tmp3, label %cond_true, label %bb25 - -cond_true: ; preds = %bb - %tmp7 = getelementptr [100 x %struct.anon]* @Y, i32 0, i32 %tj.01.0, i32 0 ; <i32*> [#uses=1] - %tmp8 = load i32* %tmp7, align 4 ; <i32> [#uses=1] - %tmp9 = icmp sgt i32 %tmp8, 0 ; <i1> [#uses=1] - br i1 %tmp9, label %cond_true12, label %bb25 - -cond_true12: ; preds = %cond_true - %tmp16 = getelementptr [100 x [100 x i32]]* @T2, i32 0, i32 %tmp13, i32 %tj.01.0 ; <i32*> [#uses=1] - %tmp17 = load i32* %tmp16, align 4 ; <i32> [#uses=1] - %tmp19 = mul i32 %tmp18, %tmp17 ; <i32> [#uses=1] - %tmp21 = add i32 %tmp19, %T1.tmp.1 ; <i32> [#uses=1] - br label %bb25 - -bb25: ; preds = %cond_true12, %cond_true, %bb - %T1.tmp.0 = phi i32 [ %T1.tmp.1, %bb ], [ %T1.tmp.1, %cond_true ], [ %tmp21, %cond_true12 ] ; <i32> [#uses=2] - %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=2] - %exitcond = icmp ne i32 %indvar.next, %tmp6 ; <i1> [#uses=1] - br i1 %exitcond, label %bb, label %return.loopexit - -return.loopexit: ; preds = %bb25 - %T1.tmp.0.lcssa = phi i32 [ %T1.tmp.0, %bb25 ] ; <i32> [#uses=1] - store i32 %T1.tmp.0.lcssa, i32* @T1 - br label %return - -return: ; preds = %return.loopexit, %entry - ret void -} diff --git a/test/Transforms/LoopIndexSplit/OneIterLoop3-2007-08-17.ll b/test/Transforms/LoopIndexSplit/OneIterLoop3-2007-08-17.ll deleted file mode 100644 index 6adb268..0000000 --- a/test/Transforms/LoopIndexSplit/OneIterLoop3-2007-08-17.ll +++ /dev/null @@ -1,34 +0,0 @@ -; Loop is elimianted. Save last value assignments, including induction variable. -; RUN: opt < %s -loop-index-split -disable-output -stats | not grep "loop-index-split" - -declare i32 @foo(i32) -declare i32 @bar(i32, i32) - -define void @foobar(i32 %a, i32 %b) { -entry: - br label %bb - -bb: ; preds = %cond_next, %entry - %i.01.0 = phi i32 [ 0, %entry ], [ %tmp8, %cond_next ] ; <i32> [#uses=3] - %tsum.16.0 = phi i32 [ 42, %entry ], [ %tsum.0, %cond_next ] ; <i32> [#uses=2] - %tmp1 = icmp eq i32 %i.01.0, 50 ; <i1> [#uses=1] - br i1 %tmp1, label %cond_true, label %cond_next - -cond_true: ; preds = %bb - %tmp4 = tail call i32 @foo( i32 %i.01.0 ) ; <i32> [#uses=1] - %tmp6 = add i32 %tmp4, %tsum.16.0 ; <i32> [#uses=1] - br label %cond_next - -cond_next: ; preds = %bb, %cond_true - %tsum.0 = phi i32 [ %tmp6, %cond_true ], [ %tsum.16.0, %bb ] ; <i32> [#uses=2] - %tmp8 = add i32 %i.01.0, 1 ; <i32> [#uses=3] - %tmp11 = icmp slt i32 %tmp8, 100 ; <i1> [#uses=1] - br i1 %tmp11, label %bb, label %bb14 - -bb14: ; preds = %cond_next - %tmp8.lcssa = phi i32 [ %tmp8, %cond_next ] ; <i32> [#uses=1] - %tsum.0.lcssa = phi i32 [ %tsum.0, %cond_next ] ; <i32> [#uses=1] - %tmp17 = tail call i32 @bar( i32 %tmp8.lcssa, i32 %tsum.0.lcssa ) ; <i32> [#uses=0] - ret void -} - diff --git a/test/Transforms/LoopIndexSplit/PR3913.ll b/test/Transforms/LoopIndexSplit/PR3913.ll deleted file mode 100644 index a2bf57c..0000000 --- a/test/Transforms/LoopIndexSplit/PR3913.ll +++ /dev/null @@ -1,24 +0,0 @@ -; RUN: opt < %s -loop-index-split -S | not grep "icmp ne" - -define i32 @main() { -entry: - br label %header - -header: - %r = phi i32 [ 0, %entry ], [ %r3, %skip ] - %i = phi i32 [ 0, %entry ], [ %i1, %skip ] - %cond = icmp eq i32 %i, 99 - br i1 %cond, label %body, label %skip - -body: - br label %skip - -skip: - %r3 = phi i32 [ %r, %header ], [ 3, %body ] - %i1 = add i32 %i, 1 - %exitcond = icmp eq i32 %i1, 10 - br i1 %exitcond, label %exit, label %header - -exit: - ret i32 %r3 -} diff --git a/test/Transforms/LoopIndexSplit/PR4174-2.ll b/test/Transforms/LoopIndexSplit/PR4174-2.ll deleted file mode 100644 index cc17bc0..0000000 --- a/test/Transforms/LoopIndexSplit/PR4174-2.ll +++ /dev/null @@ -1,38 +0,0 @@ -; RUN: llvm-as < %s | opt -loop-index-split | llvm-dis | not grep clone - -declare void @f() - -define fastcc i32 @main() nounwind { -entry: - br label %bb1552 - -bb1552: - %j295.0.reg2mem.0 = phi i32 [ %storemerge110, %bb1669 ], [ 0, %entry ] - br label %bb1553 - -bb1553: - call void @f() - %tmp1628 = icmp sgt i32 %j295.0.reg2mem.0, -3 - br i1 %tmp1628, label %bb1588, label %bb1616 - -bb1588: - br label %bb1616 - -bb1616: - %tmp1629 = icmp sgt i32 %j295.0.reg2mem.0, -3 - br i1 %tmp1629, label %bb1649, label %bb1632 - -bb1632: - br label %bb1669 - -bb1649: - br label %bb1669 - -bb1669: - %storemerge110 = add i32 %j295.0.reg2mem.0, 1 - %tmp1672 = icmp sgt i32 %storemerge110, 3 - br i1 %tmp1672, label %bb1678, label %bb1552 - -bb1678: - ret i32 0 -} diff --git a/test/Transforms/LoopIndexSplit/PR4174.ll b/test/Transforms/LoopIndexSplit/PR4174.ll deleted file mode 100644 index e8f5a73..0000000 --- a/test/Transforms/LoopIndexSplit/PR4174.ll +++ /dev/null @@ -1,23 +0,0 @@ -; RUN: llvm-as < %s | opt -loop-index-split | llvm-dis | not grep clone - -declare void @f() - -define i32 @main() { -entry: - br label %head -head: - %i = phi i32 [0, %entry], [%i1, %tail] - call void @f() - %splitcond = icmp slt i32 %i, 2 - br i1 %splitcond, label %yes, label %no -yes: - br label %tail -no: - br label %tail -tail: - %i1 = add i32 %i, 1 - %exitcond = icmp slt i32 %i1, 4 - br i1 %exitcond, label %head, label %exit -exit: - ret i32 0 -} diff --git a/test/Transforms/LoopIndexSplit/SaveLastValue-2007-08-17.ll b/test/Transforms/LoopIndexSplit/SaveLastValue-2007-08-17.ll deleted file mode 100644 index fc7d9e9..0000000 --- a/test/Transforms/LoopIndexSplit/SaveLastValue-2007-08-17.ll +++ /dev/null @@ -1,52 +0,0 @@ -; Split loop. Save last value. -; RUN: opt < %s -loop-index-split -disable-output -stats |& \ -; RUN: grep "loop-index-split" | count 1 - -@k = external global i32 ; <i32*> [#uses=2] - -define void @foobar(i32 %a, i32 %b) { -entry: - br label %bb - -bb: ; preds = %cond_next16, %entry - %i.01.0 = phi i32 [ 0, %entry ], [ %tmp18, %cond_next16 ] ; <i32> [#uses=5] - %tsum.18.0 = phi i32 [ 42, %entry ], [ %tsum.013.1, %cond_next16 ] ; <i32> [#uses=3] - %tmp1 = icmp slt i32 %i.01.0, 50 ; <i1> [#uses=1] - br i1 %tmp1, label %cond_true, label %cond_false - -cond_true: ; preds = %bb - %tmp4 = tail call i32 @foo( i32 %i.01.0 ) ; <i32> [#uses=1] - %tmp6 = add i32 %tmp4, %tsum.18.0 ; <i32> [#uses=2] - %tmp914 = load i32* @k, align 4 ; <i32> [#uses=1] - %tmp1015 = icmp eq i32 %tmp914, 0 ; <i1> [#uses=1] - br i1 %tmp1015, label %cond_next16, label %cond_true13 - -cond_false: ; preds = %bb - %tmp8 = tail call i32 @bar( i32 %i.01.0 ) ; <i32> [#uses=0] - %tmp9 = load i32* @k, align 4 ; <i32> [#uses=1] - %tmp10 = icmp eq i32 %tmp9, 0 ; <i1> [#uses=1] - br i1 %tmp10, label %cond_next16, label %cond_true13 - -cond_true13: ; preds = %cond_false, %cond_true - %tsum.013.0 = phi i32 [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false ] ; <i32> [#uses=1] - %tmp15 = tail call i32 @bar( i32 %i.01.0 ) ; <i32> [#uses=0] - br label %cond_next16 - -cond_next16: ; preds = %cond_false, %cond_true, %cond_true13 - %tsum.013.1 = phi i32 [ %tsum.013.0, %cond_true13 ], [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false ] ; <i32> [#uses=2] - %tmp18 = add i32 %i.01.0, 1 ; <i32> [#uses=3] - %tmp21 = icmp slt i32 %tmp18, 100 ; <i1> [#uses=1] - br i1 %tmp21, label %bb, label %bb24 - -bb24: ; preds = %cond_next16 - %tmp18.lcssa = phi i32 [ %tmp18, %cond_next16 ] ; <i32> [#uses=1] - %tsum.013.1.lcssa = phi i32 [ %tsum.013.1, %cond_next16 ] ; <i32> [#uses=1] - %tmp27 = tail call i32 @t( i32 %tmp18.lcssa, i32 %tsum.013.1.lcssa ) ; <i32> [#uses=0] - ret void -} - -declare i32 @foo(i32) - -declare i32 @bar(i32) - -declare i32 @t(i32, i32) diff --git a/test/Transforms/LoopIndexSplit/SplitValue-2007-08-24.ll b/test/Transforms/LoopIndexSplit/SplitValue-2007-08-24.ll deleted file mode 100644 index f61d967..0000000 --- a/test/Transforms/LoopIndexSplit/SplitValue-2007-08-24.ll +++ /dev/null @@ -1,52 +0,0 @@ -; Split loop. Save last value. Split value is off by one in this example. -; RUN: opt < %s -loop-index-split -disable-output -stats |& \ -; RUN: grep "loop-index-split" | count 1 - -@k = external global i32 ; <i32*> [#uses=2] - -define void @foobar(i32 %a, i32 %b) { -entry: - br label %bb - -bb: ; preds = %cond_next16, %entry - %i.01.0 = phi i32 [ 0, %entry ], [ %tmp18, %cond_next16 ] ; <i32> [#uses=5] - %tsum.18.0 = phi i32 [ 42, %entry ], [ %tsum.013.1, %cond_next16 ] ; <i32> [#uses=3] - %tmp1 = icmp sgt i32 %i.01.0, 50 ; <i1> [#uses=1] - br i1 %tmp1, label %cond_true, label %cond_false - -cond_true: ; preds = %bb - %tmp4 = tail call i32 @foo( i32 %i.01.0 ) ; <i32> [#uses=1] - %tmp6 = add i32 %tmp4, %tsum.18.0 ; <i32> [#uses=2] - %tmp914 = load i32* @k, align 4 ; <i32> [#uses=1] - %tmp1015 = icmp eq i32 %tmp914, 0 ; <i1> [#uses=1] - br i1 %tmp1015, label %cond_next16, label %cond_true13 - -cond_false: ; preds = %bb - %tmp8 = tail call i32 @bar( i32 %i.01.0 ) ; <i32> [#uses=0] - %tmp9 = load i32* @k, align 4 ; <i32> [#uses=1] - %tmp10 = icmp eq i32 %tmp9, 0 ; <i1> [#uses=1] - br i1 %tmp10, label %cond_next16, label %cond_true13 - -cond_true13: ; preds = %cond_false, %cond_true - %tsum.013.0 = phi i32 [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false ] ; <i32> [#uses=1] - %tmp15 = tail call i32 @bar( i32 %i.01.0 ) ; <i32> [#uses=0] - br label %cond_next16 - -cond_next16: ; preds = %cond_false, %cond_true, %cond_true13 - %tsum.013.1 = phi i32 [ %tsum.013.0, %cond_true13 ], [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false ] ; <i32> [#uses=2] - %tmp18 = add i32 %i.01.0, 1 ; <i32> [#uses=3] - %tmp21 = icmp slt i32 %tmp18, 100 ; <i1> [#uses=1] - br i1 %tmp21, label %bb, label %bb24 - -bb24: ; preds = %cond_next16 - %tmp18.lcssa = phi i32 [ %tmp18, %cond_next16 ] ; <i32> [#uses=1] - %tsum.013.1.lcssa = phi i32 [ %tsum.013.1, %cond_next16 ] ; <i32> [#uses=1] - %tmp27 = tail call i32 @t( i32 %tmp18.lcssa, i32 %tsum.013.1.lcssa ) ; <i32> [#uses=0] - ret void -} - -declare i32 @foo(i32) - -declare i32 @bar(i32) - -declare i32 @t(i32, i32) diff --git a/test/Transforms/LoopIndexSplit/UpperBound-2007-08-24.ll b/test/Transforms/LoopIndexSplit/UpperBound-2007-08-24.ll deleted file mode 100644 index 17f75d7..0000000 --- a/test/Transforms/LoopIndexSplit/UpperBound-2007-08-24.ll +++ /dev/null @@ -1,52 +0,0 @@ -; Split loop. Split value is a constant and greater then exit value. -; Check whether optimizer inserts proper checkfor split value or not. -; RUN: opt < %s -loop-index-split -S | grep select - -@k = external global i32 ; <i32*> [#uses=2] - -define void @foobar(i32 %a, i32 %b) { -entry: - br label %bb - -bb: ; preds = %cond_next16, %entry - %i.01.0 = phi i32 [ 0, %entry ], [ %tmp18, %cond_next16 ] ; <i32> [#uses=5] - %tsum.18.0 = phi i32 [ 42, %entry ], [ %tsum.013.1, %cond_next16 ] ; <i32> [#uses=3] - %tmp1 = icmp slt i32 %i.01.0, 500 ; <i1> [#uses=1] - br i1 %tmp1, label %cond_true, label %cond_false - -cond_true: ; preds = %bb - %tmp4 = tail call i32 @foo( i32 %i.01.0 ) ; <i32> [#uses=1] - %tmp6 = add i32 %tmp4, %tsum.18.0 ; <i32> [#uses=2] - %tmp914 = load i32* @k, align 4 ; <i32> [#uses=1] - %tmp1015 = icmp eq i32 %tmp914, 0 ; <i1> [#uses=1] - br i1 %tmp1015, label %cond_next16, label %cond_true13 - -cond_false: ; preds = %bb - %tmp8 = tail call i32 @bar( i32 %i.01.0 ) ; <i32> [#uses=0] - %tmp9 = load i32* @k, align 4 ; <i32> [#uses=1] - %tmp10 = icmp eq i32 %tmp9, 0 ; <i1> [#uses=1] - br i1 %tmp10, label %cond_next16, label %cond_true13 - -cond_true13: ; preds = %cond_false, %cond_true - %tsum.013.0 = phi i32 [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false ] ; <i32> [#uses=1] - %tmp15 = tail call i32 @bar( i32 %i.01.0 ) ; <i32> [#uses=0] - br label %cond_next16 - -cond_next16: ; preds = %cond_false, %cond_true, %cond_true13 - %tsum.013.1 = phi i32 [ %tsum.013.0, %cond_true13 ], [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false ] ; <i32> [#uses=2] - %tmp18 = add i32 %i.01.0, 1 ; <i32> [#uses=3] - %tmp21 = icmp slt i32 %tmp18, 100 ; <i1> [#uses=1] - br i1 %tmp21, label %bb, label %bb24 - -bb24: ; preds = %cond_next16 - %tmp18.lcssa = phi i32 [ %tmp18, %cond_next16 ] ; <i32> [#uses=1] - %tsum.013.1.lcssa = phi i32 [ %tsum.013.1, %cond_next16 ] ; <i32> [#uses=1] - %tmp27 = tail call i32 @t( i32 %tmp18.lcssa, i32 %tsum.013.1.lcssa ) ; <i32> [#uses=0] - ret void -} - -declare i32 @foo(i32) - -declare i32 @bar(i32) - -declare i32 @t(i32, i32) diff --git a/test/Transforms/LoopIndexSplit/dg.exp b/test/Transforms/LoopIndexSplit/dg.exp deleted file mode 100644 index f200589..0000000 --- a/test/Transforms/LoopIndexSplit/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm.exp - -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]] diff --git a/test/Transforms/LoopIndexSplit/non-iv-cmp-operand.ll b/test/Transforms/LoopIndexSplit/non-iv-cmp-operand.ll deleted file mode 100644 index 6eed981..0000000 --- a/test/Transforms/LoopIndexSplit/non-iv-cmp-operand.ll +++ /dev/null @@ -1,195 +0,0 @@ -; RUN: opt < %s -inline -reassociate -loop-rotate -loop-index-split -indvars -simplifycfg -verify -; PR4471 - -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" - %struct.CUMULATIVE_ARGS = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 } - %struct.VEC_basic_block_base = type { i32, i32, [1 x %struct.basic_block_def*] } - %struct.VEC_basic_block_gc = type { %struct.VEC_basic_block_base } - %struct.VEC_edge_base = type { i32, i32, [1 x %struct.edge_def*] } - %struct.VEC_edge_gc = type { %struct.VEC_edge_base } - %struct.VEC_rtx_base = type { i32, i32, [1 x %struct.rtx_def*] } - %struct.VEC_rtx_gc = type { %struct.VEC_rtx_base } - %struct.VEC_temp_slot_p_base = type { i32, i32, [1 x %struct.temp_slot*] } - %struct.VEC_temp_slot_p_gc = type { %struct.VEC_temp_slot_p_base } - %struct.VEC_tree_base = type { i32, i32, [1 x %struct.tree_node*] } - %struct.VEC_tree_gc = type { %struct.VEC_tree_base } - %struct.__sbuf = type { i8*, i32 } - %struct._obstack_chunk = type { i8*, %struct._obstack_chunk*, [4 x i8] } - %struct.basic_block_def = type { %struct.tree_node*, %struct.VEC_edge_gc*, %struct.VEC_edge_gc*, i8*, %struct.loop*, [2 x %struct.et_node*], %struct.basic_block_def*, %struct.basic_block_def*, %struct.basic_block_il_dependent, %struct.tree_node*, %struct.edge_prediction*, i64, i32, i32, i32, i32 } - %struct.basic_block_il_dependent = type { %struct.rtl_bb_info* } - %struct.bitmap_element_def = type { %struct.bitmap_element_def*, %struct.bitmap_element_def*, i32, [2 x i64] } - %struct.bitmap_head_def = type { %struct.bitmap_element_def*, %struct.bitmap_element_def*, i32, %struct.bitmap_obstack* } - %struct.bitmap_obstack = type { %struct.bitmap_element_def*, %struct.bitmap_head_def*, %struct.obstack } - %struct.block_symbol = type { [3 x %struct.rtunion], %struct.object_block*, i64 } - %struct.case_node = type { %struct.case_node*, %struct.case_node*, %struct.case_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node* } - %struct.control_flow_graph = type { %struct.basic_block_def*, %struct.basic_block_def*, %struct.VEC_basic_block_gc*, i32, i32, i32, %struct.VEC_basic_block_gc*, i32 } - %struct.edge_def = type { %struct.basic_block_def*, %struct.basic_block_def*, %struct.edge_def_insns, i8*, %struct.__sbuf*, i32, i32, i64, i32 } - %struct.edge_def_insns = type { %struct.rtx_def* } - %struct.edge_prediction = type opaque - %struct.eh_status = type opaque - %struct.emit_status = type { i32, i32, %struct.rtx_def*, %struct.rtx_def*, %struct.sequence_stack*, i32, %struct.__sbuf, i32, i8*, %struct.rtx_def** } - %struct.et_node = type opaque - %struct.expr_status = type { i32, i32, i32, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def* } - %struct.function = type { %struct.eh_status*, %struct.expr_status*, %struct.emit_status*, %struct.varasm_status*, %struct.control_flow_graph*, %struct.tree_node*, %struct.function*, i32, i32, i32, i32, %struct.rtx_def*, %struct.CUMULATIVE_ARGS, %struct.rtx_def*, %struct.rtx_def*, %struct.initial_value_struct*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, i64, %struct.tree_node*, %struct.tree_node*, %struct.rtx_def*, %struct.VEC_temp_slot_p_gc*, %struct.temp_slot*, %struct.var_refs_queue*, i32, i32, i32, i32, %struct.machine_function*, i32, i32, %struct.language_function*, %struct.htab*, %struct.rtx_def*, i32, i32, %struct.__sbuf, %struct.VEC_tree_gc*, %struct.tree_node*, i8*, i8*, i8*, i8*, i8*, %struct.tree_node*, i8, i8, i8, i8, i8 } - %struct.htab = type { i32 (i8*)*, i32 (i8*, i8*)*, void (i8*)*, i8**, i64, i64, i64, i32, i32, i8* (i64, i64)*, void (i8*)*, i8*, i8* (i8*, i64, i64)*, void (i8*, i8*)*, i32 } - %struct.initial_value_struct = type opaque - %struct.lang_decl = type opaque - %struct.language_function = type opaque - %struct.loop = type opaque - %struct.machine_function = type { %struct.stack_local_entry*, i8*, %struct.rtx_def*, i32, i32, [4 x i32], i32, i32, i32 } - %struct.object_block = type { %struct.section*, i32, i64, %struct.VEC_rtx_gc*, %struct.VEC_rtx_gc* } - %struct.obstack = type { i64, %struct._obstack_chunk*, i8*, i8*, i8*, i64, i32, %struct._obstack_chunk* (i8*, i64)*, void (i8*, %struct._obstack_chunk*)*, i8*, i8 } - %struct.omp_clause_subcode = type { i32 } - %struct.rtl_bb_info = type { %struct.rtx_def*, %struct.rtx_def*, %struct.bitmap_head_def*, %struct.bitmap_head_def*, %struct.rtx_def*, %struct.rtx_def*, i32 } - %struct.rtunion = type { i8* } - %struct.rtx_def = type { i16, i8, i8, %struct.u } - %struct.section = type { %struct.unnamed_section } - %struct.sequence_stack = type { %struct.rtx_def*, %struct.rtx_def*, %struct.sequence_stack* } - %struct.stack_local_entry = type opaque - %struct.temp_slot = type opaque - %struct.tree_common = type { %struct.tree_node*, %struct.tree_node*, %union.tree_ann_d*, i8, i8, i8, i8 } - %struct.tree_decl_common = type { %struct.tree_decl_minimal, %struct.tree_node*, i8, i8, i8, i8, %struct.tree_decl_u1, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, i64, %struct.lang_decl* } - %struct.tree_decl_minimal = type { %struct.tree_common, %struct.__sbuf, i32, %struct.tree_node*, %struct.tree_node* } - %struct.tree_decl_non_common = type { %struct.tree_decl_with_vis, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node* } - %struct.tree_decl_u1 = type { i64 } - %struct.tree_decl_with_rtl = type { %struct.tree_decl_common, %struct.rtx_def* } - %struct.tree_decl_with_vis = type { %struct.tree_decl_with_rtl, %struct.tree_node*, %struct.tree_node*, i8, i8, i8 } - %struct.tree_function_decl = type { %struct.tree_decl_non_common, i8, i8, %struct.function* } - %struct.tree_node = type { %struct.tree_function_decl } - %struct.u = type { %struct.block_symbol } - %struct.unnamed_section = type { %struct.omp_clause_subcode, void (i8*)*, i8*, %struct.section* } - %struct.var_refs_queue = type { %struct.rtx_def*, i32, i32, %struct.var_refs_queue* } - %struct.varasm_status = type opaque - %union.tree_ann_d = type opaque - -define void @emit_case_bit_tests(%struct.tree_node* %index_type, %struct.tree_node* %index_expr, %struct.tree_node* %minval, %struct.tree_node* %range, %struct.case_node* %nodes, %struct.rtx_def* %default_label) nounwind { -entry: - br label %bb17 - -bb: ; preds = %bb17 - %0 = call i64 @tree_low_cst(%struct.tree_node* undef, i32 1) nounwind ; <i64> [#uses=1] - %1 = trunc i64 %0 to i32 ; <i32> [#uses=1] - br label %bb15 - -bb10: ; preds = %bb15 - %2 = icmp ugt i32 %j.0, 63 ; <i1> [#uses=1] - br i1 %2, label %bb11, label %bb12 - -bb11: ; preds = %bb10 - %3 = zext i32 0 to i64 ; <i64> [#uses=0] - br label %bb14 - -bb12: ; preds = %bb10 - %4 = or i64 undef, undef ; <i64> [#uses=0] - br label %bb14 - -bb14: ; preds = %bb12, %bb11 - %5 = add i32 %j.0, 1 ; <i32> [#uses=1] - br label %bb15 - -bb15: ; preds = %bb14, %bb - %j.0 = phi i32 [ %1, %bb ], [ %5, %bb14 ] ; <i32> [#uses=3] - %6 = icmp ugt i32 %j.0, undef ; <i1> [#uses=1] - br i1 %6, label %bb16, label %bb10 - -bb16: ; preds = %bb15 - br label %bb17 - -bb17: ; preds = %bb16, %entry - br i1 undef, label %bb18, label %bb - -bb18: ; preds = %bb17 - unreachable -} - -declare i64 @tree_low_cst(%struct.tree_node*, i32) - -define void @expand_case(%struct.tree_node* %exp) nounwind { -entry: - br i1 undef, label %bb2, label %bb - -bb: ; preds = %entry - unreachable - -bb2: ; preds = %entry - br i1 undef, label %bb3, label %bb4 - -bb3: ; preds = %bb2 - unreachable - -bb4: ; preds = %bb2 - br i1 undef, label %bb127, label %bb5 - -bb5: ; preds = %bb4 - br i1 undef, label %bb6, label %bb7 - -bb6: ; preds = %bb5 - unreachable - -bb7: ; preds = %bb5 - br i1 undef, label %bb9, label %bb8 - -bb8: ; preds = %bb7 - unreachable - -bb9: ; preds = %bb7 - br i1 undef, label %bb11, label %bb10 - -bb10: ; preds = %bb9 - unreachable - -bb11: ; preds = %bb9 - br i1 undef, label %bb37, label %bb21 - -bb21: ; preds = %bb11 - unreachable - -bb37: ; preds = %bb11 - br i1 undef, label %bb38, label %bb39 - -bb38: ; preds = %bb37 - ret void - -bb39: ; preds = %bb37 - br i1 undef, label %bb59, label %bb40 - -bb40: ; preds = %bb39 - br i1 undef, label %bb41, label %bb59 - -bb41: ; preds = %bb40 - br i1 undef, label %bb42, label %bb59 - -bb42: ; preds = %bb41 - br i1 undef, label %bb43, label %bb59 - -bb43: ; preds = %bb42 - br i1 undef, label %bb59, label %bb44 - -bb44: ; preds = %bb43 - br i1 undef, label %bb56, label %bb58 - -bb56: ; preds = %bb44 - unreachable - -bb58: ; preds = %bb44 - call void @emit_case_bit_tests(%struct.tree_node* undef, %struct.tree_node* undef, %struct.tree_node* null, %struct.tree_node* undef, %struct.case_node* undef, %struct.rtx_def* undef) nounwind - br i1 undef, label %bb126, label %bb125 - -bb59: ; preds = %bb43, %bb42, %bb41, %bb40, %bb39 - br i1 undef, label %bb70, label %bb60 - -bb60: ; preds = %bb59 - unreachable - -bb70: ; preds = %bb59 - unreachable - -bb125: ; preds = %bb58 - unreachable - -bb126: ; preds = %bb58 - unreachable - -bb127: ; preds = %bb4 - ret void -} diff --git a/test/Transforms/LoopRotate/basic.ll b/test/Transforms/LoopRotate/basic.ll new file mode 100644 index 0000000..b7bcb21 --- /dev/null +++ b/test/Transforms/LoopRotate/basic.ll @@ -0,0 +1,35 @@ +; RUN: opt -S -loop-rotate %s | FileCheck %s +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-n8:16:32:64" +target triple = "x86_64-apple-darwin10.0.0" + +; PR5319 - The "arrayidx" gep should be hoisted, not duplicated. We should +; end up with one phi node. +define void @test1() nounwind ssp { +; CHECK: @test1 +entry: + %array = alloca [20 x i32], align 16 + br label %for.cond + +for.cond: ; preds = %for.body, %entry + %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] + %cmp = icmp slt i32 %i.0, 100 + %arrayidx = getelementptr inbounds [20 x i32]* %array, i64 0, i64 0 + br i1 %cmp, label %for.body, label %for.end + +; CHECK: for.body: +; CHECK-NEXT: phi i32 [ 0 +; CHECK-NEXT: store i32 0 + +for.body: ; preds = %for.cond + store i32 0, i32* %arrayidx, align 16 + %inc = add nsw i32 %i.0, 1 + br label %for.cond + +for.end: ; preds = %for.cond + %arrayidx.lcssa = phi i32* [ %arrayidx, %for.cond ] + call void @g(i32* %arrayidx.lcssa) nounwind + ret void +} + +declare void @g(i32*) + diff --git a/test/Transforms/LoopSimplify/preserve-scev.ll b/test/Transforms/LoopSimplify/preserve-scev.ll new file mode 100644 index 0000000..017a0d2 --- /dev/null +++ b/test/Transforms/LoopSimplify/preserve-scev.ll @@ -0,0 +1,50 @@ +; RUN: opt -S < %s -indvars | opt -analyze -iv-users | grep {%cmp = icmp slt i32} | grep {= \{%\\.ph,+,1\}<%for.cond>} +; PR8079 + +; LoopSimplify should invalidate indvars when splitting out the +; inner loop. + +@maxStat = external global i32 + +define i32 @test() nounwind { +entry: + br label %for.cond + +for.cond: ; preds = %if.then5, %if.end, %entry + %cuts.1 = phi i32 [ 0, %entry ], [ %inc, %if.then5 ], [ %cuts.1, %if.end ] + %0 = phi i32 [ 0, %entry ], [ %add, %if.end ], [ %add, %if.then5 ] + %add = add i32 %0, 1 + %cmp = icmp slt i32 %0, 1 + %tmp1 = load i32* @maxStat, align 4 + br i1 %cmp, label %for.body, label %for.cond14.preheader + +for.cond14.preheader: ; preds = %for.cond + %cmp1726 = icmp sgt i32 %tmp1, 0 + br i1 %cmp1726, label %for.body18, label %return + +for.body: ; preds = %for.cond + %cmp2 = icmp sgt i32 %tmp1, 100 + br i1 %cmp2, label %return, label %if.end + +if.end: ; preds = %for.body + %cmp4 = icmp sgt i32 %tmp1, -1 + br i1 %cmp4, label %if.then5, label %for.cond + +if.then5: ; preds = %if.end + call void @foo() nounwind + %inc = add i32 %cuts.1, 1 + br label %for.cond + +for.body18: ; preds = %for.body18, %for.cond14.preheader + %i13.027 = phi i32 [ %1, %for.body18 ], [ 0, %for.cond14.preheader ] + call void @foo() nounwind + %1 = add nsw i32 %i13.027, 1 + %tmp16 = load i32* @maxStat, align 4 + %cmp17 = icmp slt i32 %1, %tmp16 + br i1 %cmp17, label %for.body18, label %return + +return: ; preds = %for.body18, %for.body, %for.cond14.preheader + ret i32 0 +} + +declare void @foo() nounwind diff --git a/test/Transforms/LoopStrengthReduce/pr3571.ll b/test/Transforms/LoopStrengthReduce/pr3571.ll index 9ad27d5..a23e4db 100644 --- a/test/Transforms/LoopStrengthReduce/pr3571.ll +++ b/test/Transforms/LoopStrengthReduce/pr3571.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -loop-reduce | llvm-dis ; PR3571 -target triple = "i386-mingw32" +target triple = "i386-pc-mingw32" define void @_ZNK18qdesigner_internal10TreeWidget12drawBranchesEP8QPainterRK5QRectRK11QModelIndex() nounwind { entry: br label %_ZNK11QModelIndex7isValidEv.exit.i diff --git a/test/Transforms/LoopUnswitch/infinite-loop.ll b/test/Transforms/LoopUnswitch/infinite-loop.ll new file mode 100644 index 0000000..73391ca --- /dev/null +++ b/test/Transforms/LoopUnswitch/infinite-loop.ll @@ -0,0 +1,53 @@ +; RUN: opt -loop-unswitch -disable-output -stats -info-output-file - < %s | FileCheck --check-prefix=STATS %s +; RUN: opt -loop-unswitch -simplifycfg -S < %s | FileCheck %s +; PR5373 + +; Loop unswitching shouldn't trivially unswitch the true case of condition %a +; in the code here because it leads to an infinite loop. While this doesn't +; contain any instructions with side effects, it's still a kind of side effect. +; It can trivially unswitch on the false cas of condition %a though. + +; STATS: 2 loop-unswitch - Number of branches unswitched +; STATS: 1 loop-unswitch - Number of unswitches that are trivial + +; CHECK: @func_16 +; CHECK-NEXT: entry: +; CHECK-NEXT: br i1 %a, label %entry.split, label %abort0.split + +; CHECK: entry.split: +; CHECK-NEXT: br i1 %b, label %cond.end.us, label %abort1 + +; CHECK: cond.end.us: +; CHECK-NEXT: br label %cond.end.us + +; CHECK: abort0.split: +; CHECK-NEXT: call void @end0() noreturn nounwind +; CHECK-NEXT: unreachable + +; CHECK: abort1: +; CHECK-NEXT: call void @end1() noreturn nounwind +; CHECK-NEXT: unreachable + +; CHECK: } + +define void @func_16(i1 %a, i1 %b) nounwind { +entry: + br label %for.body + +for.body: + br i1 %a, label %cond.end, label %abort0 + +cond.end: + br i1 %b, label %for.body, label %abort1 + +abort0: + call void @end0() noreturn nounwind + unreachable + +abort1: + call void @end1() noreturn nounwind + unreachable +} + +declare void @end0() noreturn +declare void @end1() noreturn diff --git a/test/Transforms/MemCpyOpt/2008-02-24-MultipleUseofSRet.ll b/test/Transforms/MemCpyOpt/2008-02-24-MultipleUseofSRet.ll index 30c2713..9f1e280 100644 --- a/test/Transforms/MemCpyOpt/2008-02-24-MultipleUseofSRet.ll +++ b/test/Transforms/MemCpyOpt/2008-02-24-MultipleUseofSRet.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -memcpyopt -dse -S | grep {call.*initialize} | not grep memtmp +; RUN: opt < %s -basicaa -memcpyopt -dse -S | grep {call.*initialize} | not grep memtmp ; PR2077 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:32:32" diff --git a/test/Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll b/test/Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll index 38a7271..418761e 100644 --- a/test/Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll +++ b/test/Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -memcpyopt -S | not grep {call.*memcpy.} +; RUN: opt < %s -basicaa -memcpyopt -S | not grep {call.*memcpy.} target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" %a = type { i32 } %b = type { float } diff --git a/test/Transforms/MemCpyOpt/loadstore-sret.ll b/test/Transforms/MemCpyOpt/loadstore-sret.ll new file mode 100644 index 0000000..67e7137 --- /dev/null +++ b/test/Transforms/MemCpyOpt/loadstore-sret.ll @@ -0,0 +1,25 @@ +; RUN: opt -S < %s -basicaa -memcpyopt | FileCheck %s +; <rdar://problem/8536696> + +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-n8:16:32:64" +target triple = "x86_64-apple-darwin10.0.0" + +%"class.std::auto_ptr" = type { i32* } + +; CHECK: @_Z3foov +define void @_Z3foov(%"class.std::auto_ptr"* noalias nocapture sret %agg.result) ssp { +_ZNSt8auto_ptrIiED1Ev.exit: + %temp.lvalue = alloca %"class.std::auto_ptr", align 8 +; CHECK: call void @_Z3barv(%"class.std::auto_ptr"* sret %agg.result) + call void @_Z3barv(%"class.std::auto_ptr"* sret %temp.lvalue) + %tmp.i.i = getelementptr inbounds %"class.std::auto_ptr"* %temp.lvalue, i64 0, i32 0 +; CHECK-NOT: load + %tmp2.i.i = load i32** %tmp.i.i, align 8 + %tmp.i.i4 = getelementptr inbounds %"class.std::auto_ptr"* %agg.result, i64 0, i32 0 +; CHECK-NOT: store + store i32* %tmp2.i.i, i32** %tmp.i.i4, align 8 +; CHECK: ret void + ret void +} + +declare void @_Z3barv(%"class.std::auto_ptr"* sret) diff --git a/test/Transforms/MemCpyOpt/memcpy.ll b/test/Transforms/MemCpyOpt/memcpy.ll index 724acfa..e4cd0ef 100644 --- a/test/Transforms/MemCpyOpt/memcpy.ll +++ b/test/Transforms/MemCpyOpt/memcpy.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -memcpyopt -dse -S | grep {call.*memcpy} | count 1 +; RUN: opt < %s -basicaa -memcpyopt -dse -S | grep {call.*memcpy} | count 1 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-darwin9" diff --git a/test/Transforms/MemCpyOpt/memmove.ll b/test/Transforms/MemCpyOpt/memmove.ll index 73bbf0b..8babb04 100644 --- a/test/Transforms/MemCpyOpt/memmove.ll +++ b/test/Transforms/MemCpyOpt/memmove.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -memcpyopt -S | FileCheck %s +; RUN: opt < %s -basicaa -memcpyopt -S | FileCheck %s ; These memmoves should get optimized to memcpys. 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" diff --git a/test/Transforms/MemCpyOpt/sret.ll b/test/Transforms/MemCpyOpt/sret.ll index 5002875..d35ab91 100644 --- a/test/Transforms/MemCpyOpt/sret.ll +++ b/test/Transforms/MemCpyOpt/sret.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -memcpyopt -S | not grep {call.*memcpy} +; RUN: opt < %s -basicaa -memcpyopt -S | not grep {call.*memcpy} 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-darwin9" diff --git a/test/Transforms/PartialSpecialize/heuristics.ll b/test/Transforms/PartialSpecialize/heuristics.ll new file mode 100644 index 0000000..5ccf9ad --- /dev/null +++ b/test/Transforms/PartialSpecialize/heuristics.ll @@ -0,0 +1,49 @@ +; If there are not enough callsites for a particular specialization to +; justify its existence, the specialization shouldn't be created. +; +; RUN: opt -S -partialspecialization -disable-inlining %s | FileCheck %s +declare void @callback1() +declare void @callback2() + +declare void @othercall() + +define internal void @UseCallback(void()* %pCallback) { + call void %pCallback() + call void @othercall() + call void @othercall() + call void @othercall() + call void @othercall() + call void @othercall() + call void @othercall() + call void @othercall() + call void @othercall() + call void @othercall() + call void @othercall() + call void @othercall() + call void @othercall() + call void @othercall() + call void @othercall() + call void @othercall() + call void @othercall() + call void @othercall() + call void @othercall() + ret void +} + +define void @foo(void()* %pNonConstCallback) +{ +Entry: +; CHECK: Entry +; CHECK-NOT: call void @UseCallback(void ()* @callback1) +; CHECK: call void @UseCallback(void ()* @callback2) +; CHECK-NEXT: call void @UseCallback(void ()* @callback2) +; CHECK-NEXT: ret void + call void @UseCallback(void()* @callback1) + call void @UseCallback(void()* @callback1) + call void @UseCallback(void()* @callback1) + call void @UseCallback(void()* @callback1) + call void @UseCallback(void()* @callback2) + call void @UseCallback(void()* @callback2) + + ret void +} diff --git a/test/Transforms/ScalarRepl/vector_promote.ll b/test/Transforms/ScalarRepl/vector_promote.ll index 4f875b0..fe55426 100644 --- a/test/Transforms/ScalarRepl/vector_promote.ll +++ b/test/Transforms/ScalarRepl/vector_promote.ll @@ -1,8 +1,8 @@ -; RUN: opt < %s -scalarrepl -S | not grep alloca -; RUN: opt < %s -scalarrepl -S | grep {load <4 x float>} +; RUN: opt < %s -scalarrepl -S | FileCheck %s target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" +target triple = "x86_64-apple-darwin10.0.0" -define void @test(<4 x float>* %F, float %f) { +define void @test1(<4 x float>* %F, float %f) { entry: %G = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=3] %tmp = load <4 x float>* %F ; <<4 x float>> [#uses=2] @@ -14,6 +14,11 @@ entry: %tmp6 = fadd <4 x float> %tmp4, %tmp4 ; <<4 x float>> [#uses=1] store <4 x float> %tmp6, <4 x float>* %F ret void +; CHECK: @test1 +; CHECK-NOT: alloca +; CHECK: %tmp = load <4 x float>* %F +; CHECK: fadd <4 x float> %tmp, %tmp +; CHECK-NEXT: insertelement <4 x float> %tmp3, float %f, i32 0 } define void @test2(<4 x float>* %F, float %f) { @@ -28,6 +33,11 @@ entry: %tmp6 = fadd <4 x float> %tmp4, %tmp4 ; <<4 x float>> [#uses=1] store <4 x float> %tmp6, <4 x float>* %F ret void +; CHECK: @test2 +; CHECK-NOT: alloca +; CHECK: %tmp = load <4 x float>* %F +; CHECK: fadd <4 x float> %tmp, %tmp +; CHECK-NEXT: insertelement <4 x float> %tmp3, float %f, i32 2 } define void @test3(<4 x float>* %F, float* %f) { @@ -40,6 +50,11 @@ entry: %tmp.upgrd.4 = load float* %tmp.upgrd.3 ; <float> [#uses=1] store float %tmp.upgrd.4, float* %f ret void +; CHECK: @test3 +; CHECK-NOT: alloca +; CHECK: %tmp = load <4 x float>* %F +; CHECK: fadd <4 x float> %tmp, %tmp +; CHECK-NEXT: extractelement <4 x float> %tmp3, i32 2 } define void @test4(<4 x float>* %F, float* %f) { @@ -52,6 +67,11 @@ entry: %tmp.upgrd.6 = load float* %G.upgrd.5 ; <float> [#uses=1] store float %tmp.upgrd.6, float* %f ret void +; CHECK: @test4 +; CHECK-NOT: alloca +; CHECK: %tmp = load <4 x float>* %F +; CHECK: fadd <4 x float> %tmp, %tmp +; CHECK-NEXT: extractelement <4 x float> %tmp3, i32 0 } define i32 @test5(float %X) { ;; should turn into bitcast. @@ -61,5 +81,22 @@ define i32 @test5(float %X) { ;; should turn into bitcast. %a = bitcast float* %X1 to i32* %tmp = load i32* %a ret i32 %tmp +; CHECK: @test5 +; CHECK-NEXT: bitcast float %X to i32 +; CHECK-NEXT: ret i32 +} + + +;; should not turn into <1 x i64> - It is a banned MMX datatype. +;; rdar://8380055 +define i64 @test6(<2 x float> %X) { + %X_addr = alloca <2 x float> + store <2 x float> %X, <2 x float>* %X_addr + %P = bitcast <2 x float>* %X_addr to i64* + %tmp = load i64* %P + ret i64 %tmp +; CHECK: @test6 +; CHECK-NEXT: bitcast <2 x float> %X to i64 +; CHECK-NEXT: ret i64 } diff --git a/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll b/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll index ba33d84..9c15efc 100644 --- a/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll +++ b/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -simplifycfg -disable-output ; PR2256 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-mingw32" +target triple = "x86_64-pc-mingw32" define { x86_fp80, x86_fp80 } @catanl({ x86_fp80, x86_fp80 }* byval %Z, i1 %cond) nounwind { bb: ; preds = %entry diff --git a/test/Transforms/SimplifyCFG/2010-10-24-OnlyUnwindInEntry.ll b/test/Transforms/SimplifyCFG/2010-10-24-OnlyUnwindInEntry.ll new file mode 100644 index 0000000..ebacf2f --- /dev/null +++ b/test/Transforms/SimplifyCFG/2010-10-24-OnlyUnwindInEntry.ll @@ -0,0 +1,6 @@ +; RUN: opt %s -simplifycfg -disable-output +; PR8445 + +define void @test() { + unwind +} diff --git a/test/Transforms/SimplifyCFG/speculate-with-offset.ll b/test/Transforms/SimplifyCFG/speculate-with-offset.ll new file mode 100644 index 0000000..a737d56 --- /dev/null +++ b/test/Transforms/SimplifyCFG/speculate-with-offset.ll @@ -0,0 +1,94 @@ +; RUN: opt -simplifycfg -S < %s | FileCheck %s + +; This load is safe to speculate, as it's from a safe offset +; within an alloca. + +; CHECK: @yes +; CHECK-NOT: br + +define void @yes(i1 %c) nounwind { +entry: + %a = alloca [4 x i64*], align 8 + %__a.addr = getelementptr [4 x i64*]* %a, i64 0, i64 3 + call void @frob(i64** %__a.addr) + br i1 %c, label %if.then, label %if.end + +if.then: ; preds = %entry + br label %return + +if.end: ; preds = %entry + %tmp5 = load i64** %__a.addr, align 8 + br label %return + +return: ; preds = %if.end, %if.then + %storemerge = phi i64* [ undef, %if.then ], [ %tmp5, %if.end ] + ret void +} + +; CHECK: @no0 +; CHECK: br i1 %c + +define void @no0(i1 %c) nounwind { +entry: + %a = alloca [4 x i64*], align 8 + %__a.addr = getelementptr [4 x i64*]* %a, i64 0, i64 4 + call void @frob(i64** %__a.addr) + br i1 %c, label %if.then, label %if.end + +if.then: ; preds = %entry + br label %return + +if.end: ; preds = %entry + %tmp5 = load i64** %__a.addr, align 8 + br label %return + +return: ; preds = %if.end, %if.then + %storemerge = phi i64* [ undef, %if.then ], [ %tmp5, %if.end ] + ret void +} + +; CHECK: @no1 +; CHECK: br i1 %c + +define void @no1(i1 %c, i64 %n) nounwind { +entry: + %a = alloca [4 x i64*], align 8 + %__a.addr = getelementptr [4 x i64*]* %a, i64 0, i64 %n + call void @frob(i64** %__a.addr) + br i1 %c, label %if.then, label %if.end + +if.then: ; preds = %entry + br label %return + +if.end: ; preds = %entry + %tmp5 = load i64** %__a.addr, align 8 + br label %return + +return: ; preds = %if.end, %if.then + %storemerge = phi i64* [ undef, %if.then ], [ %tmp5, %if.end ] + ret void +} + +; CHECK: @no2 +; CHECK: br i1 %c + +define void @no2(i1 %c, i64 %n) nounwind { +entry: + %a = alloca [4 x i64*], align 8 + %__a.addr = getelementptr [4 x i64*]* %a, i64 1, i64 0 + call void @frob(i64** %__a.addr) + br i1 %c, label %if.then, label %if.end + +if.then: ; preds = %entry + br label %return + +if.end: ; preds = %entry + %tmp5 = load i64** %__a.addr, align 8 + br label %return + +return: ; preds = %if.end, %if.then + %storemerge = phi i64* [ undef, %if.then ], [ %tmp5, %if.end ] + ret void +} + +declare void @frob(i64** nocapture %p) diff --git a/test/Transforms/SimplifyLibCalls/StrChr.ll b/test/Transforms/SimplifyLibCalls/StrChr.ll index 50ca0a6..eaabeb2 100644 --- a/test/Transforms/SimplifyLibCalls/StrChr.ll +++ b/test/Transforms/SimplifyLibCalls/StrChr.ll @@ -1,26 +1,26 @@ ; Test that the StrChrOptimizer works correctly -; RUN: opt < %s -simplify-libcalls -S | \ -; RUN: not grep {call.*@strchr} +; RUN: opt < %s -simplify-libcalls -S | FileCheck %s ; This transformation requires the pointer size, as it assumes that size_t is ; the size of a pointer. target datalayout = "-p:64:64:64" -@hello = constant [14 x i8] c"hello world\5Cn\00" ; <[14 x i8]*> [#uses=1] -@null = constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1] +@hello = constant [14 x i8] c"hello world\5Cn\00" +@null = constant [1 x i8] zeroinitializer declare i8* @strchr(i8*, i32) -declare i32 @puts(i8*) - -define i32 @main() { - %hello_p = getelementptr [14 x i8]* @hello, i32 0, i32 0 ; <i8*> [#uses=2] - %null_p = getelementptr [1 x i8]* @null, i32 0, i32 0 ; <i8*> [#uses=1] - %world = call i8* @strchr( i8* %hello_p, i32 119 ) ; <i8*> [#uses=1] - %ignore = call i8* @strchr( i8* %null_p, i32 119 ) ; <i8*> [#uses=0] - %len = call i32 @puts( i8* %world ) ; <i32> [#uses=1] - %index = add i32 %len, 112 ; <i32> [#uses=2] - %result = call i8* @strchr( i8* %hello_p, i32 %index ) ; <i8*> [#uses=0] +define i32 @foo(i32 %index) { + %hello_p = getelementptr [14 x i8]* @hello, i32 0, i32 0 + %null_p = getelementptr [1 x i8]* @null, i32 0, i32 0 + %world = call i8* @strchr(i8* %hello_p, i32 119) +; CHECK: getelementptr i8* %hello_p, i64 6 + %ignore = call i8* @strchr(i8* %null_p, i32 119) +; CHECK-NOT: call i8* strchr + %null = call i8* @strchr(i8* %hello_p, i32 0) +; CHECK: getelementptr i8* %hello_p, i64 13 + %result = call i8* @strchr(i8* %hello_p, i32 %index) +; CHECK: call i8* @memchr(i8* %hello_p, i32 %index, i64 14) ret i32 %index } diff --git a/test/Transforms/SimplifyLibCalls/StrPBrk.ll b/test/Transforms/SimplifyLibCalls/StrPBrk.ll new file mode 100644 index 0000000..29c3b74 --- /dev/null +++ b/test/Transforms/SimplifyLibCalls/StrPBrk.ll @@ -0,0 +1,25 @@ +; RUN: opt < %s -simplify-libcalls -S | FileCheck %s + +target datalayout = "-p:64:64:64" + +@hello = constant [12 x i8] c"hello world\00" +@w = constant [2 x i8] c"w\00" +@null = constant [1 x i8] zeroinitializer + +declare i8* @strpbrk(i8*, i8*) + +define void @test(i8* %s1, i8* %s2) { + %hello_p = getelementptr [12 x i8]* @hello, i32 0, i32 0 + %w_p = getelementptr [2 x i8]* @w, i32 0, i32 0 + %null_p = getelementptr [1 x i8]* @null, i32 0, i32 0 + %test1 = call i8* @strpbrk(i8* %null_p, i8* %s2) + %test2 = call i8* @strpbrk(i8* %s1, i8* %null_p) +; CHECK-NOT: call i8* @strpbrk + %test3 = call i8* @strpbrk(i8* %s1, i8* %w_p) +; CHECK: call i8* @strchr(i8* %s1, i32 119) + %test4 = call i8* @strpbrk(i8* %hello_p, i8* %w_p) +; CHECK: getelementptr i8* %hello_p, i64 6 + %test5 = call i8* @strpbrk(i8* %s1, i8* %s2) +; CHECK: call i8* @strpbrk(i8* %s1, i8* %s2) + ret void +} diff --git a/test/Transforms/SimplifyLibCalls/StrRChr.ll b/test/Transforms/SimplifyLibCalls/StrRChr.ll new file mode 100644 index 0000000..2259fc0 --- /dev/null +++ b/test/Transforms/SimplifyLibCalls/StrRChr.ll @@ -0,0 +1,23 @@ +; Test that the StrRChrOptimizer works correctly +; RUN: opt < %s -simplify-libcalls -S | FileCheck %s + +target datalayout = "-p:64:64:64" + +@hello = constant [14 x i8] c"hello world\5Cn\00" +@null = constant [1 x i8] zeroinitializer + +declare i8* @strrchr(i8*, i32) + +define void @foo(i8* %bar) { + %hello_p = getelementptr [14 x i8]* @hello, i32 0, i32 0 + %null_p = getelementptr [1 x i8]* @null, i32 0, i32 0 + %world = call i8* @strrchr(i8* %hello_p, i32 119) +; CHECK: getelementptr i8* %hello_p, i64 6 + %ignore = call i8* @strrchr(i8* %null_p, i32 119) +; CHECK-NOT: call i8* strrchr + %null = call i8* @strrchr(i8* %hello_p, i32 0) +; CHECK: getelementptr i8* %hello_p, i64 13 + %strchr = call i8* @strrchr(i8* %bar, i32 0) +; CHECK: call i8* @strchr(i8* %bar, i32 0) + ret void +} diff --git a/test/Transforms/SimplifyLibCalls/StrSpn.ll b/test/Transforms/SimplifyLibCalls/StrSpn.ll new file mode 100644 index 0000000..f77f32c --- /dev/null +++ b/test/Transforms/SimplifyLibCalls/StrSpn.ll @@ -0,0 +1,41 @@ +; RUN: opt < %s -simplify-libcalls -S | FileCheck %s + +target datalayout = "-p:64:64:64" + +@abcba = constant [6 x i8] c"abcba\00" +@abc = constant [4 x i8] c"abc\00" +@null = constant [1 x i8] zeroinitializer + +declare i64 @strspn(i8*, i8*) + +define i64 @testspn(i8* %s1, i8* %s2) { + %abcba_p = getelementptr [6 x i8]* @abcba, i32 0, i32 0 + %abc_p = getelementptr [4 x i8]* @abc, i32 0, i32 0 + %null_p = getelementptr [1 x i8]* @null, i32 0, i32 0 + %test1 = call i64 @strspn(i8* %s1, i8* %null_p) + %test2 = call i64 @strspn(i8* %null_p, i8* %s2) + %test3 = call i64 @strspn(i8* %abcba_p, i8* %abc_p) +; CHECK-NOT: call i64 @strspn + %test4 = call i64 @strspn(i8* %s1, i8* %s2) +; CHECK: call i64 @strspn(i8* %s1, i8* %s2) + ret i64 %test3 +; CHECK ret i64 5 +} + +declare i64 @strcspn(i8*, i8*) + +define i64 @testcspn(i8* %s1, i8* %s2) { + %abcba_p = getelementptr [6 x i8]* @abcba, i32 0, i32 0 + %abc_p = getelementptr [4 x i8]* @abc, i32 0, i32 0 + %null_p = getelementptr [1 x i8]* @null, i32 0, i32 0 + %test1 = call i64 @strcspn(i8* %s1, i8* %null_p) +; CHECK: call i64 @strlen(i8* %s1) + %test2 = call i64 @strcspn(i8* %null_p, i8* %s2) + %test3 = call i64 @strcspn(i8* %abcba_p, i8* %abc_p) +; CHECK-NOT: call i64 @strcspn + %test4 = call i64 @strcspn(i8* %s1, i8* %s2) +; CHECK: call i64 @strcspn(i8* %s1, i8* %s2) + %add0 = add i64 %test1, %test3 +; CHECK: add i64 %{{.+}}, 0 + ret i64 %add0 +} diff --git a/test/Transforms/SimplifyLibCalls/floor.ll b/test/Transforms/SimplifyLibCalls/floor.ll index a7af5a9..8780e32 100644 --- a/test/Transforms/SimplifyLibCalls/floor.ll +++ b/test/Transforms/SimplifyLibCalls/floor.ll @@ -29,6 +29,8 @@ define float @test_ceil(float %C) { ret float %F } +; PR8466 +; XFAIL: win32 define float @test_nearbyint(float %C) { %D = fpext float %C to double ; <double> [#uses=1] ; --> nearbyintf diff --git a/test/Transforms/Sink/basic.ll b/test/Transforms/Sink/basic.ll index beb9481..54b7f13 100644 --- a/test/Transforms/Sink/basic.ll +++ b/test/Transforms/Sink/basic.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -sink -S | FileCheck %s +; RUN: opt < %s -basicaa -sink -S | FileCheck %s @A = external global i32 @B = external global i32 diff --git a/test/Transforms/TailCallElim/accum_recursion.ll b/test/Transforms/TailCallElim/accum_recursion.ll index b2a9ed2..9475f87 100644 --- a/test/Transforms/TailCallElim/accum_recursion.ll +++ b/test/Transforms/TailCallElim/accum_recursion.ll @@ -1,15 +1,74 @@ -; RUN: opt < %s -tailcallelim -S | not grep call +; RUN: opt < %s -tailcallelim -S | FileCheck %s -define i32 @factorial(i32 %x) { +define i32 @test1_factorial(i32 %x) { entry: %tmp.1 = icmp sgt i32 %x, 0 ; <i1> [#uses=1] br i1 %tmp.1, label %then, label %else then: ; preds = %entry %tmp.6 = add i32 %x, -1 ; <i32> [#uses=1] - %tmp.4 = call i32 @factorial( i32 %tmp.6 ) ; <i32> [#uses=1] + %tmp.4 = call i32 @test1_factorial( i32 %tmp.6 ) ; <i32> [#uses=1] %tmp.7 = mul i32 %tmp.4, %x ; <i32> [#uses=1] ret i32 %tmp.7 else: ; preds = %entry ret i32 1 } +; CHECK: define i32 @test1_factorial +; CHECK: phi i32 +; CHECK-NOT: call i32 +; CHECK: else: + +; This is a more aggressive form of accumulator recursion insertion, which +; requires noticing that X doesn't change as we perform the tailcall. + +define i32 @test2_mul(i32 %x, i32 %y) { +entry: + %tmp.1 = icmp eq i32 %y, 0 ; <i1> [#uses=1] + br i1 %tmp.1, label %return, label %endif +endif: ; preds = %entry + %tmp.8 = add i32 %y, -1 ; <i32> [#uses=1] + %tmp.5 = call i32 @test2_mul( i32 %x, i32 %tmp.8 ) ; <i32> [#uses=1] + %tmp.9 = add i32 %tmp.5, %x ; <i32> [#uses=1] + ret i32 %tmp.9 +return: ; preds = %entry + ret i32 %x +} + +; CHECK: define i32 @test2_mul +; CHECK: phi i32 +; CHECK-NOT: call i32 +; CHECK: return: + + +define i64 @test3_fib(i64 %n) nounwind readnone { +; CHECK: @test3_fib +entry: +; CHECK: tailrecurse: +; CHECK: %accumulator.tr = phi i64 [ %n, %entry ], [ %3, %bb1 ] +; CHECK: %n.tr = phi i64 [ %n, %entry ], [ %2, %bb1 ] + switch i64 %n, label %bb1 [ +; CHECK: switch i64 %n.tr, label %bb1 [ + i64 0, label %bb2 + i64 1, label %bb2 + ] + +bb1: +; CHECK: bb1: + %0 = add i64 %n, -1 +; CHECK: %0 = add i64 %n.tr, -1 + %1 = tail call i64 @test3_fib(i64 %0) nounwind +; CHECK: %1 = tail call i64 @test3_fib(i64 %0) + %2 = add i64 %n, -2 +; CHECK: %2 = add i64 %n.tr, -2 + %3 = tail call i64 @test3_fib(i64 %2) nounwind +; CHECK-NOT: tail call i64 @test3_fib + %4 = add nsw i64 %3, %1 +; CHECK: add nsw i64 %accumulator.tr, %1 + ret i64 %4 +; CHECK: br label %tailrecurse + +bb2: +; CHECK: bb2: + ret i64 %n +; CHECK: ret i64 %accumulator.tr +} diff --git a/test/Transforms/TailCallElim/accum_recursion_constant_arg.ll b/test/Transforms/TailCallElim/accum_recursion_constant_arg.ll deleted file mode 100644 index 2a90cf3..0000000 --- a/test/Transforms/TailCallElim/accum_recursion_constant_arg.ll +++ /dev/null @@ -1,20 +0,0 @@ -; This is a more aggressive form of accumulator recursion insertion, which -; requires noticing that X doesn't change as we perform the tailcall. Thanks -; go out to the anonymous users of the demo script for "suggesting" -; optimizations that should be done. :) - -; RUN: opt < %s -tailcallelim -S | not grep call - -define i32 @mul(i32 %x, i32 %y) { -entry: - %tmp.1 = icmp eq i32 %y, 0 ; <i1> [#uses=1] - br i1 %tmp.1, label %return, label %endif -endif: ; preds = %entry - %tmp.8 = add i32 %y, -1 ; <i32> [#uses=1] - %tmp.5 = call i32 @mul( i32 %x, i32 %tmp.8 ) ; <i32> [#uses=1] - %tmp.9 = add i32 %tmp.5, %x ; <i32> [#uses=1] - ret i32 %tmp.9 -return: ; preds = %entry - ret i32 %x -} - diff --git a/test/Transforms/TailCallElim/switch.ll b/test/Transforms/TailCallElim/switch.ll deleted file mode 100644 index 3388431..0000000 --- a/test/Transforms/TailCallElim/switch.ll +++ /dev/null @@ -1,34 +0,0 @@ -; RUN: opt %s -tailcallelim -S | FileCheck %s - -define i64 @fib(i64 %n) nounwind readnone { -; CHECK: @fib -entry: -; CHECK: tailrecurse: -; CHECK: %accumulator.tr = phi i64 [ %n, %entry ], [ %3, %bb1 ] -; CHECK: %n.tr = phi i64 [ %n, %entry ], [ %2, %bb1 ] - switch i64 %n, label %bb1 [ -; CHECK: switch i64 %n.tr, label %bb1 [ - i64 0, label %bb2 - i64 1, label %bb2 - ] - -bb1: -; CHECK: bb1: - %0 = add i64 %n, -1 -; CHECK: %0 = add i64 %n.tr, -1 - %1 = tail call i64 @fib(i64 %0) nounwind -; CHECK: %1 = tail call i64 @fib(i64 %0) - %2 = add i64 %n, -2 -; CHECK: %2 = add i64 %n.tr, -2 - %3 = tail call i64 @fib(i64 %2) nounwind -; CHECK-NOT: tail call i64 @fib - %4 = add nsw i64 %3, %1 -; CHECK: add nsw i64 %accumulator.tr, %1 - ret i64 %4 -; CHECK: br label %tailrecurse - -bb2: -; CHECK: bb2: - ret i64 %n -; CHECK: ret i64 %accumulator.tr -} diff --git a/test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll b/test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll index 88a5656..03e99bc 100644 --- a/test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll +++ b/test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -tailduplicate -taildup-threshold=3 -stats -disable-output | not grep tailduplicate +; RUN: opt < %s -tailduplicate -taildup-threshold=3 -stats -disable-output |& not grep tailduplicate ; XFAIL: * define i32 @foo(i32 %l) nounwind { diff --git a/test/Transforms/ValuePropagation/phi.ll b/test/Transforms/ValuePropagation/phi.ll deleted file mode 100644 index f150876..0000000 --- a/test/Transforms/ValuePropagation/phi.ll +++ /dev/null @@ -1,17 +0,0 @@ -; RUN: opt < %s -value-propagation -S | FileCheck %s -; PR2581 - -; CHECK: @run -define i32 @run(i1 %C) nounwind { - br i1 %C, label %exit, label %body - -body: ; preds = %0 -; CHECK-NOT: select - %A = select i1 %C, i32 10, i32 11 ; <i32> [#uses=1] -; CHECK: ret i32 11 - ret i32 %A - -exit: ; preds = %0 -; CHECK: ret i32 10 - ret i32 10 -}
\ No newline at end of file diff --git a/test/Transforms/ValuePropagation/select.ll b/test/Transforms/ValuePropagation/select.ll deleted file mode 100644 index 02acc8f..0000000 --- a/test/Transforms/ValuePropagation/select.ll +++ /dev/null @@ -1,25 +0,0 @@ -; RUN: opt < %s -value-propagation -S | FileCheck %s -; PR4420 - -declare i1 @ext() -; CHECK: @foo -define i1 @foo() { -entry: - %cond = tail call i1 @ext() ; <i1> [#uses=2] - br i1 %cond, label %bb1, label %bb2 - -bb1: ; preds = %entry - %cond2 = tail call i1 @ext() ; <i1> [#uses=1] - br i1 %cond2, label %bb3, label %bb2 - -bb2: ; preds = %bb1, %entry -; CHECK-NOT: phi i1 - %cond_merge = phi i1 [ %cond, %entry ], [ false, %bb1 ] ; <i1> [#uses=1] -; CHECK: ret i1 false - ret i1 %cond_merge - -bb3: ; preds = %bb1 - %res = tail call i1 @ext() ; <i1> [#uses=1] -; CHECK: ret i1 %res - ret i1 %res -}
\ No newline at end of file |