diff options
Diffstat (limited to 'llvm/test/Transforms/LoopStrengthReduce')
125 files changed, 0 insertions, 10606 deletions
diff --git a/llvm/test/Transforms/LoopStrengthReduce/2005-08-15-AddRecIV.ll b/llvm/test/Transforms/LoopStrengthReduce/2005-08-15-AddRecIV.ll deleted file mode 100644 index 7ee1e63ced0..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/2005-08-15-AddRecIV.ll +++ /dev/null @@ -1,57 +0,0 @@ -; RUN: opt < %s -loop-reduce -disable-output - -define void @try_swap() { -entry: - br i1 false, label %cond_continue.0.i, label %cond_false.0.i -cond_false.0.i: ; preds = %entry - ret void -cond_continue.0.i: ; preds = %entry - br i1 false, label %cond_continue.1.i, label %cond_false.1.i -cond_false.1.i: ; preds = %cond_continue.0.i - ret void -cond_continue.1.i: ; preds = %cond_continue.0.i - br i1 false, label %endif.3.i, label %else.0.i -endif.3.i: ; preds = %cond_continue.1.i - br i1 false, label %my_irand.exit82, label %endif.0.i62 -else.0.i: ; preds = %cond_continue.1.i - ret void -endif.0.i62: ; preds = %endif.3.i - ret void -my_irand.exit82: ; preds = %endif.3.i - br i1 false, label %else.2, label %then.4 -then.4: ; preds = %my_irand.exit82 - ret void -else.2: ; preds = %my_irand.exit82 - br i1 false, label %find_affected_nets.exit, label %loopentry.1.i107.outer.preheader -loopentry.1.i107.outer.preheader: ; preds = %else.2 - ret void -find_affected_nets.exit: ; preds = %else.2 - br i1 false, label %save_region_occ.exit, label %loopentry.1 -save_region_occ.exit: ; preds = %find_affected_nets.exit - br i1 false, label %no_exit.1.preheader, label %loopexit.1 -loopentry.1: ; preds = %find_affected_nets.exit - ret void -no_exit.1.preheader: ; preds = %save_region_occ.exit - ret void -loopexit.1: ; preds = %save_region_occ.exit - br i1 false, label %then.10, label %loopentry.3 -then.10: ; preds = %loopexit.1 - ret void -loopentry.3: ; preds = %endif.16, %loopexit.1 - %indvar342 = phi i32 [ %indvar.next343, %endif.16 ], [ 0, %loopexit.1 ] ; <i32> [#uses=2] - br i1 false, label %loopexit.3, label %endif.16 -endif.16: ; preds = %loopentry.3 - %indvar.next343 = add i32 %indvar342, 1 ; <i32> [#uses=1] - br label %loopentry.3 -loopexit.3: ; preds = %loopentry.3 - br label %loopentry.4 -loopentry.4: ; preds = %loopentry.4, %loopexit.3 - %indvar340 = phi i32 [ 0, %loopexit.3 ], [ %indvar.next341, %loopentry.4 ] ; <i32> [#uses=2] - %tmp. = add i32 %indvar340, %indvar342 ; <i32> [#uses=1] - %tmp.526 = load i32*, i32** null ; <i32*> [#uses=1] - %gep.upgrd.1 = zext i32 %tmp. to i64 ; <i64> [#uses=1] - %tmp.528 = getelementptr i32, i32* %tmp.526, i64 %gep.upgrd.1 ; <i32*> [#uses=1] - store i32 0, i32* %tmp.528 - %indvar.next341 = add i32 %indvar340, 1 ; <i32> [#uses=1] - br label %loopentry.4 -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/2005-08-17-OutOfLoopVariant.ll b/llvm/test/Transforms/LoopStrengthReduce/2005-08-17-OutOfLoopVariant.ll deleted file mode 100644 index 3e52dff2a87..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/2005-08-17-OutOfLoopVariant.ll +++ /dev/null @@ -1,17 +0,0 @@ -; RUN: opt < %s -loop-reduce -disable-output - -define i32 @image_to_texture(i32 %indvar454) { -loopentry.1.outer: - %j.2.1.ph = bitcast i32 %indvar454 to i32 ; <i32> [#uses=1] - br label %loopentry.1 -loopentry.1: ; preds = %loopentry.1, %loopentry.1.outer - %i.3 = phi i32 [ 0, %loopentry.1.outer ], [ %i.3.be, %loopentry.1 ] ; <i32> [#uses=2] - %tmp.390 = load i32, i32* null ; <i32> [#uses=1] - %tmp.392 = mul i32 %tmp.390, %j.2.1.ph ; <i32> [#uses=1] - %tmp.394 = add i32 %tmp.392, %i.3 ; <i32> [#uses=1] - %i.3.be = add i32 %i.3, 1 ; <i32> [#uses=1] - br i1 false, label %loopentry.1, label %label.6 -label.6: ; preds = %loopentry.1 - ret i32 %tmp.394 -} - diff --git a/llvm/test/Transforms/LoopStrengthReduce/2005-09-12-UsesOutOutsideOfLoop.ll b/llvm/test/Transforms/LoopStrengthReduce/2005-09-12-UsesOutOutsideOfLoop.ll deleted file mode 100644 index f56a55379c8..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/2005-09-12-UsesOutOutsideOfLoop.ll +++ /dev/null @@ -1,32 +0,0 @@ -; RUN: opt < %s -loop-reduce -disable-output - -define void @main() { -entry: - br label %loopentry.0 -loopentry.0: ; preds = %then.5, %entry - %arg_index.1.ph = phi i32 [ 1, %entry ], [ %arg_index.1.ph.be, %then.5 ] ; <i32> [#uses=1] - br i1 false, label %no_exit.0, label %loopexit.0 -no_exit.0: ; preds = %loopentry.0 - %arg_index.1.1 = add i32 0, %arg_index.1.ph ; <i32> [#uses=2] - br i1 false, label %then.i55, label %endif.i61 -then.i55: ; preds = %no_exit.0 - br i1 false, label %then.4, label %else.1 -endif.i61: ; preds = %no_exit.0 - ret void -then.4: ; preds = %then.i55 - %tmp.19993 = add i32 %arg_index.1.1, 2 ; <i32> [#uses=0] - ret void -else.1: ; preds = %then.i55 - br i1 false, label %then.i86, label %loopexit.i97 -then.i86: ; preds = %else.1 - ret void -loopexit.i97: ; preds = %else.1 - br i1 false, label %then.5, label %else.2 -then.5: ; preds = %loopexit.i97 - %arg_index.1.ph.be = add i32 %arg_index.1.1, 2 ; <i32> [#uses=1] - br label %loopentry.0 -else.2: ; preds = %loopexit.i97 - ret void -loopexit.0: ; preds = %loopentry.0 - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/2007-04-23-UseIterator.ll b/llvm/test/Transforms/LoopStrengthReduce/2007-04-23-UseIterator.ll deleted file mode 100644 index 44f98011b25..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/2007-04-23-UseIterator.ll +++ /dev/null @@ -1,71 +0,0 @@ -; RUN: opt < %s -loop-reduce -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" - -target triple = "i686-apple-darwin9" - -define i8* @foo( i8* %ABC) { -entry: - switch i8 0, label %bb129 [ - i8 0, label %UnifiedReturnBlock - i8 9, label %UnifiedReturnBlock - i8 32, label %UnifiedReturnBlock - i8 35, label %UnifiedReturnBlock - i8 37, label %bb16.preheader - ] - -bb16.preheader: ; preds = %entry - br label %bb16 - -bb16: ; preds = %cond_next102, %bb16.preheader - %indvar = phi i32 [ %indvar.next, %cond_next102 ], [ 0, %bb16.preheader ] ; <i32> [#uses=2] - %ABC.2146.0.rec = mul i32 %indvar, 3 ; <i32> [#uses=1] - br i1 false, label %UnifiedReturnBlock.loopexit, label %cond_next102 - -cond_next102: ; preds = %bb16 - %tmp138145.rec = add i32 %ABC.2146.0.rec, 3 ; <i32> [#uses=1] - %tmp138145 = getelementptr i8, i8* %ABC, i32 %tmp138145.rec ; <i8*> [#uses=4] - %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1] - switch i8 0, label %bb129.loopexit [ - i8 0, label %UnifiedReturnBlock.loopexit - i8 9, label %UnifiedReturnBlock.loopexit - i8 32, label %UnifiedReturnBlock.loopexit - i8 35, label %UnifiedReturnBlock.loopexit - i8 37, label %bb16 - ] - -bb129.loopexit: ; preds = %cond_next102 - br label %bb129 - -bb129: ; preds = %bb129.loopexit, %entry - ret i8* null - -UnifiedReturnBlock.loopexit: ; preds = %cond_next102, %cond_next102, %cond_next102, %cond_next102, %bb16 - %UnifiedRetVal.ph = phi i8* [ %tmp138145, %cond_next102 ], [ %tmp138145, %cond_next102 ], [ %tmp138145, %cond_next102 ], [ %tmp138145, %cond_next102 ], [ null, %bb16 ] ; <i8*> [#uses=0] - br label %UnifiedReturnBlock - -UnifiedReturnBlock: ; preds = %UnifiedReturnBlock.loopexit, %entry, %entry, %entry, %entry - ret i8* null -} - -define i8* @bar() { -entry: - switch i8 0, label %bb158 [ - i8 37, label %bb74 - i8 58, label %cond_true - i8 64, label %bb11 - ] - -bb11: ; preds = %entry - ret i8* null - -cond_true: ; preds = %entry - ret i8* null - -bb74: ; preds = %entry - ret i8* null - -bb158: ; preds = %entry - ret i8* null -} - diff --git a/llvm/test/Transforms/LoopStrengthReduce/2008-08-13-CmpStride.ll b/llvm/test/Transforms/LoopStrengthReduce/2008-08-13-CmpStride.ll deleted file mode 100644 index 394969c9935..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/2008-08-13-CmpStride.ll +++ /dev/null @@ -1,35 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | grep add | count 2 -; PR 2662 - -; Provide legal integer types. -target datalayout = "n8:16:32:64" - -@g_3 = common global i16 0 ; <i16*> [#uses=2] -@"\01LC" = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1] - -define void @func_1() nounwind { -entry: - br label %bb - -bb: ; preds = %bb, %entry - %l_2.0.reg2mem.0 = phi i16 [ 0, %entry ], [ %t1, %bb ] ; <i16> [#uses=2] - %t0 = shl i16 %l_2.0.reg2mem.0, 1 ; <i16>:0 [#uses=1] - store volatile i16 %t0, i16* @g_3, align 2 - %t1 = add i16 %l_2.0.reg2mem.0, -3 ; <i16>:1 [#uses=2] - %t2 = icmp slt i16 %t1, 1 ; <i1>:2 [#uses=1] - br i1 %t2, label %bb, label %return - -return: ; preds = %bb - ret void -} - -define i32 @main() nounwind { -entry: - tail call void @func_1( ) nounwind - load volatile i16, i16* @g_3, align 2 ; <i16>:0 [#uses=1] - zext i16 %0 to i32 ; <i32>:1 [#uses=1] - tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), i32 %1 ) nounwind ; <i32>:2 [#uses=0] - ret i32 0 -} - -declare i32 @printf(i8*, ...) nounwind diff --git a/llvm/test/Transforms/LoopStrengthReduce/2008-09-09-Overflow.ll b/llvm/test/Transforms/LoopStrengthReduce/2008-09-09-Overflow.ll deleted file mode 100644 index 5904434e14f..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/2008-09-09-Overflow.ll +++ /dev/null @@ -1,52 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | grep phi | count 2 -; PR 2779 - -; Provide legal integer types. -target datalayout = "n8:16:32:64" - -@g_19 = common global i32 0 ; <i32*> [#uses=3] -@"\01LC" = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1] - -define i32 @func_8(i8 zeroext %p_9) nounwind { -entry: - ret i32 1 -} - -define i32 @func_3(i8 signext %p_5) nounwind { -entry: - ret i32 1 -} - -define void @func_1() nounwind { -entry: - br label %bb - -bb: ; preds = %bb, %entry - %indvar = phi i16 [ 0, %entry ], [ %indvar.next, %bb ] ; <i16> [#uses=2] - %tmp = sub i16 0, %indvar ; <i16> [#uses=1] - %tmp27 = trunc i16 %tmp to i8 ; <i8> [#uses=1] - load i32, i32* @g_19, align 4 ; <i32>:0 [#uses=2] - add i32 %0, 1 ; <i32>:1 [#uses=1] - store i32 %1, i32* @g_19, align 4 - trunc i32 %0 to i8 ; <i8>:2 [#uses=1] - tail call i32 @func_8( i8 zeroext %2 ) nounwind ; <i32>:3 [#uses=0] - shl i8 %tmp27, 2 ; <i8>:4 [#uses=1] - add i8 %4, -112 ; <i8>:5 [#uses=1] - tail call i32 @func_3( i8 signext %5 ) nounwind ; <i32>:6 [#uses=0] - %indvar.next = add i16 %indvar, 1 ; <i16> [#uses=2] - %exitcond = icmp eq i16 %indvar.next, -28 ; <i1> [#uses=1] - br i1 %exitcond, label %return, label %bb - -return: ; preds = %bb - ret void -} - -define i32 @main() nounwind { -entry: - tail call void @func_1( ) nounwind - load i32, i32* @g_19, align 4 ; <i32>:0 [#uses=1] - tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), i32 %0 ) nounwind ; <i32>:1 [#uses=0] - ret i32 0 -} - -declare i32 @printf(i8*, ...) nounwind diff --git a/llvm/test/Transforms/LoopStrengthReduce/2009-01-13-nonconstant-stride-outside-loop.ll b/llvm/test/Transforms/LoopStrengthReduce/2009-01-13-nonconstant-stride-outside-loop.ll deleted file mode 100644 index c287b10e694..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/2009-01-13-nonconstant-stride-outside-loop.ll +++ /dev/null @@ -1,39 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | grep phi | count 1 -; RUN: opt < %s -loop-reduce -S | grep mul | count 1 -; ModuleID = '<stdin>' -; Make sure examining a fuller expression outside the loop doesn't cause us to create a second -; IV of stride %3. -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.5" - %struct.anon = type { %struct.obj*, %struct.obj* } - %struct.obj = type { i16, i16, { %struct.anon } } -@heap_size = external global i32 ; <i32*> [#uses=1] -@"\01LC85" = external constant [39 x i8] ; <[39 x i8]*> [#uses=1] - -declare i32 @sprintf(i8*, i8*, ...) nounwind - -define %struct.obj* @gc_status(%struct.obj* %args) nounwind { -entry: - br label %bb1.i - -bb.i2: ; preds = %bb2.i3 - %indvar.next24 = add i32 %m.0.i, 1 ; <i32> [#uses=1] - br label %bb1.i - -bb1.i: ; preds = %bb.i2, %entry - %m.0.i = phi i32 [ 0, %entry ], [ %indvar.next24, %bb.i2 ] ; <i32> [#uses=4] - %0 = icmp slt i32 %m.0.i, 0 ; <i1> [#uses=1] - br i1 %0, label %bb2.i3, label %nactive_heaps.exit - -bb2.i3: ; preds = %bb1.i - %1 = load %struct.obj*, %struct.obj** null, align 4 ; <%struct.obj*> [#uses=1] - %2 = icmp eq %struct.obj* %1, null ; <i1> [#uses=1] - br i1 %2, label %nactive_heaps.exit, label %bb.i2 - -nactive_heaps.exit: ; preds = %bb2.i3, %bb1.i - %3 = load i32, i32* @heap_size, align 4 ; <i32> [#uses=1] - %4 = mul i32 %3, %m.0.i ; <i32> [#uses=1] - %5 = sub i32 %4, 0 ; <i32> [#uses=1] - %6 = tail call i32 (i8*, i8*, ...) @sprintf(i8* null, i8* getelementptr ([39 x i8], [39 x i8]* @"\01LC85", i32 0, i32 0), i32 %m.0.i, i32 0, i32 %5, i32 0) nounwind ; <i32> [#uses=0] - ret %struct.obj* null -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/2009-04-28-no-reduce-mul.ll b/llvm/test/Transforms/LoopStrengthReduce/2009-04-28-no-reduce-mul.ll deleted file mode 100644 index 8e890e84bcc..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/2009-04-28-no-reduce-mul.ll +++ /dev/null @@ -1,48 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | FileCheck %s - -; The multiply in bb2 must not be reduced to an add, as the sext causes the -; %1 argument to become negative after a while. - -; CHECK: sext i8 -; CHECK: mul i32 -; CHECK: store i32 - -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.6" -@table = common global [32 x [256 x i32]] zeroinitializer, align 32 ; <[32 x [256 x i32]]*> [#uses=2] - -define i32 @main() nounwind { -bb4.thread: - br label %bb2 - -bb2: ; preds = %bb4, %bb2, %bb4.thread - %i.0.reg2mem.0.ph = phi i32 [ 0, %bb4.thread ], [ %i.0.reg2mem.0.ph, %bb2 ], [ %indvar.next9, %bb4 ] ; <i32> [#uses=4] - %j.0.reg2mem.0 = phi i32 [ 0, %bb4.thread ], [ %indvar.next, %bb2 ], [ 0, %bb4 ] ; <i32> [#uses=3] - %0 = trunc i32 %j.0.reg2mem.0 to i8 ; <i8> [#uses=1] - %1 = sext i8 %0 to i32 ; <i32> [#uses=1] - %2 = mul i32 %1, %i.0.reg2mem.0.ph ; <i32> [#uses=1] - %3 = getelementptr [32 x [256 x i32]], [32 x [256 x i32]]* @table, i32 0, i32 %i.0.reg2mem.0.ph, i32 %j.0.reg2mem.0 ; <i32*> [#uses=1] - store i32 %2, i32* %3, align 4 - %indvar.next = add i32 %j.0.reg2mem.0, 1 ; <i32> [#uses=2] - %exitcond = icmp eq i32 %indvar.next, 256 ; <i1> [#uses=1] - br i1 %exitcond, label %bb4, label %bb2 - -bb4: ; preds = %bb2 - %indvar.next9 = add i32 %i.0.reg2mem.0.ph, 1 ; <i32> [#uses=2] - %exitcond10 = icmp eq i32 %indvar.next9, 32 ; <i1> [#uses=1] - br i1 %exitcond10, label %bb5, label %bb2 - -bb5: ; preds = %bb4 - %4 = load i32, i32* getelementptr ([32 x [256 x i32]], [32 x [256 x i32]]* @table, i32 0, i32 9, i32 132), align 16 ; <i32> [#uses=1] - %5 = icmp eq i32 %4, -1116 ; <i1> [#uses=1] - br i1 %5, label %bb7, label %bb6 - -bb6: ; preds = %bb5 - tail call void @abort() noreturn nounwind - unreachable - -bb7: ; preds = %bb5 - ret i32 0 -} - -declare void @abort() noreturn nounwind diff --git a/llvm/test/Transforms/LoopStrengthReduce/2011-07-19-CritEdgeBreakCrash.ll b/llvm/test/Transforms/LoopStrengthReduce/2011-07-19-CritEdgeBreakCrash.ll deleted file mode 100644 index cf549fc38ac..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/2011-07-19-CritEdgeBreakCrash.ll +++ /dev/null @@ -1,52 +0,0 @@ -; ModuleID = '<stdin>' -; RUN: opt < %s -loop-reduce -S | FileCheck %s -; PR10386 - -declare i1 @foo() -declare i8* @bar(i8*,i8*,i8*,i8*) - -define void @f(i64* %a,i64* %b,i64* %c,i64* %d,i64* %e,i64* %f,i64* %g) nounwind uwtable { -entry: - br label %b_throw.preheader - -D_BREAK_LBL: ; preds = %indirectgoto - call i1 @foo() - br label %indirectgoto - -H_CONST_LBL: ; preds = %indirectgoto - call i1 @foo() - br label %body_failed - -H_MPZ_LBL: ; preds = %indirectgoto - %boo3 = call i1 @foo() - br i1 %boo3, label %body_failed, label %while.cond.i - -while.cond.i: ; preds = %while.body.i15795, %if.then.i15791 - %phi = phi i64 [ %tmp20916, %while.body.i15795 ], [ 0, %H_MPZ_LBL ] - %tmp20916 = add i64 %phi, 1 - %incdec.ptr.i15793 = getelementptr i64, i64* %pc.0.lcssa.i1610719352, i64 %tmp20916 - %boo2 = call i1 @foo() - br i1 %boo2, label %indirectgoto, label %while.body.i15795 - -while.body.i15795: ; preds = %while.cond.i - %tmp20.i = load i64, i64* %incdec.ptr.i15793, align 8 - %boo1 = call i1 @foo() - br i1 %boo1, label %while.cond.i, label %body_failed - -b_throw.preheader: ; preds = %body_failed, %entry - call i1 @foo() - br label %indirectgoto - -body_failed: - %pc.0.lcssa.i1610719364 = phi i64* [ %pc.0.lcssa.i1610719352, %indirectgoto ], [ %pc.0.lcssa.i1610719352, %H_MPZ_LBL ], [ %b, %H_CONST_LBL ], [ %pc.0.lcssa.i1610719352, %while.body.i15795 ] - call i1 @foo() - br label %b_throw.preheader - -indirectgoto: - %pc.0.lcssa.i1610719352 = phi i64* [ %pc.0.lcssa.i1610719352, %D_BREAK_LBL ], [ %a, %b_throw.preheader ], [ %d, %while.cond.i ] - %p = call i8* @bar(i8* blockaddress(@f, %D_BREAK_LBL), i8* blockaddress(@f, %H_CONST_LBL), i8* blockaddress(@f, %H_MPZ_LBL), i8* blockaddress(@f, %body_failed) ) - indirectbr i8* %p, [label %D_BREAK_LBL, label %H_CONST_LBL, label %H_MPZ_LBL, label %body_failed] -} - -; CHECK: %p = call i8* @bar(i8* blockaddress(@f, %D_BREAK_LBL), i8* blockaddress(@f, %H_CONST_LBL), i8* blockaddress(@f, %H_MPZ_LBL), i8* blockaddress(@f, %body_failed)) -; CHECK: indirectbr i8* %p, [label %D_BREAK_LBL, label %H_CONST_LBL, label %H_MPZ_LBL, label %body_failed] diff --git a/llvm/test/Transforms/LoopStrengthReduce/2011-10-03-CritEdgeMerge.ll b/llvm/test/Transforms/LoopStrengthReduce/2011-10-03-CritEdgeMerge.ll deleted file mode 100644 index 5f910ce8402..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/2011-10-03-CritEdgeMerge.ll +++ /dev/null @@ -1,85 +0,0 @@ -; RUN: opt -loop-reduce -S < %s | FileCheck %s -; -; Test LSR's use of SplitCriticalEdge during phi rewriting. - -target triple = "x86_64-apple-darwin" - -; Provide legal integer types. -target datalayout = "n8:16:32:64" - - -; Verify that identical edges are merged. rdar://problem/6453893 -; CHECK-LABEL: @test1( -; CHECK: bb89: -; CHECK: phi i8* [ %lsr.iv.next1, %bbA.bb89_crit_edge ], [ %lsr.iv.next1, %bbB.bb89_crit_edge ]{{$}} - -define i8* @test1() { -entry: - br label %loop - -loop: - %rec = phi i32 [ %next, %loop ], [ 0, %entry ] - %next = add i32 %rec, 1 - %tmp75 = getelementptr i8, i8* null, i32 %next - br i1 false, label %loop, label %loopexit - -loopexit: - br i1 false, label %bbA, label %bbB - -bbA: - switch i32 0, label %bb89 [ - i32 47, label %bb89 - i32 58, label %bb89 - ] - -bbB: - switch i8 0, label %bb89 [ - i8 47, label %bb89 - i8 58, label %bb89 - ] - -bb89: - %tmp75phi = phi i8* [ %tmp75, %bbA ], [ %tmp75, %bbA ], [ %tmp75, %bbA ], [ %tmp75, %bbB ], [ %tmp75, %bbB ], [ %tmp75, %bbB ] - br label %exit - -exit: - ret i8* %tmp75phi -} - -; Handle single-predecessor phis: PR13756 -; CHECK-LABEL: @test2( -; CHECK: bb89: -; CHECK: phi i8* [ %lsr.iv.next1, %bbA ], [ %lsr.iv.next1, %bbA ], [ %lsr.iv.next1, %bbA ]{{$}} -define i8* @test2() { -entry: - br label %loop - -loop: - %rec = phi i32 [ %next, %loop ], [ 0, %entry ] - %next = add i32 %rec, 1 - %tmp75 = getelementptr i8, i8* null, i32 %next - br i1 false, label %loop, label %loopexit - -loopexit: - br i1 false, label %bbA, label %bbB - -bbA: - switch i32 0, label %bb89 [ - i32 47, label %bb89 - i32 58, label %bb89 - ] - -bbB: - switch i8 0, label %exit [ - i8 47, label %exit - i8 58, label %exit - ] - -bb89: - %tmp75phi = phi i8* [ %tmp75, %bbA ], [ %tmp75, %bbA ], [ %tmp75, %bbA ] - br label %exit - -exit: - %result = phi i8* [ %tmp75phi, %bb89 ], [ %tmp75, %bbB ], [ %tmp75, %bbB ], [ %tmp75, %bbB ] - ret i8* %result -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/2011-10-06-ReusePhi.ll b/llvm/test/Transforms/LoopStrengthReduce/2011-10-06-ReusePhi.ll deleted file mode 100644 index a35aa9f36fe..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/2011-10-06-ReusePhi.ll +++ /dev/null @@ -1,57 +0,0 @@ -; RUN: opt -loop-reduce -S < %s | FileCheck %s -; -; Test LSR's intelligence regarding phi reuse. -; Verify that scaled GEPs are not reused. rdar://5064068 - -target triple = "x86_64-apple-darwin" - -; Provide legal integer types. -target datalayout = "n8:16:32:64" - - -; CHECK-LABEL: @test( -; multiplies are hoisted out of the loop -; CHECK: while.body.lr.ph: -; CHECK: shl i64 -; CHECK: shl i64 -; GEPs are ugly -; CHECK: while.body: -; CHECK: phi -; CHECK: phi -; CHECK: phi -; CHECK: phi -; CHECK-NOT: phi -; CHECK: bitcast float* {{.*}} to i1* -; CHECK: bitcast float* {{.*}} to i1* -; CHECK: getelementptr i1, i1* -; CHECK: getelementptr i1, i1* - -define float @test(float* nocapture %A, float* nocapture %B, i32 %N, i32 %IA, i32 %IB) nounwind uwtable readonly ssp { -entry: - %cmp1 = icmp sgt i32 %N, 0 - br i1 %cmp1, label %while.body.lr.ph, label %while.end - -while.body.lr.ph: ; preds = %entry - %idx.ext = sext i32 %IA to i64 - %idx.ext2 = sext i32 %IB to i64 - br label %while.body - -while.body: ; preds = %while.body.lr.ph, %while.body - %A.addr.05 = phi float* [ %A, %while.body.lr.ph ], [ %add.ptr, %while.body ] - %B.addr.04 = phi float* [ %B, %while.body.lr.ph ], [ %add.ptr3, %while.body ] - %N.addr.03 = phi i32 [ %N, %while.body.lr.ph ], [ %sub, %while.body ] - %Sum0.02 = phi float [ 0.000000e+00, %while.body.lr.ph ], [ %add, %while.body ] - %0 = load float, float* %A.addr.05, align 4 - %1 = load float, float* %B.addr.04, align 4 - %mul = fmul float %0, %1 - %add = fadd float %Sum0.02, %mul - %add.ptr = getelementptr inbounds float, float* %A.addr.05, i64 %idx.ext - %add.ptr3 = getelementptr inbounds float, float* %B.addr.04, i64 %idx.ext2 - %sub = add nsw i32 %N.addr.03, -1 - %cmp = icmp sgt i32 %sub, 0 - br i1 %cmp, label %while.body, label %while.end - -while.end: ; preds = %while.body, %entry - %Sum0.0.lcssa = phi float [ 0.000000e+00, %entry ], [ %add, %while.body ] - ret float %Sum0.0.lcssa -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/2011-10-13-SCEVChain.ll b/llvm/test/Transforms/LoopStrengthReduce/2011-10-13-SCEVChain.ll deleted file mode 100644 index a61de24370f..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/2011-10-13-SCEVChain.ll +++ /dev/null @@ -1,111 +0,0 @@ -; RUN: opt -loop-reduce -S < %s | FileCheck %s -; -; Test TransformForPostIncUse and LSR's expansion of expressions in -; post-inc form to ensure the implementation can handle expressions -; DAGs, not just trees. - -target triple = "x86_64-apple-darwin" - -; Verify that -loop-reduce runs without "hanging" and reuses post-inc -; expansions. -; CHECK-LABEL: @test( -; CHECK: icmp -; CHECK: icmp -; CHECK: icmp -; CHECK: icmp -; CHECK: icmp -; CHECK: icmp -; CHECK: icmp -; CHECK: icmp -; CHECK: icmp -; CHECK: icmp -; CHECK: icmp -; CHECK: icmp -; CHECK: icmp -; CHECK: icmp -; CHECK: icmp -; CHECK: icmp -; CHECK: icmp -; CHECK-NOT: icmp -define void @test(i8* %base, i32 %a0) nounwind { -entry: - br label %bb1 -bb1: - %n0 = sub i32 0, %a0 - %t0 = icmp ugt i32 %n0, -4 - %m0 = select i1 %t0, i32 %n0, i32 -4 - %a1 = add i32 %m0, %a0 - %n1 = sub i32 0, %a1 - %t1 = icmp ugt i32 %n1, -4 - %m1 = select i1 %t1, i32 %n1, i32 -4 - %a2 = add i32 %m1, %a1 - %n2 = sub i32 0, %a2 - %t2 = icmp ugt i32 %n2, -4 - %m2 = select i1 %t2, i32 %n2, i32 -4 - %a3 = add i32 %m2, %a2 - %n3 = sub i32 0, %a3 - %t3 = icmp ugt i32 %n3, -4 - %m3 = select i1 %t3, i32 %n3, i32 -4 - %a4 = add i32 %m3, %a3 - %n4 = sub i32 0, %a4 - %t4 = icmp ugt i32 %n4, -4 - %m4 = select i1 %t4, i32 %n4, i32 -4 - %a5 = add i32 %m4, %a4 - %n5 = sub i32 0, %a5 - %t5 = icmp ugt i32 %n5, -4 - %m5 = select i1 %t5, i32 %n5, i32 -4 - %a6 = add i32 %m5, %a5 - %n6 = sub i32 0, %a6 - %t6 = icmp ugt i32 %n6, -4 - %m6 = select i1 %t6, i32 %n6, i32 -4 - %a7 = add i32 %m6, %a6 - %n7 = sub i32 0, %a7 - %t7 = icmp ugt i32 %n7, -4 - %m7 = select i1 %t7, i32 %n7, i32 -4 - %a8 = add i32 %m7, %a7 - %n8 = sub i32 0, %a8 - %t8 = icmp ugt i32 %n8, -4 - %m8 = select i1 %t8, i32 %n8, i32 -4 - %a9 = add i32 %m8, %a8 - %n9 = sub i32 0, %a9 - %t9 = icmp ugt i32 %n9, -4 - %m9 = select i1 %t9, i32 %n9, i32 -4 - %a10 = add i32 %m9, %a9 - %n10 = sub i32 0, %a10 - %t10 = icmp ugt i32 %n10, -4 - %m10 = select i1 %t10, i32 %n10, i32 -4 - %a11 = add i32 %m10, %a10 - %n11 = sub i32 0, %a11 - %t11 = icmp ugt i32 %n11, -4 - %m11 = select i1 %t11, i32 %n11, i32 -4 - %a12 = add i32 %m11, %a11 - %n12 = sub i32 0, %a12 - %t12 = icmp ugt i32 %n12, -4 - %m12 = select i1 %t12, i32 %n12, i32 -4 - %a13 = add i32 %m12, %a12 - %n13 = sub i32 0, %a13 - %t13 = icmp ugt i32 %n13, -4 - %m13 = select i1 %t13, i32 %n13, i32 -4 - %a14 = add i32 %m13, %a13 - %n14 = sub i32 0, %a14 - %t14 = icmp ugt i32 %n14, -4 - %m14 = select i1 %t14, i32 %n14, i32 -4 - %a15 = add i32 %m14, %a14 - %n15 = sub i32 0, %a15 - %t15 = icmp ugt i32 %n15, -4 - %m15 = select i1 %t15, i32 %n15, i32 -4 - %a16 = add i32 %m15, %a15 - %gep = getelementptr i8, i8* %base, i32 %a16 - %ofs = add i32 %a16, 4 - %limit = getelementptr i8, i8* %base, i32 %ofs - br label %loop - -loop: - %iv = phi i8* [ %gep, %bb1 ], [ %inc, %loop ] - %inc = getelementptr inbounds i8, i8* %iv, i64 1 - %exitcond = icmp eq i8* %inc, %limit - br i1 %exitcond, label %loop, label %exit - -exit: - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/2011-10-14-IntPtr.ll b/llvm/test/Transforms/LoopStrengthReduce/2011-10-14-IntPtr.ll deleted file mode 100644 index fe9f8cb2de4..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/2011-10-14-IntPtr.ll +++ /dev/null @@ -1,27 +0,0 @@ -; RUN: opt -loop-reduce -S < %s | FileCheck %s -; -; Test SCEVExpander reusing a phi->gep->phi IV when SCEV "wrongly" -; reports the expression as an IntegerTy. - -target triple = "x86_64-apple-darwin" - -; CHECK-LABEL: @test( -; CHECK: phi -; CHECK-NOT: phi -define void @test(i32 %rowStride) ssp align 2 { -entry: - %cond = select i1 undef, i32 %rowStride, i32 4 - br label %for.end - -for.end.critedge: ; preds = %for.end - br label %for.end - -for.end: ; preds = %for.end.critedge, %entry - br i1 undef, label %for.body83, label %for.end.critedge - -for.body83: ; preds = %for.body83, %for.end - %ptr.0157 = phi i8* [ %add.ptr96, %for.body83 ], [ null, %for.end ] - store i8 undef, i8* %ptr.0157, align 1 - %add.ptr96 = getelementptr inbounds i8, i8* %ptr.0157, i32 %cond - br label %for.body83 -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/2011-12-19-PostincQuadratic.ll b/llvm/test/Transforms/LoopStrengthReduce/2011-12-19-PostincQuadratic.ll deleted file mode 100644 index 317b0b0b293..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/2011-12-19-PostincQuadratic.ll +++ /dev/null @@ -1,39 +0,0 @@ -; RUN: opt -loop-reduce -S < %s | FileCheck %s -; -; PR11571: handle a postinc user outside of for.body7 that requires -; recursive expansion of a quadratic recurrence within for.body7. LSR -; needs to forget that for.body7 is a postinc loop during expansion. - -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-n8:16:32-S128" -target triple = "i386-unknown-freebsd10.0" - -@b = external global [121 x i32] - -; CHECK-LABEL: @vb( -; Outer recurrence: -; CHECK: %lsr.iv1 = phi [121 x i32]* -; Inner recurrence: -; CHECK: %lsr.iv = phi i32 -; Outer step (relative to inner recurrence): -; CHECK: %scevgep = getelementptr i1, i1* %{{.*}}, i32 %lsr.iv -; Outer use: -; CHECK: %lsr.iv3 = phi [121 x i32]* [ %lsr.iv1, %for.body43.preheader ] -define void @vb() nounwind { -for.cond.preheader: - br label %for.body7 - -for.body7: - %indvars.iv77 = phi i32 [ %indvars.iv.next78, %for.body7 ], [ 1, %for.cond.preheader ] - %bf.072 = phi i32 [ %t1, %for.body7 ], [ 0, %for.cond.preheader ] - %t1 = add i32 %bf.072, %indvars.iv77 - %indvars.iv.next78 = add i32 %indvars.iv77, 1 - br i1 undef, label %for.body43, label %for.body7 - -for.body43: - %bf.459 = phi i32 [ %inc44, %for.body43 ], [ %t1, %for.body7 ] - %inc44 = add nsw i32 %bf.459, 1 - %arrayidx45 = getelementptr inbounds [121 x i32], [121 x i32]* @b, i32 0, i32 %bf.459 - %t2 = load i32, i32* %arrayidx45, align 4 - br label %for.body43 -} - diff --git a/llvm/test/Transforms/LoopStrengthReduce/2012-01-02-nopreheader.ll b/llvm/test/Transforms/LoopStrengthReduce/2012-01-02-nopreheader.ll deleted file mode 100644 index d8aa26402f7..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/2012-01-02-nopreheader.ll +++ /dev/null @@ -1,88 +0,0 @@ -; RUN: opt -loop-reduce -S < %s | FileCheck %s -; -; <rdar://10619599> "SelectionDAGBuilder shouldn't visit PHI nodes!" assert. -; <rdar://10655343> SCEVExpander segfault on simple test case - -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-f128:128:128-n8:16:32" -target triple = "i386-apple-darwin" - -; LSR should convert the inner loop (bb7.us) IV (j.01.us) into float*. -; This involves a nested AddRec, the outer AddRec's loop invariant components -; cannot find a preheader, so they should be expanded in the loop header -; (bb7.lr.ph.us) below the existing phi i.12.us. -; Currently, LSR won't kick in on such loops. -; CHECK-LABEL: @nopreheader( -; CHECK: bb7.us: -; CHECK-NOT: phi float* -; CHECK: %j.01.us = phi i32 -; CHECK-NOT: phi float* -define void @nopreheader(float* nocapture %a, i32 %n) nounwind { -entry: - %0 = sdiv i32 %n, undef - indirectbr i8* undef, [label %bb10.preheader] - -bb10.preheader: ; preds = %bb4 - indirectbr i8* undef, [label %bb8.preheader.lr.ph, label %return] - -bb8.preheader.lr.ph: ; preds = %bb10.preheader - indirectbr i8* null, [label %bb7.lr.ph.us, label %bb9] - -bb7.lr.ph.us: ; preds = %bb9.us, %bb8.preheader.lr.ph - %i.12.us = phi i32 [ %2, %bb9.us ], [ 0, %bb8.preheader.lr.ph ] - %tmp30 = mul i32 %0, %i.12.us - indirectbr i8* undef, [label %bb7.us] - -bb7.us: ; preds = %bb7.lr.ph.us, %bb7.us - %j.01.us = phi i32 [ 0, %bb7.lr.ph.us ], [ %1, %bb7.us ] - %tmp31 = add i32 %tmp30, %j.01.us - %scevgep9 = getelementptr float, float* %a, i32 %tmp31 - store float undef, float* %scevgep9, align 1 - %1 = add nsw i32 %j.01.us, 1 - indirectbr i8* undef, [label %bb9.us, label %bb7.us] - -bb9.us: ; preds = %bb7.us - %2 = add nsw i32 %i.12.us, 1 - indirectbr i8* undef, [label %bb7.lr.ph.us, label %return] - -bb9: ; preds = %bb9, %bb8.preheader.lr.ph - indirectbr i8* undef, [label %bb9, label %return] - -return: ; preds = %bb9, %bb9.us, %bb10.preheader - ret void -} - -; In this case, SCEVExpander simply cannot materialize the AddRecExpr -; that LSR picks. We must detect that %bb8.preheader does not have a -; preheader and avoid performing LSR on %bb7. -; CHECK-LABEL: @nopreheader2( -; CHECK: bb7: -; CHECK: %indvar = phi i32 -define fastcc void @nopreheader2([200 x i32]* nocapture %Array2) nounwind { -entry: - indirectbr i8* undef, [label %bb] - -bb: ; preds = %bb, %entry - indirectbr i8* undef, [label %bb3, label %bb] - -bb3: ; preds = %bb3, %bb - indirectbr i8* undef, [label %bb8.preheader, label %bb3] - -bb8.preheader: ; preds = %bb9, %bb3 - %indvar5 = phi i32 [ %indvar.next6, %bb9 ], [ 0, %bb3 ] - %tmp26 = add i32 %indvar5, 13 - indirectbr i8* null, [label %bb7] - -bb7: ; preds = %bb8.preheader, %bb7 - %indvar = phi i32 [ 0, %bb8.preheader ], [ %indvar.next, %bb7 ] - %scevgep = getelementptr [200 x i32], [200 x i32]* %Array2, i32 %tmp26, i32 %indvar - store i32 undef, i32* %scevgep, align 4 - %indvar.next = add i32 %indvar, 1 - indirectbr i8* undef, [label %bb9, label %bb7] - -bb9: ; preds = %bb7 - %indvar.next6 = add i32 %indvar5, 1 - indirectbr i8* undef, [label %return, label %bb8.preheader] - -return: ; preds = %bb9 - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/2012-01-16-nopreheader.ll b/llvm/test/Transforms/LoopStrengthReduce/2012-01-16-nopreheader.ll deleted file mode 100644 index 7f1eed03a71..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/2012-01-16-nopreheader.ll +++ /dev/null @@ -1,113 +0,0 @@ -; RUN: opt -loop-reduce -S < %s | FileCheck %s -; -; <rdar://10701050> "Cannot split an edge from an IndirectBrInst" assert. - -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" - -; while.cond197 is a dominates the simplified loop while.cond238 but -; has no with no preheader. -; -; CHECK-LABEL: @nopreheader( -; CHECK: %while.cond238 -; CHECK: phi i64 -; CHECK-NOT: phi -; CHECK: indirectbr -define void @nopreheader(i8* %end) nounwind { -entry: - br label %while.cond179 - -while.cond179: ; preds = %if.end434, %if.end369, %if.end277, %if.end165 - %s.1 = phi i8* [ undef, %if.end434 ], [ %incdec.ptr356, %if.end348 ], [ undef, %entry ] - indirectbr i8* undef, [label %land.rhs184, label %while.end453] - -land.rhs184: ; preds = %while.cond179 - indirectbr i8* undef, [label %while.end453, label %while.cond197] - -while.cond197: ; preds = %land.rhs202, %land.rhs184 - %0 = phi i64 [ %indvar.next11, %land.rhs202 ], [ 0, %land.rhs184 ] - indirectbr i8* undef, [label %land.rhs202, label %while.end215] - -land.rhs202: ; preds = %while.cond197 - %indvar.next11 = add i64 %0, 1 - indirectbr i8* undef, [label %while.end215, label %while.cond197] - -while.end215: ; preds = %land.rhs202, %while.cond197 - indirectbr i8* undef, [label %PREMATURE, label %if.end221] - -if.end221: ; preds = %while.end215 - indirectbr i8* undef, [label %while.cond238.preheader, label %lor.lhs.false227] - -lor.lhs.false227: ; preds = %if.end221 - indirectbr i8* undef, [label %while.cond238.preheader, label %if.else] - -while.cond238.preheader: ; preds = %lor.lhs.false227, %if.end221 - %tmp16 = add i64 %0, 2 - indirectbr i8* undef, [label %while.cond238] - -while.cond238: ; preds = %land.rhs243, %while.cond238.preheader - %1 = phi i64 [ %indvar.next15, %land.rhs243 ], [ 0, %while.cond238.preheader ] - %tmp36 = add i64 %tmp16, %1 - %s.3 = getelementptr i8, i8* %s.1, i64 %tmp36 - %cmp241 = icmp ult i8* %s.3, %end - indirectbr i8* undef, [label %land.rhs243, label %while.end256] - -land.rhs243: ; preds = %while.cond238 - %indvar.next15 = add i64 %1, 1 - indirectbr i8* undef, [label %while.end256, label %while.cond238] - -while.end256: ; preds = %land.rhs243, %while.cond238 - indirectbr i8* undef, [label %PREMATURE] - -if.else: ; preds = %lor.lhs.false227 - indirectbr i8* undef, [label %if.then297, label %if.else386] - -if.then297: ; preds = %if.else - indirectbr i8* undef, [label %PREMATURE, label %if.end307] - -if.end307: ; preds = %if.then297 - indirectbr i8* undef, [label %if.end314, label %FAIL] - -if.end314: ; preds = %if.end307 - indirectbr i8* undef, [label %if.end340] - -if.end340: ; preds = %while.end334 - indirectbr i8* undef, [label %PREMATURE, label %if.end348] - -if.end348: ; preds = %if.end340 - %incdec.ptr356 = getelementptr inbounds i8, i8* undef, i64 2 - indirectbr i8* undef, [label %while.cond179] - -if.else386: ; preds = %if.else - indirectbr i8* undef, [label %while.end453, label %if.end434] - -if.end434: ; preds = %if.then428, %if.end421 - indirectbr i8* undef, [label %while.cond179] - -while.end453: ; preds = %if.else386, %land.rhs184, %while.cond179 - indirectbr i8* undef, [label %PREMATURE, label %if.end459] - -if.end459: ; preds = %while.end453 - indirectbr i8* undef, [label %if.then465, label %FAIL] - -if.then465: ; preds = %if.end459 - indirectbr i8* undef, [label %return, label %if.then479] - -if.then479: ; preds = %if.then465 - indirectbr i8* undef, [label %return] - -FAIL: ; preds = %if.end459, %if.end307, %land.lhs.true142, %land.lhs.true131, %while.end - indirectbr i8* undef, [label %DECL_FAIL] - -PREMATURE: ; preds = %while.end453, %while.end415, %if.end340, %while.end334, %if.then297, %while.end256, %while.end215 - indirectbr i8* undef, [label %return, label %if.then495] - -if.then495: ; preds = %PREMATURE - indirectbr i8* undef, [label %return] - -DECL_FAIL: ; preds = %if.then488, %FAIL, %land.lhs.true99, %lor.lhs.false, %if.end83, %if.then39, %if.end - indirectbr i8* undef, [label %return] - -return: ; preds = %if.then512, %if.end504, %DECL_FAIL, %if.then495, %PREMATURE, %if.then479, %if.then465, %if.then69, %if.end52, %if.end19, %if.then - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/2012-03-15-nopreheader.ll b/llvm/test/Transforms/LoopStrengthReduce/2012-03-15-nopreheader.ll deleted file mode 100644 index 62064cb7881..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/2012-03-15-nopreheader.ll +++ /dev/null @@ -1,155 +0,0 @@ -; RUN: opt -loop-reduce -S < %s | FileCheck %s -; -; <rdar://problem/11049788> Segmentation fault: 11 in LoopStrengthReduce - -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" - -; IVUsers should not consider tmp128 a valid user because it is not in a -; simplified loop nest. -; CHECK-LABEL: @nopreheader( -; CHECK: for.cond: -; CHECK: %tmp128 = add i64 %0, %indvar65 -define void @nopreheader(i8* %cmd) nounwind ssp { -entry: - indirectbr i8* undef, [label %while.cond] - -while.cond: ; preds = %while.body, %entry - %0 = phi i64 [ %indvar.next48, %while.body ], [ 0, %entry ] - indirectbr i8* undef, [label %while.end, label %while.body] - -while.body: ; preds = %lor.rhs, %lor.lhs.false17, %lor.lhs.false11, %lor.lhs.false, %land.rhs - %indvar.next48 = add i64 %0, 1 - indirectbr i8* undef, [label %while.cond] - -while.end: ; preds = %lor.rhs, %while.cond - indirectbr i8* undef, [label %if.end152] - -if.end152: ; preds = %lor.lhs.false144, %if.end110 - indirectbr i8* undef, [label %lor.lhs.false184, label %for.cond] - -lor.lhs.false184: ; preds = %lor.lhs.false177 - indirectbr i8* undef, [label %return, label %for.cond] - -for.cond: ; preds = %for.inc, %lor.lhs.false184, %if.end152 - %indvar65 = phi i64 [ %indvar.next66, %for.inc ], [ 0, %lor.lhs.false184 ], [ 0, %if.end152 ] - %tmp128 = add i64 %0, %indvar65 - %s.4 = getelementptr i8, i8* %cmd, i64 %tmp128 - %tmp195 = load i8, i8* %s.4, align 1 - indirectbr i8* undef, [label %return, label %land.rhs198] - -land.rhs198: ; preds = %for.cond - indirectbr i8* undef, [label %return, label %for.inc] - -for.inc: ; preds = %lor.rhs234, %land.lhs.true228, %land.lhs.true216, %land.lhs.true204 - %indvar.next66 = add i64 %indvar65, 1 - indirectbr i8* undef, [label %for.cond] - -return: ; preds = %if.end677, %doshell, %if.then96 - ret void -} - -; Another case with a dominating loop that does not contain the IV -; User. Just make sure it doesn't assert. -define void @nopreheader2() nounwind ssp { -entry: - indirectbr i8* undef, [label %while.cond, label %return] - -while.cond: ; preds = %while.cond.backedge, %entry - indirectbr i8* undef, [label %while.cond.backedge, label %lor.rhs] - -lor.rhs: ; preds = %while.cond - indirectbr i8* undef, [label %while.cond.backedge, label %while.end] - -while.cond.backedge: ; preds = %lor.rhs, %while.cond - indirectbr i8* undef, [label %while.cond] - -while.end: ; preds = %lor.rhs - indirectbr i8* undef, [label %if.then18, label %return] - -if.then18: ; preds = %while.end - indirectbr i8* undef, [label %if.end35, label %lor.lhs.false] - -lor.lhs.false: ; preds = %if.then18 - indirectbr i8* undef, [label %if.end35, label %return] - -if.end35: ; preds = %lor.lhs.false, %if.then18 - indirectbr i8* undef, [label %while.cond36] - -while.cond36: ; preds = %while.body49, %if.end35 - %0 = phi i64 [ %indvar.next13, %while.body49 ], [ 0, %if.end35 ] - indirectbr i8* undef, [label %while.body49, label %lor.rhs42] - -lor.rhs42: ; preds = %while.cond36 - indirectbr i8* undef, [label %while.body49, label %while.end52] - -while.body49: ; preds = %lor.rhs42, %while.cond36 - %indvar.next13 = add i64 %0, 1 - indirectbr i8* undef, [label %while.cond36] - -while.end52: ; preds = %lor.rhs42 - indirectbr i8* undef, [label %land.lhs.true, label %return] - -land.lhs.true: ; preds = %while.end52 - indirectbr i8* undef, [label %while.cond66.preheader, label %return] - -while.cond66.preheader: ; preds = %land.lhs.true - indirectbr i8* undef, [label %while.cond66] - -while.cond66: ; preds = %while.body77, %while.cond66.preheader - indirectbr i8* undef, [label %land.rhs, label %while.cond81.preheader] - -land.rhs: ; preds = %while.cond66 - indirectbr i8* undef, [label %while.body77, label %while.cond81.preheader] - -while.cond81.preheader: ; preds = %land.rhs, %while.cond66 - %tmp45 = add i64 undef, %0 - %tmp46 = add i64 %tmp45, undef - indirectbr i8* undef, [label %while.cond81] - -while.body77: ; preds = %land.rhs - indirectbr i8* undef, [label %while.cond66] - -while.cond81: ; preds = %while.body94, %while.cond81.preheader - %tmp25 = add i64 %tmp46, undef - indirectbr i8* undef, [label %while.body94, label %lor.rhs87] - -lor.rhs87: ; preds = %while.cond81 - indirectbr i8* undef, [label %while.body94, label %return] - -while.body94: ; preds = %lor.rhs87, %while.cond81 - indirectbr i8* undef, [label %while.cond81] - -return: ; preds = %if.end216, %land.lhs.true183, %land.lhs.true, %while.end52, %lor.lhs.false, %while.end, %entry - ret void -} - -; Test a phi operand IV User dominated by a no-preheader loop. -define void @nopreheader3() nounwind uwtable ssp align 2 { -entry: - indirectbr i8* blockaddress(@nopreheader3, %if.end10), [label %if.end22, label %if.end10] - -if.end10: ; preds = %entry - indirectbr i8* blockaddress(@nopreheader3, %if.end6.i), [label %if.end22, label %if.end6.i] - -if.end6.i: ; preds = %if.end10 - indirectbr i8* blockaddress(@nopreheader3, %while.cond2.preheader.i.i), [label %if.then12, label %while.cond2.preheader.i.i] - -while.cond2.preheader.i.i: ; preds = %while.end.i18.i, %if.end6.i - indirectbr i8* blockaddress(@nopreheader3, %while.cond2.i.i), [label %while.cond2.i.i] - -while.cond2.i.i: ; preds = %while.cond2.i.i, %while.cond2.preheader.i.i - %i1.1.i14.i = phi i32 [ %add.i15.i, %while.cond2.i.i ], [ undef, %while.cond2.preheader.i.i ] - %add.i15.i = add nsw i32 %i1.1.i14.i, undef - indirectbr i8* blockaddress(@nopreheader3, %while.end.i18.i), [label %while.cond2.i.i, label %while.end.i18.i] - -while.end.i18.i: ; preds = %while.cond2.i.i - indirectbr i8* blockaddress(@nopreheader3, %while.cond2.preheader.i.i), [label %if.then12, label %while.cond2.preheader.i.i] - -if.then12: ; preds = %while.end.i18.i, %if.end6.i - %i1.0.lcssa.i.i = phi i32 [ undef, %if.end6.i ], [ %i1.1.i14.i, %while.end.i18.i ] - indirectbr i8* blockaddress(@nopreheader3, %if.end22), [label %if.end22] - -if.end22: ; preds = %if.then12, %if.end10, %entry - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/2012-03-26-constexpr.ll b/llvm/test/Transforms/LoopStrengthReduce/2012-03-26-constexpr.ll deleted file mode 100644 index ce6161cb1b4..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/2012-03-26-constexpr.ll +++ /dev/null @@ -1,49 +0,0 @@ -; RUN: opt < %s -loop-reduce -S -; PR11950: isHighCostExpansion crashes on ConstExpr -; -; The crash happened during IVChain analysis (CollectChains). We don't -; really care how LSR decides to transform this loop, so we don't -; check it. As long as the analysis doesn't crash we're ok. -target datalayout = "e-p:64:64:64-n32:64" - -%struct.this_structure_s.0.5 = type { [6144 x [8 x i32]], [6144 x [8 x i32]], [6147 x [4 x i32]], [8 x i32], [2 x i8*], [2 x i8*], [6144 x i8], [6144 x i32], [6144 x i32], [4 x [4 x i8]] } - -define internal fastcc void @someFunction(%struct.this_structure_s.0.5* nocapture %scratch, i32 %stage, i32 %cbSize) nounwind { -entry: - %0 = getelementptr inbounds %struct.this_structure_s.0.5, %struct.this_structure_s.0.5* %scratch, i32 0, i32 4, i32 %stage - %1 = load i8*, i8** %0, align 4 - %2 = getelementptr inbounds %struct.this_structure_s.0.5, %struct.this_structure_s.0.5* %scratch, i32 0, i32 5, i32 %stage - %3 = load i8*, i8** %2, align 4 - %4 = getelementptr inbounds %struct.this_structure_s.0.5, %struct.this_structure_s.0.5* %scratch, i32 0, i32 2, i32 0, i32 0 - %tmp11 = shl i32 %stage, 1 - %tmp1325 = or i32 %tmp11, 1 - br label %__label_D_1608 - -__label_D_1608: ; preds = %__label_D_1608, %entry - %i.12 = phi i32 [ 0, %entry ], [ %10, %__label_D_1608 ] - %tmp = shl i32 %i.12, 2 - %lvar_g.13 = getelementptr i32, i32* %4, i32 %tmp - %tmp626 = or i32 %tmp, 1 - %scevgep = getelementptr i32, i32* %4, i32 %tmp626 - %tmp727 = or i32 %tmp, 2 - %scevgep8 = getelementptr i32, i32* %4, i32 %tmp727 - %tmp928 = or i32 %tmp, 3 - %scevgep10 = getelementptr i32, i32* %4, i32 %tmp928 - %scevgep12 = getelementptr %struct.this_structure_s.0.5, %struct.this_structure_s.0.5* %scratch, i32 0, i32 9, i32 %tmp11, i32 %i.12 - %scevgep14 = getelementptr %struct.this_structure_s.0.5, %struct.this_structure_s.0.5* %scratch, i32 0, i32 9, i32 %tmp1325, i32 %i.12 - %5 = load i8, i8* %scevgep12, align 1 - %6 = sext i8 %5 to i32 - %7 = load i8, i8* %scevgep14, align 1 - %8 = sext i8 %7 to i32 - store i32 0, i32* %lvar_g.13, align 4 - store i32 %8, i32* %scevgep, align 4 - store i32 %6, i32* %scevgep8, align 4 - %9 = add nsw i32 %8, %6 - store i32 %9, i32* %scevgep10, align 4 - %10 = add nsw i32 %i.12, 1 - %exitcond = icmp eq i32 %10, 3 - br i1 %exitcond, label %return, label %__label_D_1608 - -return: ; preds = %__label_D_1608 - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/2012-07-13-ExpandUDiv.ll b/llvm/test/Transforms/LoopStrengthReduce/2012-07-13-ExpandUDiv.ll deleted file mode 100644 index 80095c3ac15..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/2012-07-13-ExpandUDiv.ll +++ /dev/null @@ -1,86 +0,0 @@ -; RUN: opt -loop-reduce -S < %s | FileCheck %s -; -; PR11356: likely wrong code bug -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-S128" -target triple = "x86_64-apple-darwin" - -@g_66 = global [1 x i32] zeroinitializer, align 4 -@g_775 = global i32 0, align 4 -@g_752 = global i32 0, align 4 -@g_3 = global i32 0, align 4 - -; Ensure that %div.i.i.us is not hoisted. -; CHECK-LABEL: @main( -; CHECK: for.body.i.i.us: -; CHECK: %div.i.i.i.us -; CHECK: %cmp5.i.i.us -define i32 @main() nounwind uwtable ssp { -entry: - %l_2 = alloca [1 x i32], align 4 - %arrayidx = getelementptr inbounds [1 x i32], [1 x i32]* %l_2, i64 0, i64 0 - store i32 0, i32* %arrayidx, align 4 - %tmp = load i32, i32* @g_3, align 4 - %idxprom = sext i32 %tmp to i64 - %arrayidx1 = getelementptr inbounds [1 x i32], [1 x i32]* %l_2, i64 0, i64 %idxprom - %tmp1 = load i32, i32* %arrayidx1, align 4 - %conv.i.i = and i32 %tmp1, 65535 - %tobool.i.i.i = icmp ne i32 %tmp, 0 - br label %codeRepl - -codeRepl.loopexit.us-lcssa: ; preds = %for.body.i.i, %codeRepl5 - br label %codeRepl.loopexit - -codeRepl.loopexit: ; preds = %codeRepl.loopexit.us-lcssa.us, %codeRepl.loopexit.us-lcssa - br label %codeRepl - -codeRepl: ; preds = %codeRepl.loopexit, %entry - br i1 %tobool.i.i.i, label %codeRepl.split.us, label %codeRepl.codeRepl.split_crit_edge - -codeRepl.codeRepl.split_crit_edge: ; preds = %codeRepl - br label %codeRepl.split - -codeRepl.split.us: ; preds = %codeRepl - br label %for.cond.i.i.us - -for.cond.i.i.us: ; preds = %for.inc.i.i.us, %codeRepl.split.us - %tmp2 = phi i32 [ 0, %codeRepl.split.us ], [ %add.i.i.us, %for.inc.i.i.us ] - br label %codeRepl5.us - -for.inc.i.i.us: ; preds = %for.body.i.i.us - %add.i.i.us = add nsw i32 %tmp2, 1 - store i32 %add.i.i.us, i32* @g_752, align 4 - br label %for.cond.i.i.us - -for.body.i.i.us: ; preds = %codeRepl5.us - %div.i.i.i.us = udiv i32 1, %conv.i.i - %cmp5.i.i.us = icmp eq i32 %div.i.i.i.us, %tmp2 - br i1 %cmp5.i.i.us, label %codeRepl.loopexit.us-lcssa.us, label %for.inc.i.i.us - -codeRepl5.us: ; preds = %for.cond.i.i.us - br i1 true, label %codeRepl.loopexit.us-lcssa.us, label %for.body.i.i.us - -codeRepl.loopexit.us-lcssa.us: ; preds = %codeRepl5.us, %for.body.i.i.us - br label %codeRepl.loopexit - -codeRepl.split: ; preds = %codeRepl.codeRepl.split_crit_edge - br label %for.cond.i.i - -for.cond.i.i: ; preds = %for.inc.i.i, %codeRepl.split - %tmp3 = phi i32 [ 0, %codeRepl.split ], [ %add.i.i, %for.inc.i.i ] - br label %codeRepl5 - -codeRepl5: ; preds = %for.cond.i.i - br i1 true, label %codeRepl.loopexit.us-lcssa, label %for.body.i.i - -for.body.i.i: ; preds = %codeRepl5 - %cmp5.i.i = icmp eq i32 0, %tmp3 - br i1 %cmp5.i.i, label %codeRepl.loopexit.us-lcssa, label %for.inc.i.i - -for.inc.i.i: ; preds = %for.body.i.i - %add.i.i = add nsw i32 %tmp3, 1 - store i32 %add.i.i, i32* @g_752, align 4 - br label %for.cond.i.i - -func_4.exit: ; No predecessors! - ret i32 0 -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/2012-07-18-LimitReassociate.ll b/llvm/test/Transforms/LoopStrengthReduce/2012-07-18-LimitReassociate.ll deleted file mode 100644 index aaac868dfd2..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/2012-07-18-LimitReassociate.ll +++ /dev/null @@ -1,518 +0,0 @@ -; RUN: opt -loop-reduce -disable-output -debug-only=loop-reduce < %s 2>&1 | FileCheck %s -; REQUIRES: asserts -; -; PR13361: LSR + SCEV "hangs" on reasonably sized test with sequence of loops -; -; Without limits on CollectSubexpr, we have thousands of formulae for -; the use that crosses loops. With limits we have five. -; CHECK: LSR on loop %bb221: -; CHECK: After generating reuse formulae: -; CHECK: LSR is examining the following uses: -; CHECK: LSR Use: Kind=Special -; CHECK: {{.*reg\(\{.*\{.*\{.*\{.*\{.*\{.*\{.*\{.*\{}} -; CHECK: {{.*reg\(\{.*\{.*\{.*\{.*\{.*\{.*\{.*\{.*\{}} -; CHECK: {{.*reg\(\{.*\{.*\{.*\{.*\{.*\{.*\{.*\{.*\{}} -; CHECK: {{.*reg\(\{.*\{.*\{.*\{.*\{.*\{.*\{.*\{.*\{}} -; CHECK: {{.*reg\(\{.*\{.*\{.*\{.*\{.*\{.*\{.*\{.*\{}} -; CHECK-NOT:reg -; CHECK: Filtering for use - -; Provide legal integer types. -target datalayout = "n8:16:32:64" - - -%struct.snork = type { %struct.fuga, i32, i32, i32, i32, i32, i32 } -%struct.fuga = type { %struct.gork, i64 } -%struct.gork = type { i8*, i32, i32, %struct.noot* } -%struct.noot = type opaque -%struct.jim = type { [5120 x i8], i32, i32, [2048 x i8], i32, [256 x i8] } - -@global = external global %struct.snork, align 8 -@global1 = external hidden unnamed_addr constant [52 x i8], align 1 -@global2 = external hidden unnamed_addr constant [18 x i8], align 1 -@global3 = external hidden global %struct.jim, align 32 -@global4 = external hidden unnamed_addr constant [40 x i8], align 1 - -declare void @snork(...) nounwind - -declare fastcc void @blarg() nounwind uwtable readonly - -define hidden fastcc void @boogle() nounwind uwtable { -bb: - %tmp = trunc i64 0 to i32 - %tmp1 = icmp slt i32 %tmp, 2047 - %tmp2 = add i32 0, -1 - %tmp3 = icmp ult i32 %tmp2, 255 - %tmp4 = and i1 %tmp1, %tmp3 - br i1 %tmp4, label %bb6, label %bb5 - -bb5: ; preds = %bb - tail call void (...) @snork(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @global1, i64 0, i64 0), i32 2021) nounwind - tail call void (...) @snork(i8* getelementptr inbounds (%struct.jim, %struct.jim* @global3, i64 0, i32 3, i64 1), i32 -2146631418) nounwind - unreachable - -bb6: ; preds = %bb - tail call void @zot(i8* getelementptr inbounds (%struct.jim, %struct.jim* @global3, i64 0, i32 5, i64 0), i8* getelementptr inbounds (%struct.jim, %struct.jim* @global3, i64 0, i32 3, i64 1), i64 undef, i32 1, i1 false) nounwind - %tmp7 = getelementptr inbounds %struct.jim, %struct.jim* @global3, i64 0, i32 5, i64 undef - store i8 0, i8* %tmp7, align 1 - %tmp8 = add nsw i32 0, 1 - %tmp9 = sext i32 %tmp8 to i64 - %tmp10 = add i64 %tmp9, 1 - %tmp11 = getelementptr inbounds %struct.jim, %struct.jim* @global3, i64 0, i32 3, i64 %tmp10 - %tmp12 = sub i64 2047, %tmp9 - %tmp13 = icmp eq i32 undef, 1 - br i1 %tmp13, label %bb14, label %bb15 - -bb14: ; preds = %bb6 - tail call fastcc void @blarg() - unreachable - -bb15: ; preds = %bb6 - %tmp16 = trunc i64 %tmp12 to i32 - br label %bb17 - -bb17: ; preds = %bb26, %bb15 - %tmp18 = phi i64 [ %tmp28, %bb26 ], [ 0, %bb15 ] - %tmp19 = phi i32 [ %tmp29, %bb26 ], [ 0, %bb15 ] - %tmp20 = trunc i64 %tmp18 to i32 - %tmp21 = icmp slt i32 %tmp20, %tmp16 - br i1 %tmp21, label %bb22, label %bb32 - -bb22: ; preds = %bb17 - %tmp23 = getelementptr inbounds %struct.jim, %struct.jim* @global3, i64 0, i32 3, i64 0 - %tmp24 = load i8, i8* %tmp23, align 1 - %tmp25 = icmp eq i8 %tmp24, 58 - br i1 %tmp25, label %bb30, label %bb26 - -bb26: ; preds = %bb22 - %tmp27 = icmp eq i8 %tmp24, 0 - %tmp28 = add i64 %tmp18, 1 - %tmp29 = add nsw i32 %tmp19, 1 - br i1 %tmp27, label %bb32, label %bb17 - -bb30: ; preds = %bb22 - %tmp31 = icmp ult i32 undef, 255 - br i1 %tmp31, label %bb33, label %bb32 - -bb32: ; preds = %bb30, %bb26, %bb17 - tail call void (...) @snork(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @global1, i64 0, i64 0), i32 2038) nounwind - tail call void (...) @snork(i8* %tmp11, i32 -2146631418) nounwind - unreachable - -bb33: ; preds = %bb30 - tail call void @zot(i8* getelementptr inbounds (%struct.jim, %struct.jim* @global3, i64 0, i32 5, i64 0), i8* %tmp11, i64 undef, i32 1, i1 false) nounwind - %tmp34 = getelementptr inbounds %struct.jim, %struct.jim* @global3, i64 0, i32 5, i64 undef - store i8 0, i8* %tmp34, align 1 - %tmp35 = add nsw i32 %tmp19, 1 - %tmp36 = sext i32 %tmp35 to i64 - %tmp37 = add i64 %tmp36, %tmp10 - %tmp38 = getelementptr inbounds %struct.jim, %struct.jim* @global3, i64 0, i32 3, i64 %tmp37 - %tmp39 = sub i64 %tmp12, %tmp36 - br i1 false, label %bb40, label %bb41 - -bb40: ; preds = %bb33 - br label %bb41 - -bb41: ; preds = %bb40, %bb33 - %tmp42 = trunc i64 %tmp39 to i32 - br label %bb43 - -bb43: ; preds = %bb52, %bb41 - %tmp44 = phi i64 [ %tmp53, %bb52 ], [ 0, %bb41 ] - %tmp45 = phi i32 [ %tmp54, %bb52 ], [ 0, %bb41 ] - %tmp46 = trunc i64 %tmp44 to i32 - %tmp47 = icmp slt i32 %tmp46, %tmp42 - br i1 %tmp47, label %bb48, label %bb58 - -bb48: ; preds = %bb43 - %tmp49 = add i64 %tmp44, %tmp37 - %tmp50 = load i8, i8* undef, align 1 - %tmp51 = icmp eq i8 %tmp50, 58 - br i1 %tmp51, label %bb55, label %bb52 - -bb52: ; preds = %bb48 - %tmp53 = add i64 %tmp44, 1 - %tmp54 = add nsw i32 %tmp45, 1 - br i1 undef, label %bb58, label %bb43 - -bb55: ; preds = %bb48 - %tmp56 = add i32 %tmp45, -1 - %tmp57 = icmp ult i32 %tmp56, 255 - br i1 %tmp57, label %bb59, label %bb58 - -bb58: ; preds = %bb55, %bb52, %bb43 - tail call void (...) @snork(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @global1, i64 0, i64 0), i32 2055) nounwind - tail call void (...) @snork(i8* %tmp38, i32 -2146631418) nounwind - br label %bb247 - -bb59: ; preds = %bb55 - %tmp60 = sext i32 %tmp45 to i64 - tail call void @zot(i8* getelementptr inbounds (%struct.jim, %struct.jim* @global3, i64 0, i32 5, i64 0), i8* %tmp38, i64 %tmp60, i32 1, i1 false) nounwind - %tmp61 = getelementptr inbounds %struct.jim, %struct.jim* @global3, i64 0, i32 5, i64 %tmp60 - store i8 0, i8* %tmp61, align 1 - %tmp62 = add nsw i32 %tmp45, 1 - %tmp63 = sext i32 %tmp62 to i64 - %tmp64 = add i64 %tmp63, %tmp37 - %tmp65 = sub i64 %tmp39, %tmp63 - %tmp66 = icmp eq i32 undef, 2 - br i1 %tmp66, label %bb67, label %bb68 - -bb67: ; preds = %bb59 - tail call fastcc void @blarg() - unreachable - -bb68: ; preds = %bb59 - switch i32 undef, label %bb71 [ - i32 0, label %bb74 - i32 -1, label %bb69 - ] - -bb69: ; preds = %bb68 - tail call void (...) @snork(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @global1, i64 0, i64 0), i32 2071) nounwind - %tmp70 = load i32, i32* getelementptr inbounds (%struct.snork, %struct.snork* @global, i64 0, i32 2), align 4 - unreachable - -bb71: ; preds = %bb68 - %tmp72 = load i32, i32* getelementptr inbounds (%struct.snork, %struct.snork* @global, i64 0, i32 4), align 4 - %tmp73 = icmp eq i32 undef, 0 - br i1 %tmp73, label %bb247, label %bb74 - -bb74: ; preds = %bb71, %bb68 - %tmp75 = trunc i64 %tmp65 to i32 - br label %bb76 - -bb76: ; preds = %bb82, %bb74 - %tmp77 = phi i64 [ %tmp84, %bb82 ], [ 0, %bb74 ] - %tmp78 = phi i32 [ %tmp85, %bb82 ], [ 0, %bb74 ] - %tmp79 = trunc i64 %tmp77 to i32 - %tmp80 = icmp slt i32 %tmp79, %tmp75 - br i1 %tmp80, label %bb81, label %bb87 - -bb81: ; preds = %bb76 - br i1 false, label %bb86, label %bb82 - -bb82: ; preds = %bb81 - %tmp83 = icmp eq i8 0, 0 - %tmp84 = add i64 %tmp77, 1 - %tmp85 = add nsw i32 %tmp78, 1 - br i1 %tmp83, label %bb87, label %bb76 - -bb86: ; preds = %bb81 - br i1 undef, label %bb88, label %bb87 - -bb87: ; preds = %bb86, %bb82, %bb76 - unreachable - -bb88: ; preds = %bb86 - %tmp89 = add nsw i32 %tmp78, 1 - %tmp90 = sext i32 %tmp89 to i64 - %tmp91 = add i64 %tmp90, %tmp64 - %tmp92 = sub i64 %tmp65, %tmp90 - br i1 false, label %bb93, label %bb94 - -bb93: ; preds = %bb88 - unreachable - -bb94: ; preds = %bb88 - %tmp95 = trunc i64 %tmp92 to i32 - br label %bb96 - -bb96: ; preds = %bb102, %bb94 - %tmp97 = phi i64 [ %tmp103, %bb102 ], [ 0, %bb94 ] - %tmp98 = phi i32 [ %tmp104, %bb102 ], [ 0, %bb94 ] - %tmp99 = trunc i64 %tmp97 to i32 - %tmp100 = icmp slt i32 %tmp99, %tmp95 - br i1 %tmp100, label %bb101, label %bb106 - -bb101: ; preds = %bb96 - br i1 undef, label %bb105, label %bb102 - -bb102: ; preds = %bb101 - %tmp103 = add i64 %tmp97, 1 - %tmp104 = add nsw i32 %tmp98, 1 - br i1 false, label %bb106, label %bb96 - -bb105: ; preds = %bb101 - br i1 undef, label %bb107, label %bb106 - -bb106: ; preds = %bb105, %bb102, %bb96 - br label %bb247 - -bb107: ; preds = %bb105 - %tmp108 = add nsw i32 %tmp98, 1 - %tmp109 = sext i32 %tmp108 to i64 - %tmp110 = add i64 %tmp109, %tmp91 - %tmp111 = sub i64 %tmp92, %tmp109 - br i1 false, label %bb112, label %bb113 - -bb112: ; preds = %bb107 - unreachable - -bb113: ; preds = %bb107 - %tmp114 = trunc i64 %tmp111 to i32 - br label %bb115 - -bb115: ; preds = %bb121, %bb113 - %tmp116 = phi i64 [ %tmp122, %bb121 ], [ 0, %bb113 ] - %tmp117 = phi i32 [ %tmp123, %bb121 ], [ 0, %bb113 ] - %tmp118 = trunc i64 %tmp116 to i32 - %tmp119 = icmp slt i32 %tmp118, %tmp114 - br i1 %tmp119, label %bb120, label %bb125 - -bb120: ; preds = %bb115 - br i1 undef, label %bb124, label %bb121 - -bb121: ; preds = %bb120 - %tmp122 = add i64 %tmp116, 1 - %tmp123 = add nsw i32 %tmp117, 1 - br i1 false, label %bb125, label %bb115 - -bb124: ; preds = %bb120 - br i1 false, label %bb126, label %bb125 - -bb125: ; preds = %bb124, %bb121, %bb115 - unreachable - -bb126: ; preds = %bb124 - %tmp127 = add nsw i32 %tmp117, 1 - %tmp128 = sext i32 %tmp127 to i64 - %tmp129 = add i64 %tmp128, %tmp110 - %tmp130 = sub i64 %tmp111, %tmp128 - tail call fastcc void @blarg() - br i1 false, label %bb132, label %bb131 - -bb131: ; preds = %bb126 - unreachable - -bb132: ; preds = %bb126 - %tmp133 = trunc i64 %tmp130 to i32 - br label %bb134 - -bb134: ; preds = %bb140, %bb132 - %tmp135 = phi i64 [ %tmp141, %bb140 ], [ 0, %bb132 ] - %tmp136 = phi i32 [ %tmp142, %bb140 ], [ 0, %bb132 ] - %tmp137 = trunc i64 %tmp135 to i32 - %tmp138 = icmp slt i32 %tmp137, %tmp133 - br i1 %tmp138, label %bb139, label %bb144 - -bb139: ; preds = %bb134 - br i1 false, label %bb143, label %bb140 - -bb140: ; preds = %bb139 - %tmp141 = add i64 %tmp135, 1 - %tmp142 = add nsw i32 %tmp136, 1 - br i1 false, label %bb144, label %bb134 - -bb143: ; preds = %bb139 - br i1 false, label %bb145, label %bb144 - -bb144: ; preds = %bb143, %bb140, %bb134 - br label %bb247 - -bb145: ; preds = %bb143 - %tmp146 = add nsw i32 %tmp136, 1 - %tmp147 = sext i32 %tmp146 to i64 - %tmp148 = add i64 %tmp147, %tmp129 - %tmp149 = sub i64 %tmp130, %tmp147 - switch i32 0, label %bb152 [ - i32 0, label %bb150 - i32 16, label %bb150 - i32 32, label %bb150 - i32 48, label %bb150 - i32 64, label %bb150 - i32 256, label %bb150 - i32 4096, label %bb150 - ] - -bb150: ; preds = %bb145, %bb145, %bb145, %bb145, %bb145, %bb145, %bb145 - %tmp151 = trunc i64 %tmp149 to i32 - br label %bb153 - -bb152: ; preds = %bb145 - unreachable - -bb153: ; preds = %bb160, %bb150 - %tmp154 = phi i64 [ %tmp161, %bb160 ], [ 0, %bb150 ] - %tmp155 = phi i32 [ %tmp162, %bb160 ], [ 0, %bb150 ] - %tmp156 = trunc i64 %tmp154 to i32 - %tmp157 = icmp slt i32 %tmp156, %tmp151 - br i1 %tmp157, label %bb158, label %bb166 - -bb158: ; preds = %bb153 - %tmp159 = add i64 %tmp154, %tmp148 - br i1 false, label %bb163, label %bb160 - -bb160: ; preds = %bb158 - %tmp161 = add i64 %tmp154, 1 - %tmp162 = add nsw i32 %tmp155, 1 - br i1 false, label %bb166, label %bb153 - -bb163: ; preds = %bb158 - %tmp164 = add i32 %tmp155, -1 - %tmp165 = icmp ult i32 %tmp164, 255 - br i1 %tmp165, label %bb167, label %bb166 - -bb166: ; preds = %bb163, %bb160, %bb153 - unreachable - -bb167: ; preds = %bb163 - %tmp168 = add nsw i32 %tmp155, 1 - %tmp169 = sext i32 %tmp168 to i64 - %tmp170 = add i64 %tmp169, %tmp148 - %tmp171 = sub i64 %tmp149, %tmp169 - br i1 false, label %bb173, label %bb172 - -bb172: ; preds = %bb167 - unreachable - -bb173: ; preds = %bb167 - %tmp174 = trunc i64 %tmp171 to i32 - br label %bb175 - -bb175: ; preds = %bb181, %bb173 - %tmp176 = phi i64 [ %tmp183, %bb181 ], [ 0, %bb173 ] - %tmp177 = phi i32 [ %tmp184, %bb181 ], [ 0, %bb173 ] - %tmp178 = trunc i64 %tmp176 to i32 - %tmp179 = icmp slt i32 %tmp178, %tmp174 - br i1 %tmp179, label %bb180, label %bb186 - -bb180: ; preds = %bb175 - br i1 false, label %bb185, label %bb181 - -bb181: ; preds = %bb180 - %tmp182 = icmp eq i8 0, 0 - %tmp183 = add i64 %tmp176, 1 - %tmp184 = add nsw i32 %tmp177, 1 - br i1 %tmp182, label %bb186, label %bb175 - -bb185: ; preds = %bb180 - br i1 false, label %bb187, label %bb186 - -bb186: ; preds = %bb185, %bb181, %bb175 - unreachable - -bb187: ; preds = %bb185 - %tmp188 = add nsw i32 %tmp177, 1 - %tmp189 = sext i32 %tmp188 to i64 - %tmp190 = sub i64 %tmp171, %tmp189 - br i1 false, label %bb192, label %bb191 - -bb191: ; preds = %bb187 - unreachable - -bb192: ; preds = %bb187 - %tmp193 = trunc i64 %tmp190 to i32 - br label %bb194 - -bb194: ; preds = %bb200, %bb192 - %tmp195 = phi i64 [ %tmp201, %bb200 ], [ 0, %bb192 ] - %tmp196 = phi i32 [ %tmp202, %bb200 ], [ 0, %bb192 ] - %tmp197 = trunc i64 %tmp195 to i32 - %tmp198 = icmp slt i32 %tmp197, %tmp193 - br i1 %tmp198, label %bb199, label %bb204 - -bb199: ; preds = %bb194 - br i1 false, label %bb203, label %bb200 - -bb200: ; preds = %bb199 - %tmp201 = add i64 %tmp195, 1 - %tmp202 = add nsw i32 %tmp196, 1 - br i1 false, label %bb204, label %bb194 - -bb203: ; preds = %bb199 - br i1 undef, label %bb205, label %bb204 - -bb204: ; preds = %bb203, %bb200, %bb194 - unreachable - -bb205: ; preds = %bb203 - %tmp206 = add nsw i32 %tmp196, 1 - %tmp207 = sext i32 %tmp206 to i64 - %tmp208 = add i64 %tmp207, 0 - %tmp209 = sub i64 %tmp190, %tmp207 - br i1 %tmp13, label %bb210, label %bb211 - -bb210: ; preds = %bb205 - unreachable - -bb211: ; preds = %bb205 - %tmp212 = trunc i64 %tmp209 to i32 - %tmp213 = icmp slt i32 0, %tmp212 - br i1 false, label %bb215, label %bb214 - -bb214: ; preds = %bb211 - unreachable - -bb215: ; preds = %bb211 - %tmp216 = add i64 undef, %tmp208 - %tmp217 = sub i64 %tmp209, undef - br i1 false, label %bb218, label %bb219 - -bb218: ; preds = %bb215 - br label %bb219 - -bb219: ; preds = %bb218, %bb215 - %tmp220 = trunc i64 %tmp217 to i32 - br label %bb221 - -bb221: ; preds = %bb230, %bb219 - %tmp222 = phi i64 [ %tmp231, %bb230 ], [ 0, %bb219 ] - %tmp223 = phi i32 [ %tmp232, %bb230 ], [ 0, %bb219 ] - %tmp224 = trunc i64 %tmp222 to i32 - %tmp225 = icmp slt i32 %tmp224, %tmp220 - br i1 %tmp225, label %bb226, label %bb234 - -bb226: ; preds = %bb221 - %tmp227 = add i64 %tmp222, %tmp216 - %tmp228 = getelementptr inbounds %struct.jim, %struct.jim* @global3, i64 0, i32 3, i64 %tmp227 - %tmp229 = load i8, i8* %tmp228, align 1 - br i1 false, label %bb233, label %bb230 - -bb230: ; preds = %bb226 - %tmp231 = add i64 %tmp222, 1 - %tmp232 = add nsw i32 %tmp223, 1 - br i1 undef, label %bb234, label %bb221 - -bb233: ; preds = %bb226 - br i1 undef, label %bb235, label %bb234 - -bb234: ; preds = %bb233, %bb230, %bb221 - br label %bb247 - -bb235: ; preds = %bb233 - %tmp236 = add nsw i32 %tmp223, 1 - %tmp237 = sext i32 %tmp236 to i64 - %tmp238 = sub i64 %tmp217, %tmp237 - br i1 %tmp66, label %bb239, label %bb240 - -bb239: ; preds = %bb235 - unreachable - -bb240: ; preds = %bb235 - switch i32 0, label %bb244 [ - i32 0, label %bb241 - i32 1, label %bb241 - i32 4, label %bb241 - i32 6, label %bb241 - i32 9, label %bb241 - ] - -bb241: ; preds = %bb240, %bb240, %bb240, %bb240, %bb240 - %tmp242 = trunc i64 %tmp238 to i32 - %tmp243 = icmp slt i32 0, %tmp242 - br i1 false, label %bb246, label %bb245 - -bb244: ; preds = %bb240 - unreachable - -bb245: ; preds = %bb241 - unreachable - -bb246: ; preds = %bb241 - unreachable - -bb247: ; preds = %bb234, %bb144, %bb106, %bb71, %bb58 - ret void -} - -declare void @zot(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind diff --git a/llvm/test/Transforms/LoopStrengthReduce/2013-01-05-IndBr.ll b/llvm/test/Transforms/LoopStrengthReduce/2013-01-05-IndBr.ll deleted file mode 100644 index 8a5a0a4c5fc..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/2013-01-05-IndBr.ll +++ /dev/null @@ -1,44 +0,0 @@ -; RUN: opt -loop-reduce -S < %s | FileCheck %s -; -; Indirect branch in the preheader crashes replaceCongruentIVs. -; rdar://12910141 - -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-S128" - -; CHECK-LABEL: @test( -; CHECK: bb8: -; CHECK-NEXT: phi i8 -; CHECK-NEXT: phi i8 -; CHECK: ret void -define void @test() nounwind ssp { -bb: - br label %bb190 - -bb8: ; preds = %bb190, %bb11 - %tmp = phi i8 [ %tmp14, %bb11 ], [ 25, %bb190 ] - %tmp9 = phi i8 [ %tmp12, %bb11 ], [ 25, %bb190 ] - %tmp10 = add i8 %tmp, -5 - indirectbr i8* undef, [label %bb11, label %bb15] - -bb11: ; preds = %bb8 - %tmp12 = add i8 %tmp9, 1 - %tmp13 = add i8 %tmp9, -19 - %tmp14 = add i8 %tmp, 1 - indirectbr i8* undef, [label %bb8] - -bb15: ; preds = %bb8 - indirectbr i8* undef, [label %bb16] - -bb16: ; preds = %bb16, %bb15 - indirectbr i8* undef, [label %bb37, label %bb190] - - -bb37: ; preds = %bb190 - indirectbr i8* undef, [label %bb38] - -bb38: ; preds = %bb37, %bb5 - ret void - -bb190: ; preds = %bb189, %bb187 - indirectbr i8* undef, [label %bb37, label %bb8] -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/2013-01-14-ReuseCast.ll b/llvm/test/Transforms/LoopStrengthReduce/2013-01-14-ReuseCast.ll deleted file mode 100644 index ea3f6077231..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/2013-01-14-ReuseCast.ll +++ /dev/null @@ -1,84 +0,0 @@ -; RUN: opt -loop-reduce -S < %s | FileCheck %s -; -; LTO of clang, which mistakenly uses no TargetLoweringInfo, causes a -; miscompile. ReuseOrCreateCast replace ptrtoint operand with undef. -; Reproducing the miscompile requires no triple, hence no "TTI". -; rdar://13007381 - -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-S128" - -; Verify that nothing uses the "dead" ptrtoint from "undef". -; CHECK-LABEL: @VerifyDiagnosticConsumerTest( -; CHECK: bb: -; "dead" ptrpoint not emitted (or dead code eliminated) with -; current LSR cost model. -; CHECK-NOT: = ptrtoint i8* undef to i64 -; CHECK: .lr.ph -; CHECK: [[TMP:%[^ ]+]] = add i64 %tmp{{[0-9]+}}, -1 -; CHECK: sub i64 [[TMP]], %tmp{{[0-9]+}} -; CHECK: ret void -define void @VerifyDiagnosticConsumerTest() unnamed_addr nounwind uwtable align 2 { -bb: - %tmp3 = call i8* @getCharData() nounwind - %tmp4 = call i8* @getCharData() nounwind - %tmp5 = ptrtoint i8* %tmp4 to i64 - %tmp6 = ptrtoint i8* %tmp3 to i64 - %tmp7 = sub i64 %tmp5, %tmp6 - br i1 undef, label %bb87, label %.preheader - -.preheader: ; preds = %bb10, %bb - br i1 undef, label %_ZNK4llvm9StringRef4findEcm.exit42.thread, label %bb10 - -bb10: ; preds = %.preheader - br i1 undef, label %_ZNK4llvm9StringRef4findEcm.exit42, label %.preheader - -_ZNK4llvm9StringRef4findEcm.exit42: ; preds = %bb10 - br i1 undef, label %_ZNK4llvm9StringRef4findEcm.exit42.thread, label %.lr.ph - -_ZNK4llvm9StringRef4findEcm.exit42.thread: ; preds = %_ZNK4llvm9StringRef4findEcm.exit42, %.preheader - unreachable - -.lr.ph: ; preds = %_ZNK4llvm9StringRef4findEcm.exit42 - br label %bb36 - -_ZNK4llvm9StringRef4findEcm.exit.loopexit: ; preds = %bb63 - %tmp21 = icmp eq i64 %i.0.i, -1 - br i1 %tmp21, label %_ZNK4llvm9StringRef4findEcm.exit._crit_edge, label %bb36 - -_ZNK4llvm9StringRef4findEcm.exit._crit_edge: ; preds = %bb61, %_ZNK4llvm9StringRef4findEcm.exit.loopexit - unreachable - -bb36: ; preds = %_ZNK4llvm9StringRef4findEcm.exit.loopexit, %.lr.ph - %loc.063 = phi i64 [ undef, %.lr.ph ], [ %i.0.i, %_ZNK4llvm9StringRef4findEcm.exit.loopexit ] - switch i8 undef, label %bb57 [ - i8 10, label %bb48 - i8 13, label %bb48 - ] - -bb48: ; preds = %bb36, %bb36 - br label %bb58 - -bb57: ; preds = %bb36 - br label %bb58 - -bb58: ; preds = %bb57, %bb48 - %tmp59 = icmp ugt i64 %tmp7, undef - %tmp60 = select i1 %tmp59, i64 undef, i64 %tmp7 - br label %bb61 - -bb61: ; preds = %bb63, %bb58 - %i.0.i = phi i64 [ %tmp60, %bb58 ], [ %tmp67, %bb63 ] - %tmp62 = icmp eq i64 %i.0.i, %tmp7 - br i1 %tmp62, label %_ZNK4llvm9StringRef4findEcm.exit._crit_edge, label %bb63 - -bb63: ; preds = %bb61 - %tmp64 = getelementptr inbounds i8, i8* %tmp3, i64 %i.0.i - %tmp65 = load i8, i8* %tmp64, align 1 - %tmp67 = add i64 %i.0.i, 1 - br i1 undef, label %_ZNK4llvm9StringRef4findEcm.exit.loopexit, label %bb61 - -bb87: ; preds = %bb - ret void -} - -declare i8* @getCharData() diff --git a/llvm/test/Transforms/LoopStrengthReduce/AArch64/lit.local.cfg b/llvm/test/Transforms/LoopStrengthReduce/AArch64/lit.local.cfg deleted file mode 100644 index 675f48e199a..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/AArch64/lit.local.cfg +++ /dev/null @@ -1,4 +0,0 @@ -config.suffixes = ['.ll'] - -if not 'AArch64' in config.root.targets: - config.unsupported = True diff --git a/llvm/test/Transforms/LoopStrengthReduce/AArch64/lsr-memcpy.ll b/llvm/test/Transforms/LoopStrengthReduce/AArch64/lsr-memcpy.ll deleted file mode 100644 index 2120b2a3bfe..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/AArch64/lsr-memcpy.ll +++ /dev/null @@ -1,33 +0,0 @@ -; RUN: llc -mtriple=arm64-unknown-unknown -mcpu=cyclone -pre-RA-sched=list-hybrid < %s | FileCheck %s -; rdar://10232252 -; Prevent LSR of doing poor choice that cannot be folded in addressing mode - -; Remove the -pre-RA-sched=list-hybrid option after fixing: -; <rdar://problem/12702735> [ARM64][coalescer] need better register -; coalescing for simple unit tests. - -; CHECK: testCase -; CHECK: %while.body{{$}} -; CHECK: ldr [[STREG:x[0-9]+]], [{{x[0-9]+}}], #8 -; CHECK-NEXT: str [[STREG]], [{{x[0-9]+}}], #8 -; CHECK: %while.end -define i32 @testCase() nounwind ssp { -entry: - br label %while.body - -while.body: ; preds = %while.body, %entry - %len.06 = phi i64 [ 1288, %entry ], [ %sub, %while.body ] - %pDst.05 = phi i64* [ inttoptr (i64 6442450944 to i64*), %entry ], [ %incdec.ptr1, %while.body ] - %pSrc.04 = phi i64* [ inttoptr (i64 4294967296 to i64*), %entry ], [ %incdec.ptr, %while.body ] - %incdec.ptr = getelementptr inbounds i64, i64* %pSrc.04, i64 1 - %tmp = load volatile i64, i64* %pSrc.04, align 8 - %incdec.ptr1 = getelementptr inbounds i64, i64* %pDst.05, i64 1 - store volatile i64 %tmp, i64* %pDst.05, align 8 - %sub = add i64 %len.06, -8 - %cmp = icmp sgt i64 %sub, -1 - br i1 %cmp, label %while.body, label %while.end - -while.end: ; preds = %while.body - tail call void inttoptr (i64 6442450944 to void ()*)() nounwind - ret i32 0 -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/AArch64/lsr-memset.ll b/llvm/test/Transforms/LoopStrengthReduce/AArch64/lsr-memset.ll deleted file mode 100644 index e84f675736d..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/AArch64/lsr-memset.ll +++ /dev/null @@ -1,101 +0,0 @@ -; RUN: llc < %s -O3 -mtriple=arm64-unknown-unknown -mcpu=cyclone -pre-RA-sched=list-hybrid | FileCheck %s -; <rdar://problem/11635990> [arm64] [lsr] Inefficient EA/loop-exit calc in bzero_phys -; -; LSR on loop %while.cond should reassociate non-address mode -; expressions at use %cmp16 to avoid sinking computation into %while.body18. -; -; Remove the -pre-RA-sched=list-hybrid option after fixing: -; <rdar://problem/12702735> [ARM64][coalescer] need better register -; coalescing for simple unit tests. - -; CHECK: @memset -; CHECK: %while.body18{{$}} -; CHECK: str x{{[0-9]+}}, [x{{[0-9]+}}], #8 -; First set the IVREG variable, then use it -; CHECK-NEXT: sub [[IVREG:x[0-9]+]], -; CHECK: [[IVREG]], #8 -; CHECK-NEXT: cmp [[IVREG]], #7 -; CHECK-NEXT: b.hi -define i8* @memset(i8* %dest, i32 %val, i64 %len) nounwind ssp noimplicitfloat { -entry: - %cmp = icmp eq i64 %len, 0 - br i1 %cmp, label %done, label %while.cond.preheader - -while.cond.preheader: ; preds = %entry - %conv = trunc i32 %val to i8 - br label %while.cond - -while.cond: ; preds = %while.body, %while.cond.preheader - %ptr.0 = phi i8* [ %incdec.ptr, %while.body ], [ %dest, %while.cond.preheader ] - %len.addr.0 = phi i64 [ %dec, %while.body ], [ %len, %while.cond.preheader ] - %cond = icmp eq i64 %len.addr.0, 0 - br i1 %cond, label %done, label %land.rhs - -land.rhs: ; preds = %while.cond - %0 = ptrtoint i8* %ptr.0 to i64 - %and = and i64 %0, 7 - %cmp5 = icmp eq i64 %and, 0 - br i1 %cmp5, label %if.end9, label %while.body - -while.body: ; preds = %land.rhs - %incdec.ptr = getelementptr inbounds i8, i8* %ptr.0, i64 1 - store i8 %conv, i8* %ptr.0, align 1, !tbaa !0 - %dec = add i64 %len.addr.0, -1 - br label %while.cond - -if.end9: ; preds = %land.rhs - %conv.mask = and i32 %val, 255 - %1 = zext i32 %conv.mask to i64 - %2 = shl nuw nsw i64 %1, 8 - %ins18 = or i64 %2, %1 - %3 = shl nuw nsw i64 %1, 16 - %ins15 = or i64 %ins18, %3 - %4 = shl nuw nsw i64 %1, 24 - %5 = shl nuw nsw i64 %1, 32 - %mask8 = or i64 %ins15, %4 - %6 = shl nuw nsw i64 %1, 40 - %mask5 = or i64 %mask8, %5 - %7 = shl nuw nsw i64 %1, 48 - %8 = shl nuw i64 %1, 56 - %mask2.masked = or i64 %mask5, %6 - %mask = or i64 %mask2.masked, %7 - %ins = or i64 %mask, %8 - %9 = bitcast i8* %ptr.0 to i64* - %cmp1636 = icmp ugt i64 %len.addr.0, 7 - br i1 %cmp1636, label %while.body18, label %while.body29.lr.ph - -while.body18: ; preds = %if.end9, %while.body18 - %wideptr.038 = phi i64* [ %incdec.ptr19, %while.body18 ], [ %9, %if.end9 ] - %len.addr.137 = phi i64 [ %sub, %while.body18 ], [ %len.addr.0, %if.end9 ] - %incdec.ptr19 = getelementptr inbounds i64, i64* %wideptr.038, i64 1 - store i64 %ins, i64* %wideptr.038, align 8, !tbaa !2 - %sub = add i64 %len.addr.137, -8 - %cmp16 = icmp ugt i64 %sub, 7 - br i1 %cmp16, label %while.body18, label %while.end20 - -while.end20: ; preds = %while.body18 - %cmp21 = icmp eq i64 %sub, 0 - br i1 %cmp21, label %done, label %while.body29.lr.ph - -while.body29.lr.ph: ; preds = %while.end20, %if.end9 - %len.addr.1.lcssa49 = phi i64 [ %sub, %while.end20 ], [ %len.addr.0, %if.end9 ] - %wideptr.0.lcssa48 = phi i64* [ %incdec.ptr19, %while.end20 ], [ %9, %if.end9 ] - %10 = bitcast i64* %wideptr.0.lcssa48 to i8* - br label %while.body29 - -while.body29: ; preds = %while.body29, %while.body29.lr.ph - %len.addr.235 = phi i64 [ %len.addr.1.lcssa49, %while.body29.lr.ph ], [ %dec26, %while.body29 ] - %ptr.134 = phi i8* [ %10, %while.body29.lr.ph ], [ %incdec.ptr31, %while.body29 ] - %dec26 = add i64 %len.addr.235, -1 - %incdec.ptr31 = getelementptr inbounds i8, i8* %ptr.134, i64 1 - store i8 %conv, i8* %ptr.134, align 1, !tbaa !0 - %cmp27 = icmp eq i64 %dec26, 0 - br i1 %cmp27, label %done, label %while.body29 - -done: ; preds = %while.cond, %while.body29, %while.end20, %entry - ret i8* %dest -} - -!0 = !{!"omnipotent char", !1} -!1 = !{!"Simple C/C++ TBAA"} -!2 = !{!"long long", !0} diff --git a/llvm/test/Transforms/LoopStrengthReduce/AArch64/lsr-reuse.ll b/llvm/test/Transforms/LoopStrengthReduce/AArch64/lsr-reuse.ll deleted file mode 100644 index a2dfe81b108..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/AArch64/lsr-reuse.ll +++ /dev/null @@ -1,34 +0,0 @@ -; RUN: llc -mtriple=arm64-unknown-unknown -print-lsr-output < %s 2>&1 | FileCheck %s - -declare void @foo(i64) - -; Verify that redundant adds aren't inserted by LSR. -; CHECK-LABEL: @bar( -define void @bar(double* %A) { -entry: - br label %while.cond - -while.cond: -; CHECK-LABEL: while.cond: -; CHECK: add i64 %lsr.iv, 1 -; CHECK-NOT: add i64 %lsr.iv, 1 -; CHECK-LABEL: land.rhs: - %indvars.iv28 = phi i64 [ %indvars.iv.next29, %land.rhs ], [ 50, %entry ] - %cmp = icmp sgt i64 %indvars.iv28, 0 - br i1 %cmp, label %land.rhs, label %while.end - -land.rhs: - %indvars.iv.next29 = add nsw i64 %indvars.iv28, -1 - %arrayidx = getelementptr inbounds double, double* %A, i64 %indvars.iv.next29 - %Aload = load double, double* %arrayidx, align 8 - %cmp1 = fcmp oeq double %Aload, 0.000000e+00 - br i1 %cmp1, label %while.cond, label %if.end - -while.end: - %indvars.iv28.lcssa = phi i64 [ %indvars.iv28, %while.cond ] - tail call void @foo(i64 %indvars.iv28.lcssa) - br label %if.end - -if.end: - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/AArch64/req-regs.ll b/llvm/test/Transforms/LoopStrengthReduce/AArch64/req-regs.ll deleted file mode 100644 index c877ace7abf..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/AArch64/req-regs.ll +++ /dev/null @@ -1,70 +0,0 @@ -; RUN: llc -mcpu=cyclone -debug-only=loop-reduce < %s 2>&1 | FileCheck %s -; REQUIRES: asserts - -; LSR used to fail here due to a bug in the ReqRegs test. -; CHECK: The chosen solution requires -; CHECK-NOT: No Satisfactory Solution - -target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" -target triple = "arm64-apple-ios" - -define void @do_integer_add(i64 %iterations, i8* nocapture readonly %cookie) { -entry: - %N = bitcast i8* %cookie to i32* - %0 = load i32, i32* %N, align 4 - %add = add nsw i32 %0, 57 - %cmp56 = icmp eq i64 %iterations, 0 - br i1 %cmp56, label %while.end, label %for.cond.preheader.preheader - -for.cond.preheader.preheader: ; preds = %entry - br label %for.cond.preheader - -while.cond.loopexit: ; preds = %for.body - %add21.lcssa = phi i32 [ %add21, %for.body ] - %dec58 = add i64 %dec58.in, -1 - %cmp = icmp eq i64 %dec58, 0 - br i1 %cmp, label %while.end.loopexit, label %for.cond.preheader - -for.cond.preheader: ; preds = %for.cond.preheader.preheader, %while.cond.loopexit - %dec58.in = phi i64 [ %dec58, %while.cond.loopexit ], [ %iterations, %for.cond.preheader.preheader ] - %a.057 = phi i32 [ %add21.lcssa, %while.cond.loopexit ], [ %add, %for.cond.preheader.preheader ] - br label %for.body - -for.body: ; preds = %for.body, %for.cond.preheader - %a.154 = phi i32 [ %a.057, %for.cond.preheader ], [ %add21, %for.body ] - %i.053 = phi i32 [ 1, %for.cond.preheader ], [ %inc, %for.body ] - %inc = add nsw i32 %i.053, 1 - %add2 = shl i32 %a.154, 1 - %add3 = add nsw i32 %add2, %i.053 - %add4 = shl i32 %add3, 1 - %add5 = add nsw i32 %add4, %i.053 - %add6 = shl i32 %add5, 1 - %add7 = add nsw i32 %add6, %i.053 - %add8 = shl i32 %add7, 1 - %add9 = add nsw i32 %add8, %i.053 - %add10 = shl i32 %add9, 1 - %add11 = add nsw i32 %add10, %i.053 - %add12 = shl i32 %add11, 1 - %add13 = add nsw i32 %add12, %i.053 - %add14 = shl i32 %add13, 1 - %add15 = add nsw i32 %add14, %i.053 - %add16 = shl i32 %add15, 1 - %add17 = add nsw i32 %add16, %i.053 - %add18 = shl i32 %add17, 1 - %add19 = add nsw i32 %add18, %i.053 - %add20 = shl i32 %add19, 1 - %add21 = add nsw i32 %add20, %i.053 - %exitcond = icmp eq i32 %inc, 1001 - br i1 %exitcond, label %while.cond.loopexit, label %for.body - -while.end.loopexit: ; preds = %while.cond.loopexit - %add21.lcssa.lcssa = phi i32 [ %add21.lcssa, %while.cond.loopexit ] - br label %while.end - -while.end: ; preds = %while.end.loopexit, %entry - %a.0.lcssa = phi i32 [ %add, %entry ], [ %add21.lcssa.lcssa, %while.end.loopexit ] - tail call void @use_int(i32 %a.0.lcssa) - ret void -} - -declare void @use_int(i32) diff --git a/llvm/test/Transforms/LoopStrengthReduce/AArch64/small-constant.ll b/llvm/test/Transforms/LoopStrengthReduce/AArch64/small-constant.ll deleted file mode 100644 index 04ad762df99..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/AArch64/small-constant.ll +++ /dev/null @@ -1,116 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py - -; RUN: llc < %s -mtriple=aarch64-unknown-unknown | FileCheck %s - -; Test LSR for giving small constants, which get re-associated as unfolded -; offset, a chance to get combined with loop-invariant registers (same as -; large constants which do not fit as add immediate operands). LSR -; favors here to bump the base pointer outside the loop. - -; float test(float *arr, long long start, float threshold) { -; for (long long i = start; i != 0; ++i) { -; float x = arr[i + 7]; -; if (x > threshold) -; return x; -; } -; return -7; -; } -define float @test1(float* nocapture readonly %arr, i64 %start, float %threshold) { -; CHECK-LABEL: test1: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: fmov s2, #-7.00000000 -; CHECK-NEXT: cbz x1, .LBB0_5 -; CHECK-NEXT: // %bb.1: // %for.body.preheader -; CHECK-NEXT: add x8, x0, #28 // =28 -; CHECK-NEXT: .LBB0_2: // %for.body -; CHECK-NEXT: // =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: ldr s1, [x8, x1, lsl #2] -; CHECK-NEXT: fcmp s1, s0 -; CHECK-NEXT: b.gt .LBB0_6 -; CHECK-NEXT: // %bb.3: // %for.cond -; CHECK-NEXT: // in Loop: Header=BB0_2 Depth=1 -; CHECK-NEXT: add x1, x1, #1 // =1 -; CHECK-NEXT: cbnz x1, .LBB0_2 -; CHECK-NEXT: // %bb.4: -; CHECK-NEXT: mov v0.16b, v2.16b -; CHECK-NEXT: ret -; CHECK-NEXT: .LBB0_5: -; CHECK-NEXT: mov v0.16b, v2.16b -; CHECK-NEXT: ret -; CHECK-NEXT: .LBB0_6: // %cleanup2 -; CHECK-NEXT: mov v0.16b, v1.16b -; CHECK-NEXT: ret -entry: - %cmp11 = icmp eq i64 %start, 0 - br i1 %cmp11, label %cleanup2, label %for.body - -for.cond: ; preds = %for.body - %cmp = icmp eq i64 %inc, 0 - br i1 %cmp, label %cleanup2, label %for.body - -for.body: ; preds = %entry, %for.cond - %i.012 = phi i64 [ %inc, %for.cond ], [ %start, %entry ] - %add = add nsw i64 %i.012, 7 - %arrayidx = getelementptr inbounds float, float* %arr, i64 %add - %0 = load float, float* %arrayidx, align 4 - %cmp1 = fcmp ogt float %0, %threshold - %inc = add nsw i64 %i.012, 1 - br i1 %cmp1, label %cleanup2, label %for.cond - -cleanup2: ; preds = %for.cond, %for.body, %entry - %1 = phi float [ -7.000000e+00, %entry ], [ %0, %for.body ], [ -7.000000e+00, %for.cond ] - ret float %1 -} - -; Same as test1, except i has another use: -; if (x > threshold) ---> if (x > threshold + i) -define float @test2(float* nocapture readonly %arr, i64 %start, float %threshold) { -; CHECK-LABEL: test2: -; CHECK: // %bb.0: // %entry -; CHECK-NEXT: fmov s2, #-7.00000000 -; CHECK-NEXT: cbz x1, .LBB1_5 -; CHECK-NEXT: // %bb.1: // %for.body.preheader -; CHECK-NEXT: add x8, x0, #28 // =28 -; CHECK-NEXT: .LBB1_2: // %for.body -; CHECK-NEXT: // =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: ldr s1, [x8, x1, lsl #2] -; CHECK-NEXT: scvtf s3, x1 -; CHECK-NEXT: fadd s3, s3, s0 -; CHECK-NEXT: fcmp s1, s3 -; CHECK-NEXT: b.gt .LBB1_6 -; CHECK-NEXT: // %bb.3: // %for.cond -; CHECK-NEXT: // in Loop: Header=BB1_2 Depth=1 -; CHECK-NEXT: add x1, x1, #1 // =1 -; CHECK-NEXT: cbnz x1, .LBB1_2 -; CHECK-NEXT: // %bb.4: -; CHECK-NEXT: mov v0.16b, v2.16b -; CHECK-NEXT: ret -; CHECK-NEXT: .LBB1_5: -; CHECK-NEXT: mov v0.16b, v2.16b -; CHECK-NEXT: ret -; CHECK-NEXT: .LBB1_6: // %cleanup4 -; CHECK-NEXT: mov v0.16b, v1.16b -; CHECK-NEXT: ret -entry: - %cmp14 = icmp eq i64 %start, 0 - br i1 %cmp14, label %cleanup4, label %for.body - -for.cond: ; preds = %for.body - %cmp = icmp eq i64 %inc, 0 - br i1 %cmp, label %cleanup4, label %for.body - -for.body: ; preds = %entry, %for.cond - %i.015 = phi i64 [ %inc, %for.cond ], [ %start, %entry ] - %add = add nsw i64 %i.015, 7 - %arrayidx = getelementptr inbounds float, float* %arr, i64 %add - %0 = load float, float* %arrayidx, align 4 - %conv = sitofp i64 %i.015 to float - %add1 = fadd float %conv, %threshold - %cmp2 = fcmp ogt float %0, %add1 - %inc = add nsw i64 %i.015, 1 - br i1 %cmp2, label %cleanup4, label %for.cond - -cleanup4: ; preds = %for.cond, %for.body, %entry - %1 = phi float [ -7.000000e+00, %entry ], [ %0, %for.body ], [ -7.000000e+00, %for.cond ] - ret float %1 -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/AMDGPU/atomics.ll b/llvm/test/Transforms/LoopStrengthReduce/AMDGPU/atomics.ll deleted file mode 100644 index f5846c5eebc..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/AMDGPU/atomics.ll +++ /dev/null @@ -1,167 +0,0 @@ -; RUN: opt -S -mtriple=amdgcn-- -mcpu=bonaire -loop-reduce < %s | FileCheck -check-prefix=OPT %s - -target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5" - -; Make sure the pointer / address space of AtomicRMW is considered - -; OPT-LABEL: @test_local_atomicrmw_addressing_loop_uniform_index_max_offset_i32( - -; OPT-NOT: getelementptr - -; OPT: .lr.ph: -; OPT: %lsr.iv2 = phi i32 addrspace(3)* [ %scevgep3, %.lr.ph ], [ %arg1, %.lr.ph.preheader ] -; OPT: %lsr.iv1 = phi i32 addrspace(3)* [ %scevgep, %.lr.ph ], [ %arg0, %.lr.ph.preheader ] -; OPT: %lsr.iv = phi i32 [ %lsr.iv.next, %.lr.ph ], [ %n, %.lr.ph.preheader ] -; OPT: %scevgep4 = getelementptr i32, i32 addrspace(3)* %lsr.iv2, i32 16383 -; OPT: %tmp4 = atomicrmw add i32 addrspace(3)* %scevgep4, i32 undef seq_cst -; OPT: %tmp7 = atomicrmw add i32 addrspace(3)* %lsr.iv1, i32 undef seq_cst -; OPT: %0 = atomicrmw add i32 addrspace(3)* %lsr.iv1, i32 %tmp8 seq_cst -; OPT: br i1 %exitcond -define amdgpu_kernel void @test_local_atomicrmw_addressing_loop_uniform_index_max_offset_i32(i32 addrspace(3)* noalias nocapture %arg0, i32 addrspace(3)* noalias nocapture readonly %arg1, i32 %n) #0 { -bb: - %tmp = icmp sgt i32 %n, 0 - br i1 %tmp, label %.lr.ph.preheader, label %._crit_edge - -.lr.ph.preheader: ; preds = %bb - br label %.lr.ph - -._crit_edge.loopexit: ; preds = %.lr.ph - br label %._crit_edge - -._crit_edge: ; preds = %._crit_edge.loopexit, %bb - ret void - -.lr.ph: ; preds = %.lr.ph, %.lr.ph.preheader - %indvars.iv = phi i32 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph.preheader ] - %tmp1 = add nuw nsw i32 %indvars.iv, 16383 - %tmp3 = getelementptr inbounds i32, i32 addrspace(3)* %arg1, i32 %tmp1 - %tmp4 = atomicrmw add i32 addrspace(3)* %tmp3, i32 undef seq_cst - %tmp6 = getelementptr inbounds i32, i32 addrspace(3)* %arg0, i32 %indvars.iv - %tmp7 = atomicrmw add i32 addrspace(3)* %tmp6, i32 undef seq_cst - %tmp8 = add nsw i32 %tmp7, %tmp4 - atomicrmw add i32 addrspace(3)* %tmp6, i32 %tmp8 seq_cst - %indvars.iv.next = add nuw nsw i32 %indvars.iv, 1 - %exitcond = icmp eq i32 %indvars.iv.next, %n - br i1 %exitcond, label %._crit_edge.loopexit, label %.lr.ph -} - -; OPT-LABEL: test_local_cmpxchg_addressing_loop_uniform_index_max_offset_i32( -; OPT-NOT: getelementptr - -; OPT: .lr.ph: -; OPT: %lsr.iv2 = phi i32 addrspace(3)* [ %scevgep3, %.lr.ph ], [ %arg1, %.lr.ph.preheader ] -; OPT: %lsr.iv1 = phi i32 addrspace(3)* [ %scevgep, %.lr.ph ], [ %arg0, %.lr.ph.preheader ] -; OPT: %lsr.iv = phi i32 [ %lsr.iv.next, %.lr.ph ], [ %n, %.lr.ph.preheader ] -; OPT: %scevgep4 = getelementptr i32, i32 addrspace(3)* %lsr.iv2, i32 16383 -; OPT: %tmp4 = cmpxchg i32 addrspace(3)* %scevgep4, i32 undef, i32 undef seq_cst monotonic -define amdgpu_kernel void @test_local_cmpxchg_addressing_loop_uniform_index_max_offset_i32(i32 addrspace(3)* noalias nocapture %arg0, i32 addrspace(3)* noalias nocapture readonly %arg1, i32 %n) #0 { -bb: - %tmp = icmp sgt i32 %n, 0 - br i1 %tmp, label %.lr.ph.preheader, label %._crit_edge - -.lr.ph.preheader: ; preds = %bb - br label %.lr.ph - -._crit_edge.loopexit: ; preds = %.lr.ph - br label %._crit_edge - -._crit_edge: ; preds = %._crit_edge.loopexit, %bb - ret void - -.lr.ph: ; preds = %.lr.ph, %.lr.ph.preheader - %indvars.iv = phi i32 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph.preheader ] - %tmp1 = add nuw nsw i32 %indvars.iv, 16383 - %tmp3 = getelementptr inbounds i32, i32 addrspace(3)* %arg1, i32 %tmp1 - %tmp4 = cmpxchg i32 addrspace(3)* %tmp3, i32 undef, i32 undef seq_cst monotonic - %tmp4.0 = extractvalue { i32, i1 } %tmp4, 0 - %tmp6 = getelementptr inbounds i32, i32 addrspace(3)* %arg0, i32 %indvars.iv - %tmp7 = cmpxchg i32 addrspace(3)* %tmp6, i32 undef, i32 undef seq_cst monotonic - %tmp7.0 = extractvalue { i32, i1 } %tmp7, 0 - %tmp8 = add nsw i32 %tmp7.0, %tmp4.0 - atomicrmw add i32 addrspace(3)* %tmp6, i32 %tmp8 seq_cst - %indvars.iv.next = add nuw nsw i32 %indvars.iv, 1 - %exitcond = icmp eq i32 %indvars.iv.next, %n - br i1 %exitcond, label %._crit_edge.loopexit, label %.lr.ph -} - -; OPT-LABEL: @test_local_atomicinc_addressing_loop_uniform_index_max_offset_i32( -; OPT-NOT: getelementptr - -; OPT: .lr.ph: -; OPT: %lsr.iv2 = phi i32 addrspace(3)* [ %scevgep3, %.lr.ph ], [ %arg1, %.lr.ph.preheader ] -; OPT: %lsr.iv1 = phi i32 addrspace(3)* [ %scevgep, %.lr.ph ], [ %arg0, %.lr.ph.preheader ] -; OPT: %lsr.iv = phi i32 [ %lsr.iv.next, %.lr.ph ], [ %n, %.lr.ph.preheader ] -; OPT: %scevgep4 = getelementptr i32, i32 addrspace(3)* %lsr.iv2, i32 16383 -; OPT: %tmp4 = call i32 @llvm.amdgcn.atomic.inc.i32.p3i32(i32 addrspace(3)* %scevgep4, i32 undef, i32 0, i32 0, i1 false) -; OPT: %tmp7 = call i32 @llvm.amdgcn.atomic.inc.i32.p3i32(i32 addrspace(3)* %lsr.iv1, i32 undef, i32 0, i32 0, i1 false) -define amdgpu_kernel void @test_local_atomicinc_addressing_loop_uniform_index_max_offset_i32(i32 addrspace(3)* noalias nocapture %arg0, i32 addrspace(3)* noalias nocapture readonly %arg1, i32 %n) #0 { -bb: - %tmp = icmp sgt i32 %n, 0 - br i1 %tmp, label %.lr.ph.preheader, label %._crit_edge - -.lr.ph.preheader: ; preds = %bb - br label %.lr.ph - -._crit_edge.loopexit: ; preds = %.lr.ph - br label %._crit_edge - -._crit_edge: ; preds = %._crit_edge.loopexit, %bb - ret void - -.lr.ph: ; preds = %.lr.ph, %.lr.ph.preheader - %indvars.iv = phi i32 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph.preheader ] - %tmp1 = add nuw nsw i32 %indvars.iv, 16383 - %tmp3 = getelementptr inbounds i32, i32 addrspace(3)* %arg1, i32 %tmp1 - %tmp4 = call i32 @llvm.amdgcn.atomic.inc.i32.p3i32(i32 addrspace(3)* %tmp3, i32 undef, i32 0, i32 0, i1 false) - %tmp6 = getelementptr inbounds i32, i32 addrspace(3)* %arg0, i32 %indvars.iv - %tmp7 = call i32 @llvm.amdgcn.atomic.inc.i32.p3i32(i32 addrspace(3)* %tmp6, i32 undef, i32 0, i32 0, i1 false) - %tmp8 = add nsw i32 %tmp7, %tmp4 - atomicrmw add i32 addrspace(3)* %tmp6, i32 %tmp8 seq_cst - %indvars.iv.next = add nuw nsw i32 %indvars.iv, 1 - %exitcond = icmp eq i32 %indvars.iv.next, %n - br i1 %exitcond, label %._crit_edge.loopexit, label %.lr.ph -} - -; OPT-LABEL: @test_local_atomicdec_addressing_loop_uniform_index_max_offset_i32( -; OPT-NOT: getelementptr - -; OPT: .lr.ph: -; OPT: %lsr.iv2 = phi i32 addrspace(3)* [ %scevgep3, %.lr.ph ], [ %arg1, %.lr.ph.preheader ] -; OPT: %lsr.iv1 = phi i32 addrspace(3)* [ %scevgep, %.lr.ph ], [ %arg0, %.lr.ph.preheader ] -; OPT: %lsr.iv = phi i32 [ %lsr.iv.next, %.lr.ph ], [ %n, %.lr.ph.preheader ] -; OPT: %scevgep4 = getelementptr i32, i32 addrspace(3)* %lsr.iv2, i32 16383 -; OPT: %tmp4 = call i32 @llvm.amdgcn.atomic.dec.i32.p3i32(i32 addrspace(3)* %scevgep4, i32 undef, i32 0, i32 0, i1 false) -; OPT: %tmp7 = call i32 @llvm.amdgcn.atomic.dec.i32.p3i32(i32 addrspace(3)* %lsr.iv1, i32 undef, i32 0, i32 0, i1 false) -define amdgpu_kernel void @test_local_atomicdec_addressing_loop_uniform_index_max_offset_i32(i32 addrspace(3)* noalias nocapture %arg0, i32 addrspace(3)* noalias nocapture readonly %arg1, i32 %n) #0 { -bb: - %tmp = icmp sgt i32 %n, 0 - br i1 %tmp, label %.lr.ph.preheader, label %._crit_edge - -.lr.ph.preheader: ; preds = %bb - br label %.lr.ph - -._crit_edge.loopexit: ; preds = %.lr.ph - br label %._crit_edge - -._crit_edge: ; preds = %._crit_edge.loopexit, %bb - ret void - -.lr.ph: ; preds = %.lr.ph, %.lr.ph.preheader - %indvars.iv = phi i32 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph.preheader ] - %tmp1 = add nuw nsw i32 %indvars.iv, 16383 - %tmp3 = getelementptr inbounds i32, i32 addrspace(3)* %arg1, i32 %tmp1 - %tmp4 = call i32 @llvm.amdgcn.atomic.dec.i32.p3i32(i32 addrspace(3)* %tmp3, i32 undef, i32 0, i32 0, i1 false) - %tmp6 = getelementptr inbounds i32, i32 addrspace(3)* %arg0, i32 %indvars.iv - %tmp7 = call i32 @llvm.amdgcn.atomic.dec.i32.p3i32(i32 addrspace(3)* %tmp6, i32 undef, i32 0, i32 0, i1 false) - %tmp8 = add nsw i32 %tmp7, %tmp4 - atomicrmw add i32 addrspace(3)* %tmp6, i32 %tmp8 seq_cst - %indvars.iv.next = add nuw nsw i32 %indvars.iv, 1 - %exitcond = icmp eq i32 %indvars.iv.next, %n - br i1 %exitcond, label %._crit_edge.loopexit, label %.lr.ph -} - -declare i32 @llvm.amdgcn.atomic.inc.i32.p3i32(i32 addrspace(3)* nocapture, i32, i32, i32, i1) #1 -declare i32 @llvm.amdgcn.atomic.dec.i32.p3i32(i32 addrspace(3)* nocapture, i32, i32, i32, i1) #1 - -attributes #0 = { nounwind } -attributes #1 = { nounwind argmemonly } diff --git a/llvm/test/Transforms/LoopStrengthReduce/AMDGPU/different-addrspace-addressing-mode-loops.ll b/llvm/test/Transforms/LoopStrengthReduce/AMDGPU/different-addrspace-addressing-mode-loops.ll deleted file mode 100644 index 568809b093c..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/AMDGPU/different-addrspace-addressing-mode-loops.ll +++ /dev/null @@ -1,156 +0,0 @@ -; RUN: opt -S -mtriple=amdgcn-- -mcpu=bonaire -loop-reduce < %s | FileCheck -check-prefix=OPT %s - -; Test that loops with different maximum offsets for different address -; spaces are correctly handled. - -target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5" - -; OPT-LABEL: @test_global_addressing_loop_uniform_index_max_offset_i32( -; OPT: {{^}}.lr.ph: -; OPT: %lsr.iv2 = phi i8 addrspace(1)* [ %scevgep3, %.lr.ph ], [ %arg1, %.lr.ph.preheader ] -; OPT: %scevgep4 = getelementptr i8, i8 addrspace(1)* %lsr.iv2, i64 4095 -; OPT: load i8, i8 addrspace(1)* %scevgep4, align 1 -define amdgpu_kernel void @test_global_addressing_loop_uniform_index_max_offset_i32(i32 addrspace(1)* noalias nocapture %arg0, i8 addrspace(1)* noalias nocapture readonly %arg1, i32 %n) #0 { -bb: - %tmp = icmp sgt i32 %n, 0 - br i1 %tmp, label %.lr.ph.preheader, label %._crit_edge - -.lr.ph.preheader: ; preds = %bb - br label %.lr.ph - -._crit_edge.loopexit: ; preds = %.lr.ph - br label %._crit_edge - -._crit_edge: ; preds = %._crit_edge.loopexit, %bb - ret void - -.lr.ph: ; preds = %.lr.ph, %.lr.ph.preheader - %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph.preheader ] - %tmp1 = add nuw nsw i64 %indvars.iv, 4095 - %tmp2 = getelementptr inbounds i8, i8 addrspace(1)* %arg1, i64 %tmp1 - %tmp3 = load i8, i8 addrspace(1)* %tmp2, align 1 - %tmp4 = sext i8 %tmp3 to i32 - %tmp5 = getelementptr inbounds i32, i32 addrspace(1)* %arg0, i64 %indvars.iv - %tmp6 = load i32, i32 addrspace(1)* %tmp5, align 4 - %tmp7 = add nsw i32 %tmp6, %tmp4 - store i32 %tmp7, i32 addrspace(1)* %tmp5, align 4 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 - %lftr.wideiv = trunc i64 %indvars.iv.next to i32 - %exitcond = icmp eq i32 %lftr.wideiv, %n - br i1 %exitcond, label %._crit_edge.loopexit, label %.lr.ph -} - -; OPT-LABEL: @test_global_addressing_loop_uniform_index_max_offset_p1_i32( -; OPT: {{^}}.lr.ph.preheader: -; OPT: %scevgep2 = getelementptr i8, i8 addrspace(1)* %arg1, i64 4096 -; OPT: br label %.lr.ph - -; OPT: {{^}}.lr.ph: -; OPT: %lsr.iv3 = phi i8 addrspace(1)* [ %scevgep4, %.lr.ph ], [ %scevgep2, %.lr.ph.preheader ] -; OPT: %scevgep4 = getelementptr i8, i8 addrspace(1)* %lsr.iv3, i64 1 -define amdgpu_kernel void @test_global_addressing_loop_uniform_index_max_offset_p1_i32(i32 addrspace(1)* noalias nocapture %arg0, i8 addrspace(1)* noalias nocapture readonly %arg1, i32 %n) #0 { -bb: - %tmp = icmp sgt i32 %n, 0 - br i1 %tmp, label %.lr.ph.preheader, label %._crit_edge - -.lr.ph.preheader: ; preds = %bb - br label %.lr.ph - -._crit_edge.loopexit: ; preds = %.lr.ph - br label %._crit_edge - -._crit_edge: ; preds = %._crit_edge.loopexit, %bb - ret void - -.lr.ph: ; preds = %.lr.ph, %.lr.ph.preheader - %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph.preheader ] - %tmp1 = add nuw nsw i64 %indvars.iv, 4096 - %tmp2 = getelementptr inbounds i8, i8 addrspace(1)* %arg1, i64 %tmp1 - %tmp3 = load i8, i8 addrspace(1)* %tmp2, align 1 - %tmp4 = sext i8 %tmp3 to i32 - %tmp5 = getelementptr inbounds i32, i32 addrspace(1)* %arg0, i64 %indvars.iv - %tmp6 = load i32, i32 addrspace(1)* %tmp5, align 4 - %tmp7 = add nsw i32 %tmp6, %tmp4 - store i32 %tmp7, i32 addrspace(1)* %tmp5, align 4 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 - %lftr.wideiv = trunc i64 %indvars.iv.next to i32 - %exitcond = icmp eq i32 %lftr.wideiv, %n - br i1 %exitcond, label %._crit_edge.loopexit, label %.lr.ph -} - -; OPT-LABEL: @test_local_addressing_loop_uniform_index_max_offset_i32( -; OPT: {{^}}.lr.ph -; OPT: %lsr.iv2 = phi i8 addrspace(3)* [ %scevgep3, %.lr.ph ], [ %arg1, %.lr.ph.preheader ] -; OPT: %scevgep4 = getelementptr i8, i8 addrspace(3)* %lsr.iv2, i32 65535 -; OPT: %tmp4 = load i8, i8 addrspace(3)* %scevgep4, align 1 -define amdgpu_kernel void @test_local_addressing_loop_uniform_index_max_offset_i32(i32 addrspace(1)* noalias nocapture %arg0, i8 addrspace(3)* noalias nocapture readonly %arg1, i32 %n) #0 { -bb: - %tmp = icmp sgt i32 %n, 0 - br i1 %tmp, label %.lr.ph.preheader, label %._crit_edge - -.lr.ph.preheader: ; preds = %bb - br label %.lr.ph - -._crit_edge.loopexit: ; preds = %.lr.ph - br label %._crit_edge - -._crit_edge: ; preds = %._crit_edge.loopexit, %bb - ret void - -.lr.ph: ; preds = %.lr.ph, %.lr.ph.preheader - %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph.preheader ] - %tmp1 = add nuw nsw i64 %indvars.iv, 65535 - %tmp2 = trunc i64 %tmp1 to i32 - %tmp3 = getelementptr inbounds i8, i8 addrspace(3)* %arg1, i32 %tmp2 - %tmp4 = load i8, i8 addrspace(3)* %tmp3, align 1 - %tmp5 = sext i8 %tmp4 to i32 - %tmp6 = getelementptr inbounds i32, i32 addrspace(1)* %arg0, i64 %indvars.iv - %tmp7 = load i32, i32 addrspace(1)* %tmp6, align 4 - %tmp8 = add nsw i32 %tmp7, %tmp5 - store i32 %tmp8, i32 addrspace(1)* %tmp6, align 4 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 - %lftr.wideiv = trunc i64 %indvars.iv.next to i32 - %exitcond = icmp eq i32 %lftr.wideiv, %n - br i1 %exitcond, label %._crit_edge.loopexit, label %.lr.ph -} - -; OPT-LABEL: @test_local_addressing_loop_uniform_index_max_offset_p1_i32( -; OPT: {{^}}.lr.ph.preheader: -; OPT: %scevgep2 = getelementptr i8, i8 addrspace(3)* %arg1, i32 65536 -; OPT: br label %.lr.ph - -; OPT: {{^}}.lr.ph: -; OPT: %lsr.iv3 = phi i8 addrspace(3)* [ %scevgep4, %.lr.ph ], [ %scevgep2, %.lr.ph.preheader ] -; OPT: %scevgep4 = getelementptr i8, i8 addrspace(3)* %lsr.iv3, i32 1 -define amdgpu_kernel void @test_local_addressing_loop_uniform_index_max_offset_p1_i32(i32 addrspace(1)* noalias nocapture %arg0, i8 addrspace(3)* noalias nocapture readonly %arg1, i32 %n) #0 { -bb: - %tmp = icmp sgt i32 %n, 0 - br i1 %tmp, label %.lr.ph.preheader, label %._crit_edge - -.lr.ph.preheader: ; preds = %bb - br label %.lr.ph - -._crit_edge.loopexit: ; preds = %.lr.ph - br label %._crit_edge - -._crit_edge: ; preds = %._crit_edge.loopexit, %bb - ret void - -.lr.ph: ; preds = %.lr.ph, %.lr.ph.preheader - %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph.preheader ] - %tmp1 = add nuw nsw i64 %indvars.iv, 65536 - %tmp2 = trunc i64 %tmp1 to i32 - %tmp3 = getelementptr inbounds i8, i8 addrspace(3)* %arg1, i32 %tmp2 - %tmp4 = load i8, i8 addrspace(3)* %tmp3, align 1 - %tmp5 = sext i8 %tmp4 to i32 - %tmp6 = getelementptr inbounds i32, i32 addrspace(1)* %arg0, i64 %indvars.iv - %tmp7 = load i32, i32 addrspace(1)* %tmp6, align 4 - %tmp8 = add nsw i32 %tmp7, %tmp5 - store i32 %tmp8, i32 addrspace(1)* %tmp6, align 4 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 - %lftr.wideiv = trunc i64 %indvars.iv.next to i32 - %exitcond = icmp eq i32 %lftr.wideiv, %n - br i1 %exitcond, label %._crit_edge.loopexit, label %.lr.ph -} - -attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="hawaii" "unsafe-fp-math"="false" "use-soft-float"="false" } diff --git a/llvm/test/Transforms/LoopStrengthReduce/AMDGPU/different-addrspace-crash.ll b/llvm/test/Transforms/LoopStrengthReduce/AMDGPU/different-addrspace-crash.ll deleted file mode 100644 index d558aa24304..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/AMDGPU/different-addrspace-crash.ll +++ /dev/null @@ -1,30 +0,0 @@ -; RUN: llc < %s | FileCheck %s - -target triple = "amdgcn--" - -; We need to compile this for a target where we have different address spaces, -; and where pointers in those address spaces have different size. -; E.g. for amdgcn-- pointers in address space 0 are 32 bits and pointers in -; address space 1 are 64 bits. - -; We shouldn't crash. Check that we get a loop with the two stores. -;CHECK-LABEL: foo: -;CHECK: [[LOOP_LABEL:BB[0-9]+_[0-9]+]]: -;CHECK: buffer_store_dword -;CHECK: buffer_store_dword -;CHECK: s_branch [[LOOP_LABEL]] - -define amdgpu_kernel void @foo() { -entry: - br label %loop - -loop: - %idx0 = phi i32 [ %next_idx0, %loop ], [ 0, %entry ] - %0 = getelementptr inbounds i32, i32 addrspace(5)* null, i32 %idx0 - %1 = getelementptr inbounds i32, i32 addrspace(1)* null, i32 %idx0 - store i32 1, i32 addrspace(5)* %0 - store i32 7, i32 addrspace(1)* %1 - %next_idx0 = add nuw nsw i32 %idx0, 1 - br label %loop -} - diff --git a/llvm/test/Transforms/LoopStrengthReduce/AMDGPU/lit.local.cfg b/llvm/test/Transforms/LoopStrengthReduce/AMDGPU/lit.local.cfg deleted file mode 100644 index 6baccf05fff..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/AMDGPU/lit.local.cfg +++ /dev/null @@ -1,3 +0,0 @@ -if not 'AMDGPU' in config.root.targets: - config.unsupported = True - diff --git a/llvm/test/Transforms/LoopStrengthReduce/AMDGPU/lsr-postinc-pos-addrspace.ll b/llvm/test/Transforms/LoopStrengthReduce/AMDGPU/lsr-postinc-pos-addrspace.ll deleted file mode 100644 index fdbd0dada2c..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/AMDGPU/lsr-postinc-pos-addrspace.ll +++ /dev/null @@ -1,131 +0,0 @@ -; RUN: llc -march=amdgcn -mcpu=bonaire -print-lsr-output < %s 2>&1 | FileCheck %s - -; Test various conditions where OptimizeLoopTermCond doesn't look at a -; memory instruction use and fails to find the address space. - -target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5" - -; CHECK-LABEL: @local_cmp_user( -; CHECK: bb11: -; CHECK: %lsr.iv1 = phi i32 [ %lsr.iv.next2, %bb ], [ 2, %entry ] -; CHECK: %lsr.iv = phi i32 [ %lsr.iv.next, %bb ], [ %{{[0-9]+}}, %entry ] -; CHECK: %lsr.iv.next = add i32 %lsr.iv, -1 -; CHECK: %lsr.iv.next2 = add i32 %lsr.iv1, -2 -; CHECK: br i1 - -; CHECK: bb: -; CHECK: inttoptr i32 %lsr.iv.next2 to i8 addrspace(3)* -; CHECK: %c1 = icmp ne i8 addrspace(3)* -define amdgpu_kernel void @local_cmp_user(i32 %arg0) nounwind { -entry: - br label %bb11 - -bb11: - %i = phi i32 [ 0, %entry ], [ %i.next, %bb ] - %ii = shl i32 %i, 1 - %c0 = icmp eq i32 %i, %arg0 - br i1 %c0, label %bb13, label %bb - -bb: - %t = load i8 addrspace(3)*, i8 addrspace(3)* addrspace(3)* undef - %p = getelementptr i8, i8 addrspace(3)* %t, i32 %ii - %c1 = icmp ne i8 addrspace(3)* %p, null - %i.next = add i32 %i, 1 - br i1 %c1, label %bb11, label %bb13 - -bb13: - unreachable -} - -; CHECK-LABEL: @global_cmp_user( -; CHECK: %lsr.iv1 = phi i64 -; CHECK: %lsr.iv = phi i64 -; CHECK: %lsr.iv.next = add i64 %lsr.iv, -1 -; CHECK: %lsr.iv.next2 = add i64 %lsr.iv1, -2 -; CHECK: br i1 - -; CHECK: bb: -; CHECK: inttoptr i64 %lsr.iv.next2 to i8 addrspace(1)* -; CHECK: icmp ne i8 addrspace(1)* %t -define amdgpu_kernel void @global_cmp_user(i64 %arg0) nounwind { -entry: - br label %bb11 - -bb11: - %i = phi i64 [ 0, %entry ], [ %i.next, %bb ] - %ii = shl i64 %i, 1 - %c0 = icmp eq i64 %i, %arg0 - br i1 %c0, label %bb13, label %bb - -bb: - %t = load i8 addrspace(1)*, i8 addrspace(1)* addrspace(1)* undef - %p = getelementptr i8, i8 addrspace(1)* %t, i64 %ii - %c1 = icmp ne i8 addrspace(1)* %p, null - %i.next = add i64 %i, 1 - br i1 %c1, label %bb11, label %bb13 - -bb13: - unreachable -} - -; CHECK-LABEL: @global_gep_user( -; CHECK: %lsr.iv1 = phi i32 [ %lsr.iv.next2, %bb ], [ 0, %entry ] -; CHECK: %lsr.iv = phi i32 [ %lsr.iv.next, %bb ], [ %{{[0-9]+}}, %entry ] -; CHECK: %lsr.iv.next = add i32 %lsr.iv, -1 -; CHECK: %lsr.iv.next2 = add i32 %lsr.iv1, 2 -; CHECK: br i1 - -; CHECK: bb: -; CHECK: %idxprom = sext i32 %lsr.iv1 to i64 -; CHECK: getelementptr i8, i8 addrspace(1)* %t, i64 %idxprom -define amdgpu_kernel void @global_gep_user(i32 %arg0) nounwind { -entry: - br label %bb11 - -bb11: - %i = phi i32 [ 0, %entry ], [ %i.next, %bb ] - %ii = shl i32 %i, 1 - %c0 = icmp eq i32 %i, %arg0 - br i1 %c0, label %bb13, label %bb - -bb: - %t = load i8 addrspace(1)*, i8 addrspace(1)* addrspace(1)* undef - %p = getelementptr i8, i8 addrspace(1)* %t, i32 %ii - %c1 = icmp ne i8 addrspace(1)* %p, null - %i.next = add i32 %i, 1 - br i1 %c1, label %bb11, label %bb13 - -bb13: - unreachable -} - -; CHECK-LABEL: @global_sext_scale_user( -; CHECK: %lsr.iv1 = phi i32 [ %lsr.iv.next2, %bb ], [ 0, %entry ] -; CHECK: %lsr.iv = phi i32 [ %lsr.iv.next, %bb ], [ %{{[0-9]+}}, %entry ] -; CHECK: %lsr.iv.next = add i32 %lsr.iv, -1 -; CHECK: %lsr.iv.next2 = add i32 %lsr.iv1, 2 -; CHECK: br i1 - -; CHECK: bb -; CHECK: %p = getelementptr i8, i8 addrspace(1)* %t, i64 %ii.ext -define amdgpu_kernel void @global_sext_scale_user(i32 %arg0) nounwind { -entry: - br label %bb11 - -bb11: - %i = phi i32 [ 0, %entry ], [ %i.next, %bb ] - %ii = shl i32 %i, 1 - %ii.ext = sext i32 %ii to i64 - %c0 = icmp eq i32 %i, %arg0 - br i1 %c0, label %bb13, label %bb - -bb: - %t = load i8 addrspace(1)*, i8 addrspace(1)* addrspace(1)* undef - %p = getelementptr i8, i8 addrspace(1)* %t, i64 %ii.ext - %c1 = icmp ne i8 addrspace(1)* %p, null - %i.next = add i32 %i, 1 - br i1 %c1, label %bb11, label %bb13 - -bb13: - unreachable -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/AMDGPU/lsr-void.ll b/llvm/test/Transforms/LoopStrengthReduce/AMDGPU/lsr-void.ll deleted file mode 100644 index 9a32fbec4f5..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/AMDGPU/lsr-void.ll +++ /dev/null @@ -1,37 +0,0 @@ -; RUN: llc -march=amdgcn < %s | FileCheck -check-prefix=GCN %s - -@array = external addrspace(4) constant [32 x [800 x i32]], align 4 - -; GCN-LABEL: {{^}}test_lsr_voidty: -define amdgpu_kernel void @test_lsr_voidty() { -entry: - br label %for.body - -for.body: ; preds = %for.body.i, %entry - br label %for.body.i - -for.body.i: ; preds = %for.body.i, %for.body - %ij = phi i32 [ 0, %for.body ], [ %inc14, %for.body.i ] - %tmp = load i32, i32 addrspace(5)* undef, align 4 - %inc13 = or i32 %ij, 2 - %shl = shl i32 1, 0 - %and = and i32 %shl, %tmp - %tobool = icmp eq i32 %and, 0 - %add = mul nuw nsw i32 %inc13, 5 - %tmp1 = zext i32 %add to i64 - %arrayidx8 = getelementptr inbounds [32 x [800 x i32]], [32 x [800 x i32]] addrspace(4)* @array, i64 0, i64 undef, i64 %tmp1 - %tmp2 = load i32, i32 addrspace(4)* %arrayidx8, align 4 - %and9 = select i1 %tobool, i32 0, i32 %tmp2 - %xor = xor i32 undef, %and9 - %inc1 = or i32 %ij, 3 - %add2 = mul nuw nsw i32 %inc1, 5 - %add6 = add nuw nsw i32 %add2, 1 - %tmp3 = zext i32 %add6 to i64 - %arrayidx9 = getelementptr inbounds [32 x [800 x i32]], [32 x [800 x i32]] addrspace(4)* @array, i64 0, i64 undef, i64 %tmp3 - %tmp4 = bitcast i32 addrspace(4)* %arrayidx9 to <4 x i32> addrspace(4)* - %tmp5 = load <4 x i32>, <4 x i32> addrspace(4)* %tmp4, align 4 - %reorder_shuffle2 = shufflevector <4 x i32> %tmp5, <4 x i32> undef, <4 x i32> <i32 3, i32 2, i32 1, i32 0> - %tmp6 = select <4 x i1> undef, <4 x i32> zeroinitializer, <4 x i32> %reorder_shuffle2 - %inc14 = add nuw nsw i32 %ij, 4 - br i1 undef, label %for.body, label %for.body.i -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/AMDGPU/preserve-addrspace-assert.ll b/llvm/test/Transforms/LoopStrengthReduce/AMDGPU/preserve-addrspace-assert.ll deleted file mode 100644 index 38ff1708f42..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/AMDGPU/preserve-addrspace-assert.ll +++ /dev/null @@ -1,95 +0,0 @@ -; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -loop-reduce %s | FileCheck %s - -; Test for assert resulting from inconsistent isLegalAddressingMode -; answers when the address space was dropped from the query. - -target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5" - -%0 = type { i32, double, i32, float } - -; CHECK-LABEL: @lsr_crash_preserve_addrspace_unknown_type( -; CHECK: %tmp4 = bitcast %0 addrspace(3)* %tmp to double addrspace(3)* -; CHECK: %scevgep5 = getelementptr double, double addrspace(3)* %tmp4, i32 1 -; CHECK: load double, double addrspace(3)* %scevgep5 - -; CHECK: %scevgep = getelementptr i32, i32 addrspace(3)* %tmp1, i32 4 -; CHECK:%tmp14 = load i32, i32 addrspace(3)* %scevgep -define amdgpu_kernel void @lsr_crash_preserve_addrspace_unknown_type() #0 { -bb: - br label %bb1 - -bb1: ; preds = %bb17, %bb - %tmp = phi %0 addrspace(3)* [ undef, %bb ], [ %tmp18, %bb17 ] - %tmp2 = getelementptr inbounds %0, %0 addrspace(3)* %tmp, i64 0, i32 1 - %tmp3 = load double, double addrspace(3)* %tmp2, align 8 - br label %bb4 - -bb4: ; preds = %bb1 - br i1 undef, label %bb8, label %bb5 - -bb5: ; preds = %bb4 - unreachable - -bb8: ; preds = %bb4 - %tmp9 = getelementptr inbounds %0, %0 addrspace(3)* %tmp, i64 0, i32 0 - %tmp10 = load i32, i32 addrspace(3)* %tmp9, align 4 - %tmp11 = icmp eq i32 0, %tmp10 - br i1 %tmp11, label %bb12, label %bb17 - -bb12: ; preds = %bb8 - %tmp13 = getelementptr inbounds %0, %0 addrspace(3)* %tmp, i64 0, i32 2 - %tmp14 = load i32, i32 addrspace(3)* %tmp13, align 4 - %tmp15 = icmp eq i32 0, %tmp14 - br i1 %tmp15, label %bb16, label %bb17 - -bb16: ; preds = %bb12 - unreachable - -bb17: ; preds = %bb12, %bb8 - %tmp18 = getelementptr inbounds %0, %0 addrspace(3)* %tmp, i64 2 - br label %bb1 -} - -; CHECK-LABEL: @lsr_crash_preserve_addrspace_unknown_type2( -; CHECK: %scevgep3 = getelementptr i8, i8 addrspace(5)* %array, i32 %j -; CHECK: %scevgep2 = getelementptr i8, i8 addrspace(5)* %array, i32 %j -; CHECK: %n8 = load i8, i8 addrspace(5)* %scevgep2, align 4 -; CHECK: call void @llvm.memcpy.p5i8.p3i8.i64(i8 addrspace(5)* %scevgep3, i8 addrspace(3)* %scevgep4, i64 42, i1 false) -; CHECK: call void @llvm.memmove.p5i8.p3i8.i64(i8 addrspace(5)* %scevgep3, i8 addrspace(3)* %scevgep4, i64 42, i1 false) -; CHECK: call void @llvm.memset.p5i8.i64(i8 addrspace(5)* %scevgep3, i8 42, i64 42, i1 false) -define void @lsr_crash_preserve_addrspace_unknown_type2(i8 addrspace(5)* %array, i8 addrspace(3)* %array2) { -entry: - br label %for.body - -for.body: ; preds = %entry, %for.inc - %j = phi i32 [ %add, %for.inc ], [ 0, %entry ] - %idx = getelementptr inbounds i8, i8 addrspace(5)* %array, i32 %j - %idx1 = getelementptr inbounds i8, i8 addrspace(3)* %array2, i32 %j - %t = getelementptr inbounds i8, i8 addrspace(5)* %array, i32 %j - %n8 = load i8, i8 addrspace(5)* %t, align 4 - %n7 = getelementptr inbounds i8, i8 addrspace(5)* %t, i32 42 - %n9 = load i8, i8 addrspace(5)* %n7, align 4 - %cmp = icmp sgt i32 %j, 42 - %add = add nuw nsw i32 %j, 1 - br i1 %cmp, label %if.then17, label %for.inc - -if.then17: ; preds = %for.body - call void @llvm.memcpy.p5i8.p5i8.i64(i8 addrspace(5)* %idx, i8 addrspace(3)* %idx1, i64 42, i1 false) - call void @llvm.memmove.p5i8.p5i8.i64(i8 addrspace(5)* %idx, i8 addrspace(3)* %idx1, i64 42, i1 false) - call void @llvm.memset.p5i8.i64(i8 addrspace(5)* %idx, i8 42, i64 42, i1 false) - br label %for.inc - -for.inc: ; preds = %for.body, %if.then17 - %exitcond = icmp eq i1 %cmp, 1 - br i1 %exitcond, label %end, label %for.body - -end: ; preds = %for.inc - ret void -} - -declare void @llvm.memcpy.p5i8.p5i8.i64(i8 addrspace(5)*, i8 addrspace(3)*, i64, i1) -declare void @llvm.memmove.p5i8.p5i8.i64(i8 addrspace(5)*, i8 addrspace(3)*, i64, i1) -declare void @llvm.memset.p5i8.i64(i8 addrspace(5)*, i8, i64, i1) - -attributes #0 = { nounwind } -attributes #1 = { nounwind readnone } diff --git a/llvm/test/Transforms/LoopStrengthReduce/ARM/2012-06-15-lsr-noaddrmode.ll b/llvm/test/Transforms/LoopStrengthReduce/ARM/2012-06-15-lsr-noaddrmode.ll deleted file mode 100644 index 7768c62fceb..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/ARM/2012-06-15-lsr-noaddrmode.ll +++ /dev/null @@ -1,97 +0,0 @@ -; RUN: llc -O3 -mtriple=thumb-eabi -mcpu=cortex-a8 %s -o - -arm-atomic-cfg-tidy=0 | FileCheck %s -; -; LSR should only check for valid address modes when the IV user is a -; memory address. -; svn r158536, rdar://11635990 -; -; Note that we still don't produce the best code here because we fail -; to coalesce the IV. See <rdar://problem/11680670> [coalescer] IVs -; need to be scheduled to expose coalescing. - -; LSR before the fix: -;The chosen solution requires 4 regs, with addrec cost 1, plus 3 base adds, plus 2 setup cost: -; LSR Use: Kind=Special, Offsets={0}, all-fixups-outside-loop, widest fixup type: i32 -; reg(%v3) + reg({0,+,-1}<%while.cond.i.i>) + imm(1) -; LSR Use: Kind=ICmpZero, Offsets={0}, widest fixup type: i32 -; reg(%v3) + reg({0,+,-1}<%while.cond.i.i>) -; LSR Use: Kind=Address of i32, Offsets={0}, widest fixup type: i32* -; reg((-4 + (4 * %v3) + %v1)) + 4*reg({0,+,-1}<%while.cond.i.i>) -; LSR Use: Kind=Address of i32, Offsets={0}, widest fixup type: i32* -; reg((-4 + (4 * %v3) + %v4)) + 4*reg({0,+,-1}<%while.cond.i.i>) -; LSR Use: Kind=Special, Offsets={0}, all-fixups-outside-loop, widest fixup type: i32 -; reg(%v3) -; -; LSR after the fix: -;The chosen solution requires 4 regs, with addrec cost 1, plus 1 base add, plus 2 setup cost: -; LSR Use: Kind=Special, Offsets={0}, all-fixups-outside-loop, widest fixup type: i32 -; reg({%v3,+,-1}<nsw><%while.cond.i.i>) + imm(1) -; LSR Use: Kind=ICmpZero, Offsets={0}, widest fixup type: i32 -; reg({%v3,+,-1}<nsw><%while.cond.i.i>) -; LSR Use: Kind=Address of i32, Offsets={0}, widest fixup type: i32* -; reg((-4 + %v1)) + 4*reg({%v3,+,-1}<nsw><%while.cond.i.i>) -; LSR Use: Kind=Address of i32, Offsets={0}, widest fixup type: i32* -; reg((-4 + %v4)) + 4*reg({%v3,+,-1}<nsw><%while.cond.i.i>) -; LSR Use: Kind=Special, Offsets={0}, all-fixups-outside-loop, widest fixup type: i32 -; reg(%v3) - - -%s = type { i32* } - -@ncol = external global i32, align 4 - -declare i32* @getptr() nounwind -declare %s* @getstruct() nounwind - -; CHECK: @main -; Check that the loop preheader contains no address computation. -; CHECK: %while.cond.i.i -; CHECK-NOT: add{{.*}}lsl -; CHECK: ldr{{.*}}lsl #2 -; CHECK: ldr{{.*}}lsl #2 -define i32 @main() nounwind ssp { -entry: - %v0 = load i32, i32* @ncol, align 4 - %v1 = tail call i32* @getptr() nounwind - %cmp10.i = icmp eq i32 %v0, 0 - br label %while.cond.outer - -while.cond.outer: - %call18 = tail call %s* @getstruct() nounwind - br label %while.cond - -while.cond: - %cmp20 = icmp eq i32* %v1, null - br label %while.body - -while.body: - %v3 = load i32, i32* @ncol, align 4 - br label %end_of_chain - -end_of_chain: - %state.i = getelementptr inbounds %s, %s* %call18, i32 0, i32 0 - %v4 = load i32*, i32** %state.i, align 4 - br label %while.cond.i.i - -while.cond.i.i: - %counter.0.i.i = phi i32 [ %v3, %end_of_chain ], [ %dec.i.i, %land.rhs.i.i ] - %dec.i.i = add nsw i32 %counter.0.i.i, -1 - %tobool.i.i = icmp eq i32 %counter.0.i.i, 0 - br i1 %tobool.i.i, label %where.exit, label %land.rhs.i.i - -land.rhs.i.i: - %arrayidx.i.i = getelementptr inbounds i32, i32* %v4, i32 %dec.i.i - %v5 = load i32, i32* %arrayidx.i.i, align 4 - %arrayidx1.i.i = getelementptr inbounds i32, i32* %v1, i32 %dec.i.i - %v6 = load i32, i32* %arrayidx1.i.i, align 4 - %cmp.i.i = icmp eq i32 %v5, %v6 - br i1 %cmp.i.i, label %while.cond.i.i, label %equal_data.exit.i - -equal_data.exit.i: - ret i32 %counter.0.i.i - -where.exit: - br label %while.end.i - -while.end.i: - ret i32 %v3 -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/ARM/addrec-is-loop-invariant.ll b/llvm/test/Transforms/LoopStrengthReduce/ARM/addrec-is-loop-invariant.ll deleted file mode 100644 index 261c3cceed6..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/ARM/addrec-is-loop-invariant.ll +++ /dev/null @@ -1,35 +0,0 @@ -; RUN: llc -mtriple=armv8-eabi -verify-machineinstrs %s -o /dev/null - -; This test ensures that Loop Strength Reduction will -; not create an Add Reccurence Expression if not all -; its operands are loop invariants. - -define void @add_rec_expr() { -entry: - br label %loop0 - -loop0: - %c.0 = phi i32 [ 0, %entry ], [ %inc.0, %loop0 ] - %inc.0 = add nuw i32 %c.0, 1 - br i1 undef, label %loop0, label %bb1 - -bb1: - %mul.0 = mul i32 %c.0, %c.0 - %gelptr.0 = getelementptr inbounds i16, i16* undef, i32 %mul.0 - br label %loop1 - -loop1: - %inc.1 = phi i32 [ %inc.2, %bb4 ], [ 0, %bb1 ] - %mul.1 = mul i32 %inc.1, %c.0 - br label %bb3 - -bb3: - %add.0 = add i32 undef, %mul.1 - %gelptr.1 = getelementptr inbounds i16, i16* %gelptr.0, i32 %add.0 - store i16 undef, i16* %gelptr.1, align 2 - br label %bb4 - -bb4: - %inc.2 = add nuw i32 %inc.1, 1 - br label %loop1 -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/ARM/complexity.ll b/llvm/test/Transforms/LoopStrengthReduce/ARM/complexity.ll deleted file mode 100644 index 197bb53ab51..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/ARM/complexity.ll +++ /dev/null @@ -1,112 +0,0 @@ -target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" - -; RUN: opt -mtriple=thumbv7em %s -S -loop-reduce -lsr-complexity-limit=65536 -o - | FileCheck %s -; RUN: opt -mtriple=thumbv7em %s -S -loop-reduce -lsr-complexity-limit=2147483647 -o - | FileCheck %s - -; CHECK-LABEL: for.body12.us.us: -; CHECK: [[LSR_IV6:%[^ ]+]] = phi i16* [ [[SCEVGEP7:%[^ ]+]], %for.body12.us.us ], [ [[SCEVGEP5:%[^ ]+]], %for.cond9.preheader.us.us ] -; CHECK: phi i32 -; CHECK: [[LSR_IV:%[^ ]+]] = phi i16* [ [[SCEVGEP1:%[^ ]+]], %for.body12.us.us ], [ [[SCEVGEP:%[^ ]+]], %for.cond9.preheader.us.us ] -; CHECK: phi i32 -; CHECK: [[SCEVGEP1]] = getelementptr i16, i16* [[LSR_IV]], i32 4 -; CHECK: [[SCEVGEP7]] = getelementptr i16, i16* [[LSR_IV6]], i32 4 - -define void @convolve(i16** nocapture readonly %input_image, i16** nocapture readonly %filter, i32 %filter_dim, i32 %out_width, i32 %out_height, i32** nocapture readonly %convolved) { -entry: - %cmp92 = icmp eq i32 %out_height, 0 - br i1 %cmp92, label %for.cond.cleanup, label %for.cond1.preheader.lr.ph - -for.cond1.preheader.lr.ph: ; preds = %entry - %xtraiter = and i32 %filter_dim, 3 - %unroll_iter = sub i32 %filter_dim, %xtraiter - br label %for.cond1.preheader - -for.cond1.preheader: ; preds = %for.cond.cleanup3, %for.cond1.preheader.lr.ph - %res_y.093 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %add28, %for.cond.cleanup3 ] - %arrayidx22 = getelementptr inbounds i32*, i32** %convolved, i32 %res_y.093 - %tmp3 = load i32*, i32** %arrayidx22, align 4 - br label %for.cond9.preheader.us.us.preheader - -for.cond9.preheader.us.us.preheader: ; preds = %for.cond5.for.cond.cleanup7_crit_edge.us, %for.cond5.preheader.lr.ph - %res_x.060.us = phi i32 [ %add25.us, %for.cond5.for.cond.cleanup7_crit_edge.us ], [ 0, %for.cond1.preheader ] - br label %for.cond9.preheader.us.us - -for.cond9.preheader.us.us: ; preds = %for.cond9.for.cond.cleanup11_crit_edge.us.us, %for.cond9.preheader.us.us.preheader - %filter_y.056.us.us = phi i32 [ %inc20.us.us, %for.cond9.for.cond.cleanup11_crit_edge.us.us.unr-lcssa ], [ 0, %for.cond9.preheader.us.us.preheader ] - %result_element.055.us.us = phi i32 [ %add18.us.us.3, %for.cond9.for.cond.cleanup11_crit_edge.us.us.unr-lcssa ], [ 0, %for.cond9.preheader.us.us.preheader ] - %add.us.us = add i32 %filter_y.056.us.us, %res_y.093 - %arrayidx.us.us = getelementptr inbounds i16*, i16** %filter, i32 %filter_y.056.us.us - %tmp5 = load i16*, i16** %arrayidx.us.us, align 4 - %arrayidx15.us.us = getelementptr inbounds i16*, i16** %input_image, i32 %add.us.us - %tmp6 = load i16*, i16** %arrayidx15.us.us, align 4 - br label %for.body12.us.us - -for.body12.us.us: ; preds = %for.body12.us.us, %for.cond9.preheader.us.us - %filter_x.053.us.us = phi i32 [ %inc.us.us.3, %for.body12.us.us ], [ 0, %for.cond9.preheader.us.us ] - %result_element.152.us.us = phi i32 [ %add18.us.us.3, %for.body12.us.us ], [ %result_element.055.us.us, %for.cond9.preheader.us.us ] - %niter = phi i32 [ %niter.nsub.3, %for.body12.us.us ], [ %unroll_iter, %for.cond9.preheader.us.us ] - %add13.us.us = add i32 %filter_x.053.us.us, %res_x.060.us - %arrayidx14.us.us = getelementptr inbounds i16, i16* %tmp5, i32 %filter_x.053.us.us - %tmp9 = load i16, i16* %arrayidx14.us.us, align 2 - %conv.us.us = sext i16 %tmp9 to i32 - %arrayidx16.us.us = getelementptr inbounds i16, i16* %tmp6, i32 %add13.us.us - %tmp10 = load i16, i16* %arrayidx16.us.us, align 2 - %conv17.us.us = sext i16 %tmp10 to i32 - %mul.us.us = mul nsw i32 %conv17.us.us, %conv.us.us - %add18.us.us = add nsw i32 %mul.us.us, %result_element.152.us.us - %inc.us.us = or i32 %filter_x.053.us.us, 1 - %add13.us.us.1 = add i32 %inc.us.us, %res_x.060.us - %arrayidx14.us.us.1 = getelementptr inbounds i16, i16* %tmp5, i32 %inc.us.us - %tmp11 = load i16, i16* %arrayidx14.us.us.1, align 2 - %conv.us.us.1 = sext i16 %tmp11 to i32 - %arrayidx16.us.us.1 = getelementptr inbounds i16, i16* %tmp6, i32 %add13.us.us.1 - %tmp12 = load i16, i16* %arrayidx16.us.us.1, align 2 - %conv17.us.us.1 = sext i16 %tmp12 to i32 - %mul.us.us.1 = mul nsw i32 %conv17.us.us.1, %conv.us.us.1 - %add18.us.us.1 = add nsw i32 %mul.us.us.1, %add18.us.us - %inc.us.us.1 = or i32 %filter_x.053.us.us, 2 - %add13.us.us.2 = add i32 %inc.us.us.1, %res_x.060.us - %arrayidx14.us.us.2 = getelementptr inbounds i16, i16* %tmp5, i32 %inc.us.us.1 - %tmp13 = load i16, i16* %arrayidx14.us.us.2, align 2 - %conv.us.us.2 = sext i16 %tmp13 to i32 - %arrayidx16.us.us.2 = getelementptr inbounds i16, i16* %tmp6, i32 %add13.us.us.2 - %tmp14 = load i16, i16* %arrayidx16.us.us.2, align 2 - %conv17.us.us.2 = sext i16 %tmp14 to i32 - %mul.us.us.2 = mul nsw i32 %conv17.us.us.2, %conv.us.us.2 - %add18.us.us.2 = add nsw i32 %mul.us.us.2, %add18.us.us.1 - %inc.us.us.2 = or i32 %filter_x.053.us.us, 3 - %add13.us.us.3 = add i32 %inc.us.us.2, %res_x.060.us - %arrayidx14.us.us.3 = getelementptr inbounds i16, i16* %tmp5, i32 %inc.us.us.2 - %tmp15 = load i16, i16* %arrayidx14.us.us.3, align 2 - %conv.us.us.3 = sext i16 %tmp15 to i32 - %arrayidx16.us.us.3 = getelementptr inbounds i16, i16* %tmp6, i32 %add13.us.us.3 - %tmp16 = load i16, i16* %arrayidx16.us.us.3, align 2 - %conv17.us.us.3 = sext i16 %tmp16 to i32 - %mul.us.us.3 = mul nsw i32 %conv17.us.us.3, %conv.us.us.3 - %add18.us.us.3 = add nsw i32 %mul.us.us.3, %add18.us.us.2 - %inc.us.us.3 = add i32 %filter_x.053.us.us, 4 - %niter.nsub.3 = add i32 %niter, -4 - %niter.ncmp.3 = icmp eq i32 %niter.nsub.3, 0 - br i1 %niter.ncmp.3, label %for.cond9.for.cond.cleanup11_crit_edge.us.us.unr-lcssa, label %for.body12.us.us - -for.cond9.for.cond.cleanup11_crit_edge.us.us.unr-lcssa: ; preds = %for.body12.us.us, %for.cond9.preheader.us.us - %inc20.us.us = add nuw i32 %filter_y.056.us.us, 1 - %exitcond98 = icmp eq i32 %inc20.us.us, %filter_dim - br i1 %exitcond98, label %for.cond5.for.cond.cleanup7_crit_edge.us, label %for.cond9.preheader.us.us - -for.cond5.for.cond.cleanup7_crit_edge.us: ; preds = %for.cond9.for.cond.cleanup11_crit_edge.us.us - %arrayidx23.us = getelementptr inbounds i32, i32* %tmp3, i32 %res_x.060.us - store i32 %add18.us.us.3, i32* %arrayidx23.us, align 4 - %add25.us = add nuw i32 %res_x.060.us, 1 - %exitcond99 = icmp eq i32 %add25.us, %out_width - br i1 %exitcond99, label %for.cond.cleanup3, label %for.cond9.preheader.us.us.preheader - -for.cond.cleanup3: ; preds = %for.cond5.for.cond.cleanup7_crit_edge.us, %for.cond5.preheader.preheader, %for.cond1.preheader - %add28 = add nuw i32 %res_y.093, 1 - %exitcond100 = icmp eq i32 %add28, %out_height - br i1 %exitcond100, label %for.cond.cleanup, label %for.cond1.preheader - -for.cond.cleanup: ; preds = %for.cond.cleanup3, %entry - ret void -} - diff --git a/llvm/test/Transforms/LoopStrengthReduce/ARM/ivchain-ARM.ll b/llvm/test/Transforms/LoopStrengthReduce/ARM/ivchain-ARM.ll deleted file mode 100644 index dcb27d58efe..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/ARM/ivchain-ARM.ll +++ /dev/null @@ -1,366 +0,0 @@ -; RUN: llc -O3 -mtriple=thumb-eabi -mcpu=cortex-a9 %s -o - | FileCheck %s -check-prefix=A9 - -; @simple is the most basic chain of address induction variables. Chaining -; saves at least one register and avoids complex addressing and setup -; code. -; -; A9: @simple -; no expensive address computation in the preheader -; A9: lsl -; A9-NOT: lsl -; A9: %loop -; no complex address modes -; A9-NOT: lsl -define i32 @simple(i32* %a, i32* %b, i32 %x) nounwind { -entry: - br label %loop -loop: - %iv = phi i32* [ %a, %entry ], [ %iv4, %loop ] - %s = phi i32 [ 0, %entry ], [ %s4, %loop ] - %v = load i32, i32* %iv - %iv1 = getelementptr inbounds i32, i32* %iv, i32 %x - %v1 = load i32, i32* %iv1 - %iv2 = getelementptr inbounds i32, i32* %iv1, i32 %x - %v2 = load i32, i32* %iv2 - %iv3 = getelementptr inbounds i32, i32* %iv2, i32 %x - %v3 = load i32, i32* %iv3 - %s1 = add i32 %s, %v - %s2 = add i32 %s1, %v1 - %s3 = add i32 %s2, %v2 - %s4 = add i32 %s3, %v3 - %iv4 = getelementptr inbounds i32, i32* %iv3, i32 %x - %cmp = icmp eq i32* %iv4, %b - br i1 %cmp, label %exit, label %loop -exit: - ret i32 %s4 -} - -; @user is not currently chained because the IV is live across memory ops. -; -; A9: @user -; stride multiples computed in the preheader -; A9: lsl -; A9: lsl -; A9: %loop -; complex address modes -; A9: lsl -; A9: lsl -define i32 @user(i32* %a, i32* %b, i32 %x) nounwind { -entry: - br label %loop -loop: - %iv = phi i32* [ %a, %entry ], [ %iv4, %loop ] - %s = phi i32 [ 0, %entry ], [ %s4, %loop ] - %v = load i32, i32* %iv - %iv1 = getelementptr inbounds i32, i32* %iv, i32 %x - %v1 = load i32, i32* %iv1 - %iv2 = getelementptr inbounds i32, i32* %iv1, i32 %x - %v2 = load i32, i32* %iv2 - %iv3 = getelementptr inbounds i32, i32* %iv2, i32 %x - %v3 = load i32, i32* %iv3 - %s1 = add i32 %s, %v - %s2 = add i32 %s1, %v1 - %s3 = add i32 %s2, %v2 - %s4 = add i32 %s3, %v3 - %iv4 = getelementptr inbounds i32, i32* %iv3, i32 %x - store i32 %s4, i32* %iv - %cmp = icmp eq i32* %iv4, %b - br i1 %cmp, label %exit, label %loop -exit: - ret i32 %s4 -} - -; @extrastride is a slightly more interesting case of a single -; complete chain with multiple strides. The test case IR is what LSR -; used to do, and exactly what we don't want to do. LSR's new IV -; chaining feature should now undo the damage. -; -; A9: extrastride: -; no spills -; A9-NOT: str -; only one stride multiple in the preheader -; A9: lsl -; A9-NOT: {{str r|lsl}} -; A9: %for.body{{$}} -; no complex address modes or reloads -; A9-NOT: {{ldr .*[sp]|lsl}} -define void @extrastride(i8* nocapture %main, i32 %main_stride, i32* nocapture %res, i32 %x, i32 %y, i32 %z) nounwind { -entry: - %cmp8 = icmp eq i32 %z, 0 - br i1 %cmp8, label %for.end, label %for.body.lr.ph - -for.body.lr.ph: ; preds = %entry - %add.ptr.sum = shl i32 %main_stride, 1 ; s*2 - %add.ptr1.sum = add i32 %add.ptr.sum, %main_stride ; s*3 - %add.ptr2.sum = add i32 %x, %main_stride ; s + x - %add.ptr4.sum = shl i32 %main_stride, 2 ; s*4 - %add.ptr3.sum = add i32 %add.ptr2.sum, %add.ptr4.sum ; total IV stride = s*5+x - br label %for.body - -for.body: ; preds = %for.body.lr.ph, %for.body - %main.addr.011 = phi i8* [ %main, %for.body.lr.ph ], [ %add.ptr6, %for.body ] - %i.010 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ] - %res.addr.09 = phi i32* [ %res, %for.body.lr.ph ], [ %add.ptr7, %for.body ] - %0 = bitcast i8* %main.addr.011 to i32* - %1 = load i32, i32* %0, align 4 - %add.ptr = getelementptr inbounds i8, i8* %main.addr.011, i32 %main_stride - %2 = bitcast i8* %add.ptr to i32* - %3 = load i32, i32* %2, align 4 - %add.ptr1 = getelementptr inbounds i8, i8* %main.addr.011, i32 %add.ptr.sum - %4 = bitcast i8* %add.ptr1 to i32* - %5 = load i32, i32* %4, align 4 - %add.ptr2 = getelementptr inbounds i8, i8* %main.addr.011, i32 %add.ptr1.sum - %6 = bitcast i8* %add.ptr2 to i32* - %7 = load i32, i32* %6, align 4 - %add.ptr3 = getelementptr inbounds i8, i8* %main.addr.011, i32 %add.ptr4.sum - %8 = bitcast i8* %add.ptr3 to i32* - %9 = load i32, i32* %8, align 4 - %add = add i32 %3, %1 - %add4 = add i32 %add, %5 - %add5 = add i32 %add4, %7 - %add6 = add i32 %add5, %9 - store i32 %add6, i32* %res.addr.09, align 4 - %add.ptr6 = getelementptr inbounds i8, i8* %main.addr.011, i32 %add.ptr3.sum - %add.ptr7 = getelementptr inbounds i32, i32* %res.addr.09, i32 %y - %inc = add i32 %i.010, 1 - %cmp = icmp eq i32 %inc, %z - br i1 %cmp, label %for.end, label %for.body - -for.end: ; preds = %for.body, %entry - ret void -} - -; @foldedidx is an unrolled variant of this loop: -; for (unsigned long i = 0; i < len; i += s) { -; c[i] = a[i] + b[i]; -; } -; where 's' can be folded into the addressing mode. -; Consequently, we should *not* form any chains. -; -; A9: foldedidx: -; A9: ldrb{{(.w)?}} {{r[0-9]|lr}}, [{{r[0-9]|lr}}, #3] -define void @foldedidx(i8* nocapture %a, i8* nocapture %b, i8* nocapture %c) nounwind ssp { -entry: - br label %for.body - -for.body: ; preds = %for.body, %entry - %i.07 = phi i32 [ 0, %entry ], [ %inc.3, %for.body ] - %arrayidx = getelementptr inbounds i8, i8* %a, i32 %i.07 - %0 = load i8, i8* %arrayidx, align 1 - %conv5 = zext i8 %0 to i32 - %arrayidx1 = getelementptr inbounds i8, i8* %b, i32 %i.07 - %1 = load i8, i8* %arrayidx1, align 1 - %conv26 = zext i8 %1 to i32 - %add = add nsw i32 %conv26, %conv5 - %conv3 = trunc i32 %add to i8 - %arrayidx4 = getelementptr inbounds i8, i8* %c, i32 %i.07 - store i8 %conv3, i8* %arrayidx4, align 1 - %inc1 = or i32 %i.07, 1 - %arrayidx.1 = getelementptr inbounds i8, i8* %a, i32 %inc1 - %2 = load i8, i8* %arrayidx.1, align 1 - %conv5.1 = zext i8 %2 to i32 - %arrayidx1.1 = getelementptr inbounds i8, i8* %b, i32 %inc1 - %3 = load i8, i8* %arrayidx1.1, align 1 - %conv26.1 = zext i8 %3 to i32 - %add.1 = add nsw i32 %conv26.1, %conv5.1 - %conv3.1 = trunc i32 %add.1 to i8 - %arrayidx4.1 = getelementptr inbounds i8, i8* %c, i32 %inc1 - store i8 %conv3.1, i8* %arrayidx4.1, align 1 - %inc.12 = or i32 %i.07, 2 - %arrayidx.2 = getelementptr inbounds i8, i8* %a, i32 %inc.12 - %4 = load i8, i8* %arrayidx.2, align 1 - %conv5.2 = zext i8 %4 to i32 - %arrayidx1.2 = getelementptr inbounds i8, i8* %b, i32 %inc.12 - %5 = load i8, i8* %arrayidx1.2, align 1 - %conv26.2 = zext i8 %5 to i32 - %add.2 = add nsw i32 %conv26.2, %conv5.2 - %conv3.2 = trunc i32 %add.2 to i8 - %arrayidx4.2 = getelementptr inbounds i8, i8* %c, i32 %inc.12 - store i8 %conv3.2, i8* %arrayidx4.2, align 1 - %inc.23 = or i32 %i.07, 3 - %arrayidx.3 = getelementptr inbounds i8, i8* %a, i32 %inc.23 - %6 = load i8, i8* %arrayidx.3, align 1 - %conv5.3 = zext i8 %6 to i32 - %arrayidx1.3 = getelementptr inbounds i8, i8* %b, i32 %inc.23 - %7 = load i8, i8* %arrayidx1.3, align 1 - %conv26.3 = zext i8 %7 to i32 - %add.3 = add nsw i32 %conv26.3, %conv5.3 - %conv3.3 = trunc i32 %add.3 to i8 - %arrayidx4.3 = getelementptr inbounds i8, i8* %c, i32 %inc.23 - store i8 %conv3.3, i8* %arrayidx4.3, align 1 - %inc.3 = add nsw i32 %i.07, 4 - %exitcond.3 = icmp eq i32 %inc.3, 400 - br i1 %exitcond.3, label %for.end, label %for.body - -for.end: ; preds = %for.body - ret void -} - -; @testNeon is an important example of the nead for ivchains. -; -; Currently we have two extra add.w's that keep the store address -; live past the next increment because ISEL is unfortunately undoing -; the store chain. ISEL also fails to convert all but one of the stores to -; post-increment addressing. However, the loads should use -; post-increment addressing, no add's or add.w's beyond the three -; mentioned. Most importantly, there should be no spills or reloads! -; -; A9: testNeon: -; A9: %.lr.ph -; A9: add.w r -; A9-NOT: lsl.w -; A9-NOT: {{ldr|str|adds|add r}} -; A9: vst1.8 {{.*}} [r{{[0-9]+}}], r{{[0-9]+}} -; A9: add.w r -; A9-NOT: {{ldr|str|adds|add r}} -; A9-NOT: add.w r -; A9: bne -define hidden void @testNeon(i8* %ref_data, i32 %ref_stride, i32 %limit, <16 x i8>* nocapture %data) nounwind optsize { - %1 = icmp sgt i32 %limit, 0 - br i1 %1, label %.lr.ph, label %45 - -.lr.ph: ; preds = %0 - %2 = shl nsw i32 %ref_stride, 1 - %3 = mul nsw i32 %ref_stride, 3 - %4 = shl nsw i32 %ref_stride, 2 - %5 = mul nsw i32 %ref_stride, 5 - %6 = mul nsw i32 %ref_stride, 6 - %7 = mul nsw i32 %ref_stride, 7 - %8 = shl nsw i32 %ref_stride, 3 - %9 = sub i32 0, %8 - %10 = mul i32 %limit, -64 - br label %11 - -; <label>:11 ; preds = %11, %.lr.ph - %.05 = phi i8* [ %ref_data, %.lr.ph ], [ %42, %11 ] - %counter.04 = phi i32 [ 0, %.lr.ph ], [ %44, %11 ] - %result.03 = phi <16 x i8> [ zeroinitializer, %.lr.ph ], [ %41, %11 ] - %.012 = phi <16 x i8>* [ %data, %.lr.ph ], [ %43, %11 ] - %12 = tail call <1 x i64> @llvm.arm.neon.vld1.v1i64.p0i8(i8* %.05, i32 1) nounwind - %13 = getelementptr inbounds i8, i8* %.05, i32 %ref_stride - %14 = tail call <1 x i64> @llvm.arm.neon.vld1.v1i64.p0i8(i8* %13, i32 1) nounwind - %15 = shufflevector <1 x i64> %12, <1 x i64> %14, <2 x i32> <i32 0, i32 1> - %16 = bitcast <2 x i64> %15 to <16 x i8> - %17 = getelementptr inbounds <16 x i8>, <16 x i8>* %.012, i32 1 - store <16 x i8> %16, <16 x i8>* %.012, align 4 - %18 = getelementptr inbounds i8, i8* %.05, i32 %2 - %19 = tail call <1 x i64> @llvm.arm.neon.vld1.v1i64.p0i8(i8* %18, i32 1) nounwind - %20 = getelementptr inbounds i8, i8* %.05, i32 %3 - %21 = tail call <1 x i64> @llvm.arm.neon.vld1.v1i64.p0i8(i8* %20, i32 1) nounwind - %22 = shufflevector <1 x i64> %19, <1 x i64> %21, <2 x i32> <i32 0, i32 1> - %23 = bitcast <2 x i64> %22 to <16 x i8> - %24 = getelementptr inbounds <16 x i8>, <16 x i8>* %.012, i32 2 - store <16 x i8> %23, <16 x i8>* %17, align 4 - %25 = getelementptr inbounds i8, i8* %.05, i32 %4 - %26 = tail call <1 x i64> @llvm.arm.neon.vld1.v1i64.p0i8(i8* %25, i32 1) nounwind - %27 = getelementptr inbounds i8, i8* %.05, i32 %5 - %28 = tail call <1 x i64> @llvm.arm.neon.vld1.v1i64.p0i8(i8* %27, i32 1) nounwind - %29 = shufflevector <1 x i64> %26, <1 x i64> %28, <2 x i32> <i32 0, i32 1> - %30 = bitcast <2 x i64> %29 to <16 x i8> - %31 = getelementptr inbounds <16 x i8>, <16 x i8>* %.012, i32 3 - store <16 x i8> %30, <16 x i8>* %24, align 4 - %32 = getelementptr inbounds i8, i8* %.05, i32 %6 - %33 = tail call <1 x i64> @llvm.arm.neon.vld1.v1i64.p0i8(i8* %32, i32 1) nounwind - %34 = getelementptr inbounds i8, i8* %.05, i32 %7 - %35 = tail call <1 x i64> @llvm.arm.neon.vld1.v1i64.p0i8(i8* %34, i32 1) nounwind - %36 = shufflevector <1 x i64> %33, <1 x i64> %35, <2 x i32> <i32 0, i32 1> - %37 = bitcast <2 x i64> %36 to <16 x i8> - store <16 x i8> %37, <16 x i8>* %31, align 4 - %38 = add <16 x i8> %16, %23 - %39 = add <16 x i8> %38, %30 - %40 = add <16 x i8> %39, %37 - %41 = add <16 x i8> %result.03, %40 - %42 = getelementptr i8, i8* %.05, i32 %9 - %43 = getelementptr inbounds <16 x i8>, <16 x i8>* %.012, i32 -64 - %44 = add nsw i32 %counter.04, 1 - %exitcond = icmp eq i32 %44, %limit - br i1 %exitcond, label %._crit_edge, label %11 - -._crit_edge: ; preds = %11 - %scevgep = getelementptr <16 x i8>, <16 x i8>* %data, i32 %10 - br label %45 - -; <label>:45 ; preds = %._crit_edge, %0 - %result.0.lcssa = phi <16 x i8> [ %41, %._crit_edge ], [ zeroinitializer, %0 ] - %.01.lcssa = phi <16 x i8>* [ %scevgep, %._crit_edge ], [ %data, %0 ] - store <16 x i8> %result.0.lcssa, <16 x i8>* %.01.lcssa, align 4 - ret void -} - -declare <1 x i64> @llvm.arm.neon.vld1.v1i64.p0i8(i8*, i32) nounwind readonly - -; Handle chains in which the same offset is used for both loads and -; stores to the same array. -; rdar://11410078. -; -; A9: @testReuse -; A9: %for.body -; A9: vld1.8 {d{{[0-9]+}}}, [[BASE:[r[0-9]+]]], [[INC:r[0-9]]] -; A9: vld1.8 {d{{[0-9]+}}}, [[BASE]], [[INC]] -; A9: vld1.8 {d{{[0-9]+}}}, [[BASE]], [[INC]] -; A9: vld1.8 {d{{[0-9]+}}}, [[BASE]], [[INC]] -; A9: vld1.8 {d{{[0-9]+}}}, [[BASE]], [[INC]] -; A9: vld1.8 {d{{[0-9]+}}}, [[BASE]], [[INC]] -; A9: vld1.8 {d{{[0-9]+}}}, [[BASE]], [[INC]] -; A9: vst1.8 {d{{[0-9]+}}}, [[BASE]], [[INC]] -; A9: vst1.8 {d{{[0-9]+}}}, [[BASE]], [[INC]] -; A9: vst1.8 {d{{[0-9]+}}}, [[BASE]], [[INC]] -; A9: vst1.8 {d{{[0-9]+}}}, [[BASE]], [[INC]] -; A9: vst1.8 {d{{[0-9]+}}}, [[BASE]], [[INC]] -; A9: vst1.8 {d{{[0-9]+}}}, [[BASE]] -; A9: bne -define void @testReuse(i8* %src, i32 %stride) nounwind ssp { -entry: - %mul = shl nsw i32 %stride, 2 - %idx.neg = sub i32 0, %mul - %mul1 = mul nsw i32 %stride, 3 - %idx.neg2 = sub i32 0, %mul1 - %mul5 = shl nsw i32 %stride, 1 - %idx.neg6 = sub i32 0, %mul5 - %idx.neg10 = sub i32 0, %stride - br label %for.body - -for.body: ; preds = %for.body, %entry - %i.0110 = phi i32 [ 0, %entry ], [ %inc, %for.body ] - %src.addr = phi i8* [ %src, %entry ], [ %add.ptr45, %for.body ] - %add.ptr = getelementptr inbounds i8, i8* %src.addr, i32 %idx.neg - %vld1 = tail call <8 x i8> @llvm.arm.neon.vld1.v8i8.p0i8(i8* %add.ptr, i32 1) - %add.ptr3 = getelementptr inbounds i8, i8* %src.addr, i32 %idx.neg2 - %vld2 = tail call <8 x i8> @llvm.arm.neon.vld1.v8i8.p0i8(i8* %add.ptr3, i32 1) - %add.ptr7 = getelementptr inbounds i8, i8* %src.addr, i32 %idx.neg6 - %vld3 = tail call <8 x i8> @llvm.arm.neon.vld1.v8i8.p0i8(i8* %add.ptr7, i32 1) - %add.ptr11 = getelementptr inbounds i8, i8* %src.addr, i32 %idx.neg10 - %vld4 = tail call <8 x i8> @llvm.arm.neon.vld1.v8i8.p0i8(i8* %add.ptr11, i32 1) - %vld5 = tail call <8 x i8> @llvm.arm.neon.vld1.v8i8.p0i8(i8* %src.addr, i32 1) - %add.ptr17 = getelementptr inbounds i8, i8* %src.addr, i32 %stride - %vld6 = tail call <8 x i8> @llvm.arm.neon.vld1.v8i8.p0i8(i8* %add.ptr17, i32 1) - %add.ptr20 = getelementptr inbounds i8, i8* %src.addr, i32 %mul5 - %vld7 = tail call <8 x i8> @llvm.arm.neon.vld1.v8i8.p0i8(i8* %add.ptr20, i32 1) - %add.ptr23 = getelementptr inbounds i8, i8* %src.addr, i32 %mul1 - %vld8 = tail call <8 x i8> @llvm.arm.neon.vld1.v8i8.p0i8(i8* %add.ptr23, i32 1) - %vadd1 = tail call <8 x i8> @llvm.arm.neon.vhaddu.v8i8(<8 x i8> %vld1, <8 x i8> %vld2) nounwind - %vadd2 = tail call <8 x i8> @llvm.arm.neon.vhaddu.v8i8(<8 x i8> %vld2, <8 x i8> %vld3) nounwind - %vadd3 = tail call <8 x i8> @llvm.arm.neon.vhaddu.v8i8(<8 x i8> %vld3, <8 x i8> %vld4) nounwind - %vadd4 = tail call <8 x i8> @llvm.arm.neon.vhaddu.v8i8(<8 x i8> %vld4, <8 x i8> %vld5) nounwind - %vadd5 = tail call <8 x i8> @llvm.arm.neon.vhaddu.v8i8(<8 x i8> %vld5, <8 x i8> %vld6) nounwind - %vadd6 = tail call <8 x i8> @llvm.arm.neon.vhaddu.v8i8(<8 x i8> %vld6, <8 x i8> %vld7) nounwind - tail call void @llvm.arm.neon.vst1.p0i8.v8i8(i8* %add.ptr3, <8 x i8> %vadd1, i32 1) - tail call void @llvm.arm.neon.vst1.p0i8.v8i8(i8* %add.ptr7, <8 x i8> %vadd2, i32 1) - tail call void @llvm.arm.neon.vst1.p0i8.v8i8(i8* %add.ptr11, <8 x i8> %vadd3, i32 1) - tail call void @llvm.arm.neon.vst1.p0i8.v8i8(i8* %src.addr, <8 x i8> %vadd4, i32 1) - tail call void @llvm.arm.neon.vst1.p0i8.v8i8(i8* %add.ptr17, <8 x i8> %vadd5, i32 1) - tail call void @llvm.arm.neon.vst1.p0i8.v8i8(i8* %add.ptr20, <8 x i8> %vadd6, i32 1) - %inc = add nsw i32 %i.0110, 1 - %add.ptr45 = getelementptr inbounds i8, i8* %src.addr, i32 8 - %exitcond = icmp eq i32 %inc, 4 - br i1 %exitcond, label %for.end, label %for.body - -for.end: ; preds = %for.body - ret void -} - -declare <8 x i8> @llvm.arm.neon.vld1.v8i8.p0i8(i8*, i32) nounwind readonly - -declare void @llvm.arm.neon.vst1.p0i8.v8i8(i8*, <8 x i8>, i32) nounwind - -declare <8 x i8> @llvm.arm.neon.vhaddu.v8i8(<8 x i8>, <8 x i8>) nounwind readnone diff --git a/llvm/test/Transforms/LoopStrengthReduce/ARM/lit.local.cfg b/llvm/test/Transforms/LoopStrengthReduce/ARM/lit.local.cfg deleted file mode 100644 index 98c6700c209..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/ARM/lit.local.cfg +++ /dev/null @@ -1,3 +0,0 @@ -if not 'ARM' in config.root.targets: - config.unsupported = True - diff --git a/llvm/test/Transforms/LoopStrengthReduce/NVPTX/lit.local.cfg b/llvm/test/Transforms/LoopStrengthReduce/NVPTX/lit.local.cfg deleted file mode 100644 index 2cb98eb371b..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/NVPTX/lit.local.cfg +++ /dev/null @@ -1,2 +0,0 @@ -if not 'NVPTX' in config.root.targets: - config.unsupported = True diff --git a/llvm/test/Transforms/LoopStrengthReduce/NVPTX/trunc.ll b/llvm/test/Transforms/LoopStrengthReduce/NVPTX/trunc.ll deleted file mode 100644 index a16065b4dfb..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/NVPTX/trunc.ll +++ /dev/null @@ -1,45 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | FileCheck %s - -target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64" -target triple = "nvptx64-nvidia-cuda" - -; This confirms that NVPTXTTI considers a 64-to-32 integer trunc free. If such -; truncs were not considered free, LSR would promote (int)i as a separate -; induction variable in the following example. -; -; for (long i = begin; i != end; i += stride) -; use((int)i); -; -; That would be worthless, because "i" is simulated by two 32-bit registers and -; truncating it to 32-bit is as simple as directly using the register that -; contains the low bits. -define void @trunc_is_free(i64 %begin, i64 %stride, i64 %end) { -; CHECK-LABEL: @trunc_is_free( -entry: - %cmp.4 = icmp eq i64 %begin, %end - br i1 %cmp.4, label %for.cond.cleanup, label %for.body.preheader - -for.body.preheader: ; preds = %entry - br label %for.body - -for.cond.cleanup.loopexit: ; preds = %for.body - br label %for.cond.cleanup - -for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry - ret void - -for.body: ; preds = %for.body.preheader, %for.body -; CHECK: for.body: - %i.05 = phi i64 [ %add, %for.body ], [ %begin, %for.body.preheader ] - %conv = trunc i64 %i.05 to i32 -; CHECK: trunc i64 %{{[^ ]+}} to i32 - tail call void @_Z3usei(i32 %conv) #2 - %add = add nsw i64 %i.05, %stride - %cmp = icmp eq i64 %add, %end - br i1 %cmp, label %for.cond.cleanup.loopexit, label %for.body -} - -declare void @_Z3usei(i32) - -!nvvm.annotations = !{!0} -!0 = !{void (i64, i64, i64)* @trunc_is_free, !"kernel", i32 1} diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/2008-08-14-ShadowIV.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/2008-08-14-ShadowIV.ll deleted file mode 100644 index da14e631f51..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/2008-08-14-ShadowIV.ll +++ /dev/null @@ -1,215 +0,0 @@ -; RUN: opt < %s -loop-reduce -S -mtriple=x86_64-unknown-unknown 2>&1 | FileCheck %s - -; Provide legal integer types. -target datalayout = "n8:16:32:64" - - -define void @foobar(i32 %n) nounwind { - -; CHECK-LABEL: foobar( -; CHECK: phi double - -entry: - %cond = icmp eq i32 %n, 0 ; <i1>:0 [#uses=2] - br i1 %cond, label %return, label %bb.nph - -bb.nph: ; preds = %entry - %umax = select i1 %cond, i32 1, i32 %n ; <i32> [#uses=1] - br label %bb - -bb: ; preds = %bb, %bb.nph - %i.03 = phi i32 [ 0, %bb.nph ], [ %indvar.next, %bb ] ; <i32> [#uses=3] - tail call void @bar( i32 %i.03 ) nounwind - %tmp1 = uitofp i32 %i.03 to double ; <double>:1 [#uses=1] - tail call void @foo( double %tmp1 ) nounwind - %indvar.next = add nsw nuw i32 %i.03, 1 ; <i32> [#uses=2] - %exitcond = icmp eq i32 %indvar.next, %umax ; <i1> [#uses=1] - br i1 %exitcond, label %return, label %bb - -return: ; preds = %bb, %entry - ret void -} - -; Unable to eliminate cast because the mantissa bits for double are not enough -; to hold all of i64 IV bits. -define void @foobar2(i64 %n) nounwind { - -; CHECK-LABEL: foobar2( -; CHECK-NOT: phi double -; CHECK-NOT: phi float - -entry: - %cond = icmp eq i64 %n, 0 ; <i1>:0 [#uses=2] - br i1 %cond, label %return, label %bb.nph - -bb.nph: ; preds = %entry - %umax = select i1 %cond, i64 1, i64 %n ; <i64> [#uses=1] - br label %bb - -bb: ; preds = %bb, %bb.nph - %i.03 = phi i64 [ 0, %bb.nph ], [ %indvar.next, %bb ] ; <i64> [#uses=3] - %tmp1 = trunc i64 %i.03 to i32 ; <i32>:1 [#uses=1] - tail call void @bar( i32 %tmp1 ) nounwind - %tmp2 = uitofp i64 %i.03 to double ; <double>:2 [#uses=1] - tail call void @foo( double %tmp2 ) nounwind - %indvar.next = add nsw nuw i64 %i.03, 1 ; <i64> [#uses=2] - %exitcond = icmp eq i64 %indvar.next, %umax ; <i1> [#uses=1] - br i1 %exitcond, label %return, label %bb - -return: ; preds = %bb, %entry - ret void -} - -; Unable to eliminate cast due to potentional overflow. -define void @foobar3() nounwind { - -; CHECK-LABEL: foobar3( -; CHECK-NOT: phi double -; CHECK-NOT: phi float - -entry: - %tmp0 = tail call i32 (...) @nn( ) nounwind ; <i32>:0 [#uses=1] - %cond = icmp eq i32 %tmp0, 0 ; <i1>:1 [#uses=1] - br i1 %cond, label %return, label %bb - -bb: ; preds = %bb, %entry - %i.03 = phi i32 [ 0, %entry ], [ %indvar.next, %bb ] ; <i32> [#uses=3] - tail call void @bar( i32 %i.03 ) nounwind - %tmp2 = uitofp i32 %i.03 to double ; <double>:2 [#uses=1] - tail call void @foo( double %tmp2 ) nounwind - %indvar.next = add nuw nsw i32 %i.03, 1 ; <i32>:3 [#uses=2] - %tmp4 = tail call i32 (...) @nn( ) nounwind ; <i32>:4 [#uses=1] - %exitcond = icmp ugt i32 %tmp4, %indvar.next ; <i1>:5 [#uses=1] - br i1 %exitcond, label %bb, label %return - -return: ; preds = %bb, %entry - ret void -} - -; Unable to eliminate cast due to overflow. -define void @foobar4() nounwind { - -; CHECK-LABEL: foobar4( -; CHECK-NOT: phi double -; CHECK-NOT: phi float - -entry: - br label %bb.nph - -bb.nph: ; preds = %entry - br label %bb - -bb: ; preds = %bb, %bb.nph - %i.03 = phi i8 [ 0, %bb.nph ], [ %indvar.next, %bb ] ; <i32> [#uses=3] - %tmp2 = sext i8 %i.03 to i32 ; <i32>:0 [#uses=1] - tail call void @bar( i32 %tmp2 ) nounwind - %tmp3 = uitofp i8 %i.03 to double ; <double>:1 [#uses=1] - tail call void @foo( double %tmp3 ) nounwind - %indvar.next = add nsw nuw i8 %i.03, 1 ; <i32> [#uses=2] - %tmp = sext i8 %indvar.next to i32 - %exitcond = icmp eq i32 %tmp, 32767 ; <i1> [#uses=1] - br i1 %exitcond, label %return, label %bb - -return: ; preds = %bb, %entry - ret void -} - -; Unable to eliminate cast because the integer IV overflows (accum exceeds -; SINT_MAX). - -define i32 @foobar5() { -; CHECK-LABEL: foobar5( -; CHECK-NOT: phi double -; CHECK-NOT: phi float -entry: - br label %loop - -loop: - %accum = phi i32 [ -3220, %entry ], [ %accum.next, %loop ] - %iv = phi i32 [ 12, %entry ], [ %iv.next, %loop ] - %tmp1 = sitofp i32 %accum to double - tail call void @foo( double %tmp1 ) nounwind - %accum.next = add i32 %accum, 9597741 - %iv.next = add nuw nsw i32 %iv, 1 - %exitcond = icmp ugt i32 %iv, 235 - br i1 %exitcond, label %exit, label %loop - -exit: ; preds = %loop - ret i32 %accum.next -} - -; Can eliminate if we set nsw and, thus, think that we don't overflow SINT_MAX. - -define i32 @foobar6() { -; CHECK-LABEL: foobar6( -; CHECK: phi double - -entry: - br label %loop - -loop: - %accum = phi i32 [ -3220, %entry ], [ %accum.next, %loop ] - %iv = phi i32 [ 12, %entry ], [ %iv.next, %loop ] - %tmp1 = sitofp i32 %accum to double - tail call void @foo( double %tmp1 ) nounwind - %accum.next = add nsw i32 %accum, 9597741 - %iv.next = add nuw nsw i32 %iv, 1 - %exitcond = icmp ugt i32 %iv, 235 - br i1 %exitcond, label %exit, label %loop - -exit: ; preds = %loop - ret i32 %accum.next -} - -; Unable to eliminate cast because the integer IV overflows (accum exceeds -; UINT_MAX). - -define i32 @foobar7() { -; CHECK-LABEL: foobar7( -; CHECK-NOT: phi double -; CHECK-NOT: phi float -entry: - br label %loop - -loop: - %accum = phi i32 [ -3220, %entry ], [ %accum.next, %loop ] - %iv = phi i32 [ 12, %entry ], [ %iv.next, %loop ] - %tmp1 = uitofp i32 %accum to double - tail call void @foo( double %tmp1 ) nounwind - %accum.next = add i32 %accum, 9597741 - %iv.next = add nuw nsw i32 %iv, 1 - %exitcond = icmp ugt i32 %iv, 235 - br i1 %exitcond, label %exit, label %loop - -exit: ; preds = %loop - ret i32 %accum.next -} - -; Can eliminate if we set nuw and, thus, think that we don't overflow UINT_MAX. - -define i32 @foobar8() { -; CHECK-LABEL: foobar8( -; CHECK: phi double - -entry: - br label %loop - -loop: - %accum = phi i32 [ -3220, %entry ], [ %accum.next, %loop ] - %iv = phi i32 [ 12, %entry ], [ %iv.next, %loop ] - %tmp1 = uitofp i32 %accum to double - tail call void @foo( double %tmp1 ) nounwind - %accum.next = add nuw i32 %accum, 9597741 - %iv.next = add nuw nsw i32 %iv, 1 - %exitcond = icmp ugt i32 %iv, 235 - br i1 %exitcond, label %exit, label %loop - -exit: ; preds = %loop - ret i32 %accum.next -} - -declare void @bar(i32) - -declare void @foo(double) - -declare i32 @nn(...) diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/2009-11-10-LSRCrash.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/2009-11-10-LSRCrash.ll deleted file mode 100644 index 4032a599e8d..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/2009-11-10-LSRCrash.ll +++ /dev/null @@ -1,130 +0,0 @@ -; RUN: llc < %s -mtriple=i386-apple-darwin11 - -define void @_ZN4llvm20SelectionDAGLowering14visitInlineAsmENS_8CallSiteE() nounwind ssp align 2 { -entry: - br i1 undef, label %bb3.i, label %bb4.i - -bb3.i: ; preds = %entry - unreachable - -bb4.i: ; preds = %entry - br i1 undef, label %bb.i.i, label %_ZNK4llvm8CallSite14getCalledValueEv.exit - -bb.i.i: ; preds = %bb4.i - unreachable - -_ZNK4llvm8CallSite14getCalledValueEv.exit: ; preds = %bb4.i - br i1 undef, label %_ZN4llvm4castINS_9InlineAsmEPNS_5ValueEEENS_10cast_rettyIT_T0_E8ret_typeERKS6_.exit, label %bb6.i - -bb6.i: ; preds = %_ZNK4llvm8CallSite14getCalledValueEv.exit - unreachable - -_ZN4llvm4castINS_9InlineAsmEPNS_5ValueEEENS_10cast_rettyIT_T0_E8ret_typeERKS6_.exit: ; preds = %_ZNK4llvm8CallSite14getCalledValueEv.exit - br i1 undef, label %_ZL25hasInlineAsmMemConstraintRSt6vectorIN4llvm9InlineAsm14ConstraintInfoESaIS2_EERKNS0_14TargetLoweringE.exit, label %bb.i - -bb.i: ; preds = %_ZN4llvm4castINS_9InlineAsmEPNS_5ValueEEENS_10cast_rettyIT_T0_E8ret_typeERKS6_.exit - br label %_ZL25hasInlineAsmMemConstraintRSt6vectorIN4llvm9InlineAsm14ConstraintInfoESaIS2_EERKNS0_14TargetLoweringE.exit - -_ZL25hasInlineAsmMemConstraintRSt6vectorIN4llvm9InlineAsm14ConstraintInfoESaIS2_EERKNS0_14TargetLoweringE.exit: ; preds = %bb.i, %_ZN4llvm4castINS_9InlineAsmEPNS_5ValueEEENS_10cast_rettyIT_T0_E8ret_typeERKS6_.exit - br i1 undef, label %bb50, label %bb27 - -bb27: ; preds = %_ZL25hasInlineAsmMemConstraintRSt6vectorIN4llvm9InlineAsm14ConstraintInfoESaIS2_EERKNS0_14TargetLoweringE.exit - br i1 undef, label %bb1.i727, label %bb.i.i726 - -bb.i.i726: ; preds = %bb27 - unreachable - -bb1.i727: ; preds = %bb27 - unreachable - -bb50: ; preds = %_ZL25hasInlineAsmMemConstraintRSt6vectorIN4llvm9InlineAsm14ConstraintInfoESaIS2_EERKNS0_14TargetLoweringE.exit - br label %bb107 - -bb51: ; preds = %bb107 - br i1 undef, label %bb105, label %bb106 - -bb105: ; preds = %bb51 - unreachable - -bb106: ; preds = %bb51 - br label %bb107 - -bb107: ; preds = %bb106, %bb50 - br i1 undef, label %bb108, label %bb51 - -bb108: ; preds = %bb107 - br i1 undef, label %bb242, label %bb114 - -bb114: ; preds = %bb108 - br i1 undef, label %bb141, label %bb116 - -bb116: ; preds = %bb114 - br i1 undef, label %bb120, label %bb121 - -bb120: ; preds = %bb116 - unreachable - -bb121: ; preds = %bb116 - unreachable - -bb141: ; preds = %bb114 - br i1 undef, label %bb182, label %bb143 - -bb143: ; preds = %bb141 - br label %bb157 - -bb144: ; preds = %bb.i.i.i843 - switch i32 undef, label %bb155 [ - i32 2, label %bb153 - i32 6, label %bb153 - i32 4, label %bb153 - ] - -bb153: ; preds = %bb144, %bb144, %bb144 - %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1] - br label %bb157 - -bb155: ; preds = %bb144 - unreachable - -bb157: ; preds = %bb153, %bb143 - %indvar = phi i32 [ %indvar.next, %bb153 ], [ 0, %bb143 ] ; <i32> [#uses=2] - %0 = icmp eq i32 undef, %indvar ; <i1> [#uses=1] - switch i16 undef, label %bb6.i841 [ - i16 9, label %_ZN4llvm4castINS_14ConstantSDNodeENS_7SDValueEEENS_10cast_rettyIT_T0_E8ret_typeERKS5_.exit - i16 26, label %_ZN4llvm4castINS_14ConstantSDNodeENS_7SDValueEEENS_10cast_rettyIT_T0_E8ret_typeERKS5_.exit - ] - -bb6.i841: ; preds = %bb157 - unreachable - -_ZN4llvm4castINS_14ConstantSDNodeENS_7SDValueEEENS_10cast_rettyIT_T0_E8ret_typeERKS5_.exit: ; preds = %bb157, %bb157 - br i1 undef, label %bb.i.i.i843, label %bb1.i.i.i844 - -bb.i.i.i843: ; preds = %_ZN4llvm4castINS_14ConstantSDNodeENS_7SDValueEEENS_10cast_rettyIT_T0_E8ret_typeERKS5_.exit - br i1 %0, label %bb158, label %bb144 - -bb1.i.i.i844: ; preds = %_ZN4llvm4castINS_14ConstantSDNodeENS_7SDValueEEENS_10cast_rettyIT_T0_E8ret_typeERKS5_.exit - unreachable - -bb158: ; preds = %bb.i.i.i843 - br i1 undef, label %bb177, label %bb176 - -bb176: ; preds = %bb158 - unreachable - -bb177: ; preds = %bb158 - br i1 undef, label %bb179, label %bb178 - -bb178: ; preds = %bb177 - unreachable - -bb179: ; preds = %bb177 - unreachable - -bb182: ; preds = %bb141 - unreachable - -bb242: ; preds = %bb108 - unreachable -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/2011-07-20-DoubleIV.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/2011-07-20-DoubleIV.ll deleted file mode 100644 index 0fc928ca9b2..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/2011-07-20-DoubleIV.ll +++ /dev/null @@ -1,47 +0,0 @@ -; RUN: opt < %s -loop-reduce -S -mtriple=x86_64-unknown-unknown | FileCheck %s -; -; Test LSR's OptimizeShadowIV. Handle a floating-point IV with a -; nonzero initial value. -; rdar://9786536 - -; Provide legal integer types. -target datalayout = "n8:16:32:64" - - -; First, make sure LSR doesn't crash on an empty IVUsers list. -; CHECK-LABEL: @dummyIV( -; CHECK-NOT: phi -; CHECK-NOT: sitofp -; CHECK: br -define void @dummyIV() nounwind { -entry: - br label %loop - -loop: - %i.01 = phi i32 [ -39, %entry ], [ %inc, %loop ] - %conv = sitofp i32 %i.01 to double - %inc = add nsw i32 %i.01, 1 - br i1 undef, label %loop, label %for.end - -for.end: - unreachable -} - -; Now check that the computed double constant is correct. -; CHECK-LABEL: @doubleIV( -; CHECK: phi double [ -3.900000e+01, %entry ] -; CHECK: br -define void @doubleIV() nounwind { -entry: - br label %loop - -loop: - %i.01 = phi i32 [ -39, %entry ], [ %inc, %loop ] - %conv = sitofp i32 %i.01 to double - %div = fdiv double %conv, 4.000000e+01 - %inc = add nsw i32 %i.01, 1 - br i1 undef, label %loop, label %for.end - -for.end: - unreachable -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/2011-11-29-postincphi.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/2011-11-29-postincphi.ll deleted file mode 100644 index 8053940df13..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/2011-11-29-postincphi.ll +++ /dev/null @@ -1,36 +0,0 @@ -; RUN: llc < %s | FileCheck %s -; -; PR11431: handle a phi operand that is replaced by a postinc user. -; LSR first expands %t3 to %t2 in %phi -; LSR then expands %t2 in %phi into two decrements, one on each loop exit. - -target datalayout = "e-p:64:64:64-S128-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-f128:128:128-n8:16:32:64" -target triple = "x86_64-unknown-linux-gnu" - -declare i1 @check() nounwind - -; Check that LSR did something close to the behavior at the time of the bug. -; CHECK: @sqlite3DropTriggerPtr -; CHECK: incq %r{{[a-d]}}x -; CHECK: jne -; CHECK: decq %r{{[a-d]}}x -; CHECK: ret -define i64 @sqlite3DropTriggerPtr() nounwind { -bb: - %cmp = call zeroext i1 @check() - br label %bb1 - -bb1: ; preds = %bb4, %bb - %t0 = phi i64 [ 0, %bb ], [ %t3, %bb4 ] - %t2 = phi i64 [ 1, %bb ], [ %t5, %bb4 ] - %t3 = add nsw i64 %t0, 1 - br i1 %cmp, label %bb4, label %bb8 - -bb4: ; preds = %bb1 - %t5 = add nsw i64 %t2, 1 - br i1 %cmp, label %bb1, label %bb8 - -bb8: ; preds = %bb8, %bb4 - %phi = phi i64 [ %t3, %bb1 ], [ %t2, %bb4 ] - ret i64 %phi -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/2011-12-04-loserreg.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/2011-12-04-loserreg.ll deleted file mode 100644 index 862fff29cef..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/2011-12-04-loserreg.ll +++ /dev/null @@ -1,93 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | FileCheck %s -; -; Test LSR's ability to prune formulae that refer to nonexistent -; AddRecs in other loops. -; -; Unable to reduce this case further because it requires LSR to exceed -; ComplexityLimit. -; -; We really just want to ensure that LSR can process this loop without -; finding an unsatisfactory solution and bailing out. I've added -; dummyout, an obvious candidate for postinc replacement so we can -; verify that LSR removes it. - -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-S128" -target triple = "x86_64-apple-darwin" - -; CHECK-LABEL: @test( -; CHECK: for.body: -; CHECK: %lsr.iv -; CHECK-NOT: %dummyout -; CHECK: ret -define i64 @test(i64 %count, float* nocapture %srcrow, i32* nocapture %destrow) nounwind uwtable ssp { -entry: - %cmp34 = icmp eq i64 %count, 0 - br i1 %cmp34, label %for.end29, label %for.body - -for.body: ; preds = %entry, %for.body - %dummyiv = phi i64 [ %dummycnt, %for.body ], [ 0, %entry ] - %indvars.iv39 = phi i64 [ %indvars.iv.next40, %for.body ], [ 0, %entry ] - %dp.036 = phi i32* [ %add.ptr, %for.body ], [ %destrow, %entry ] - %p.035 = phi float* [ %incdec.ptr4, %for.body ], [ %srcrow, %entry ] - %incdec.ptr = getelementptr inbounds float, float* %p.035, i64 1 - %0 = load float, float* %incdec.ptr, align 4 - %incdec.ptr2 = getelementptr inbounds float, float* %p.035, i64 2 - %1 = load float, float* %incdec.ptr2, align 4 - %incdec.ptr3 = getelementptr inbounds float, float* %p.035, i64 3 - %2 = load float, float* %incdec.ptr3, align 4 - %incdec.ptr4 = getelementptr inbounds float, float* %p.035, i64 4 - %3 = load float, float* %incdec.ptr4, align 4 - %4 = load i32, i32* %dp.036, align 4 - %conv5 = fptoui float %0 to i32 - %or = or i32 %4, %conv5 - %arrayidx6 = getelementptr inbounds i32, i32* %dp.036, i64 1 - %5 = load i32, i32* %arrayidx6, align 4 - %conv7 = fptoui float %1 to i32 - %or8 = or i32 %5, %conv7 - %arrayidx9 = getelementptr inbounds i32, i32* %dp.036, i64 2 - %6 = load i32, i32* %arrayidx9, align 4 - %conv10 = fptoui float %2 to i32 - %or11 = or i32 %6, %conv10 - %arrayidx12 = getelementptr inbounds i32, i32* %dp.036, i64 3 - %7 = load i32, i32* %arrayidx12, align 4 - %conv13 = fptoui float %3 to i32 - %or14 = or i32 %7, %conv13 - store i32 %or, i32* %dp.036, align 4 - store i32 %or8, i32* %arrayidx6, align 4 - store i32 %or11, i32* %arrayidx9, align 4 - store i32 %or14, i32* %arrayidx12, align 4 - %add.ptr = getelementptr inbounds i32, i32* %dp.036, i64 4 - %indvars.iv.next40 = add i64 %indvars.iv39, 4 - %dummycnt = add i64 %dummyiv, 1 - %cmp = icmp ult i64 %indvars.iv.next40, %count - br i1 %cmp, label %for.body, label %for.cond19.preheader - -for.cond19.preheader: ; preds = %for.body - %dummyout = add i64 %dummyiv, 1 - %rem = and i64 %count, 3 - %cmp2130 = icmp eq i64 %rem, 0 - br i1 %cmp2130, label %for.end29, label %for.body23.lr.ph - -for.body23.lr.ph: ; preds = %for.cond19.preheader - %8 = and i64 %count, 3 - br label %for.body23 - -for.body23: ; preds = %for.body23, %for.body23.lr.ph - %indvars.iv = phi i64 [ 0, %for.body23.lr.ph ], [ %indvars.iv.next, %for.body23 ] - %dp.132 = phi i32* [ %add.ptr, %for.body23.lr.ph ], [ %incdec.ptr28, %for.body23 ] - %p.131 = phi float* [ %incdec.ptr4, %for.body23.lr.ph ], [ %incdec.ptr24, %for.body23 ] - %incdec.ptr24 = getelementptr inbounds float, float* %p.131, i64 1 - %9 = load float, float* %incdec.ptr24, align 4 - %10 = load i32, i32* %dp.132, align 4 - %conv25 = fptoui float %9 to i32 - %or26 = or i32 %10, %conv25 - store i32 %or26, i32* %dp.132, align 4 - %indvars.iv.next = add i64 %indvars.iv, 1 - %incdec.ptr28 = getelementptr inbounds i32, i32* %dp.132, i64 1 - %exitcond = icmp eq i64 %indvars.iv.next, %8 - br i1 %exitcond, label %for.end29, label %for.body23 - -for.end29: ; preds = %entry, %for.body23, %for.cond19.preheader - %result = phi i64 [ 0, %entry ], [ %dummyout, %for.body23 ], [ %dummyout, %for.cond19.preheader ] - ret i64 %result -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/2012-01-13-phielim.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/2012-01-13-phielim.ll deleted file mode 100644 index 2e32d916fe3..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/2012-01-13-phielim.ll +++ /dev/null @@ -1,148 +0,0 @@ -; RUN: llc < %s -O3 -march=x86-64 -mcpu=core2 | FileCheck %s - -declare i1 @check() nounwind -declare i1 @foo(i8*, i8*, i8*) nounwind - -; Check that redundant phi elimination ran -; CHECK: @test -; CHECK: %while.body.i -; CHECK: movs -; CHECK-NOT: movs -; CHECK: %for.end.i -define i32 @test(i8* %base) nounwind uwtable ssp { -entry: - br label %while.body.lr.ph.i - -while.body.lr.ph.i: ; preds = %cond.true.i - br label %while.body.i - -while.body.i: ; preds = %cond.true29.i, %while.body.lr.ph.i - %indvars.iv7.i = phi i64 [ 16, %while.body.lr.ph.i ], [ %indvars.iv.next8.i, %cond.true29.i ] - %i.05.i = phi i64 [ 0, %while.body.lr.ph.i ], [ %indvars.iv7.i, %cond.true29.i ] - %sext.i = shl i64 %i.05.i, 32 - %idx.ext.i = ashr exact i64 %sext.i, 32 - %add.ptr.sum.i = add i64 %idx.ext.i, 16 - br label %for.body.i - -for.body.i: ; preds = %for.body.i, %while.body.i - %indvars.iv.i = phi i64 [ 0, %while.body.i ], [ %indvars.iv.next.i, %for.body.i ] - %add.ptr.sum = add i64 %add.ptr.sum.i, %indvars.iv.i - %arrayidx22.i = getelementptr inbounds i8, i8* %base, i64 %add.ptr.sum - %0 = load i8, i8* %arrayidx22.i, align 1 - %indvars.iv.next.i = add i64 %indvars.iv.i, 1 - %cmp = call i1 @check() nounwind - br i1 %cmp, label %for.end.i, label %for.body.i - -for.end.i: ; preds = %for.body.i - %add.ptr.i144 = getelementptr inbounds i8, i8* %base, i64 %add.ptr.sum.i - %cmp2 = tail call i1 @foo(i8* %add.ptr.i144, i8* %add.ptr.i144, i8* undef) nounwind - br i1 %cmp2, label %cond.true29.i, label %cond.false35.i - -cond.true29.i: ; preds = %for.end.i - %indvars.iv.next8.i = add i64 %indvars.iv7.i, 16 - br i1 false, label %exit, label %while.body.i - -cond.false35.i: ; preds = %for.end.i - unreachable - -exit: ; preds = %cond.true29.i, %cond.true.i - ret i32 0 -} - -%struct.anon.7.91.199.307.415.475.559.643.751.835.943.1003.1111.1219.1351.1375.1399.1435.1471.1483.1519.1531.1651.1771 = type { i32, i32, i32 } - -@tags = external global [5000 x %struct.anon.7.91.199.307.415.475.559.643.751.835.943.1003.1111.1219.1351.1375.1399.1435.1471.1483.1519.1531.1651.1771], align 16 - -; PR11782: SCEVExpander assert -; -; Test phi reuse after LSR that requires SCEVExpander to hoist an -; interesting GEP. -; -; CHECK: @test2 -; CHECK: %entry -; CHECK-NOT: mov -; CHECK: je -define void @test2(i32 %n) nounwind uwtable { -entry: - br i1 undef, label %while.end, label %for.cond468 - -for.cond468: ; preds = %if.then477, %entry - %indvars.iv1163 = phi i64 [ %indvars.iv.next1164, %if.then477 ], [ 1, %entry ] - %k.0.in = phi i32* [ %last, %if.then477 ], [ getelementptr inbounds ([5000 x %struct.anon.7.91.199.307.415.475.559.643.751.835.943.1003.1111.1219.1351.1375.1399.1435.1471.1483.1519.1531.1651.1771], [5000 x %struct.anon.7.91.199.307.415.475.559.643.751.835.943.1003.1111.1219.1351.1375.1399.1435.1471.1483.1519.1531.1651.1771]* @tags, i64 0, i64 0, i32 2), %entry ] - %k.0 = load i32, i32* %k.0.in, align 4 - %0 = trunc i64 %indvars.iv1163 to i32 - %cmp469 = icmp slt i32 %0, %n - br i1 %cmp469, label %for.body471, label %for.inc498 - -for.body471: ; preds = %for.cond468 - %first = getelementptr inbounds [5000 x %struct.anon.7.91.199.307.415.475.559.643.751.835.943.1003.1111.1219.1351.1375.1399.1435.1471.1483.1519.1531.1651.1771], [5000 x %struct.anon.7.91.199.307.415.475.559.643.751.835.943.1003.1111.1219.1351.1375.1399.1435.1471.1483.1519.1531.1651.1771]* @tags, i64 0, i64 %indvars.iv1163, i32 1 - %1 = load i32, i32* %first, align 4 - br i1 undef, label %if.then477, label %for.inc498 - -if.then477: ; preds = %for.body471 - %last = getelementptr inbounds [5000 x %struct.anon.7.91.199.307.415.475.559.643.751.835.943.1003.1111.1219.1351.1375.1399.1435.1471.1483.1519.1531.1651.1771], [5000 x %struct.anon.7.91.199.307.415.475.559.643.751.835.943.1003.1111.1219.1351.1375.1399.1435.1471.1483.1519.1531.1651.1771]* @tags, i64 0, i64 %indvars.iv1163, i32 2 - %indvars.iv.next1164 = add i64 %indvars.iv1163, 1 - br label %for.cond468 - -for.inc498: ; preds = %for.inc498, %for.body471, %for.cond468 - br label %for.inc498 - -while.end: ; preds = %entry - ret void -} - -; PR12898: SCEVExpander crash -; Test redundant phi elimination when the deleted phi's increment is -; itself a phi. -; -; CHECK: @test3 -; CHECK: %meshBB1 -; CHECK: %meshBB -; CHECK-NEXT: Parent Loop -; CHECK-NEXT: Inner Loop -; CHECK-NEXT: incq -; CHECK: testb -; CHECK: je -; CHECK: jmp -define fastcc void @test3(double* nocapture %u) nounwind uwtable ssp { -entry: - br i1 undef, label %meshBB1, label %meshBB5 - -for.inc8.us.i: ; preds = %for.body3.us.i - br i1 undef, label %meshBB1, label %meshBB - -for.body3.us.i: ; preds = %meshBB, %for.body3.lr.ph.us.i - %indvars.iv.i.SV.phi = phi i64 [ %indvars.iv.next.i, %meshBB ], [ 0, %for.body3.lr.ph.us.i ] - %storemerge13.us.i.SV.phi = phi i32 [ 0, %meshBB ], [ 0, %for.body3.lr.ph.us.i ] - %Opq.sa.calc12 = sub i32 undef, 227 - %0 = add nsw i64 %indvars.iv.i.SV.phi, %indvars.iv8.i.SV.phi26 - %1 = trunc i64 %0 to i32 - %mul.i.us.i = mul nsw i32 0, %1 - %arrayidx5.us.i = getelementptr inbounds double, double* %u, i64 %indvars.iv.i.SV.phi - %2 = load double, double* %arrayidx5.us.i, align 8 - %indvars.iv.next.i = add i64 %indvars.iv.i.SV.phi, 1 - br i1 undef, label %for.inc8.us.i, label %meshBB - -for.body3.lr.ph.us.i: ; preds = %meshBB1, %meshBB - %indvars.iv8.i.SV.phi26 = phi i64 [ undef, %meshBB1 ], [ %indvars.iv8.i.SV.phi24, %meshBB ] - %arrayidx.us.i = getelementptr inbounds double, double* undef, i64 %indvars.iv8.i.SV.phi26 - %3 = add i64 %indvars.iv8.i.SV.phi26, 1 - br label %for.body3.us.i - -for.inc8.us.i2: ; preds = %meshBB5 - unreachable - -eval_At_times_u.exit: ; preds = %meshBB5 - ret void - -meshBB: ; preds = %for.body3.us.i, %for.inc8.us.i - %indvars.iv8.i.SV.phi24 = phi i64 [ undef, %for.body3.us.i ], [ %3, %for.inc8.us.i ] - %meshStackVariable.phi = phi i32 [ %Opq.sa.calc12, %for.body3.us.i ], [ undef, %for.inc8.us.i ] - br i1 undef, label %for.body3.lr.ph.us.i, label %for.body3.us.i - -meshBB1: ; preds = %for.inc8.us.i, %entry - br label %for.body3.lr.ph.us.i - -meshBB5: ; preds = %entry - br i1 undef, label %eval_At_times_u.exit, label %for.inc8.us.i2 -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/bin_power.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/bin_power.ll deleted file mode 100644 index c9781241c96..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/bin_power.ll +++ /dev/null @@ -1,264 +0,0 @@ -; RUN: opt < %s -scalar-evolution-huge-expr-threshold=1000000 -loop-reduce -S | FileCheck %s - -target datalayout = "e-m:e-i32:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -; Show that the b^2 is expanded correctly. -define i32 @test_01(i32 %a) { -; CHECK-LABEL: @test_01 -; CHECK: entry: -; CHECK-NEXT: br label %loop -; CHECK: loop: -; CHECK-NEXT: [[IV:[^ ]+]] = phi i32 [ [[IV_INC:[^ ]+]], %loop ], [ 0, %entry ] -; CHECK-NEXT: [[IV_INC]] = add nsw i32 [[IV]], -1 -; CHECK-NEXT: [[EXITCOND:[^ ]+]] = icmp eq i32 [[IV_INC]], -80 -; CHECK-NEXT: br i1 [[EXITCOND]], label %exit, label %loop -; CHECK: exit: -; CHECK-NEXT: [[B:[^ ]+]] = add i32 %a, 1 -; CHECK-NEXT: [[B2:[^ ]+]] = mul i32 [[B]], [[B]] -; CHECK-NEXT: [[R1:[^ ]+]] = add i32 [[B2]], -1 -; CHECK-NEXT: [[R2:[^ ]+]] = sub i32 [[R1]], [[IV_INC]] -; CHECK-NEXT: ret i32 [[R2]] - -entry: - br label %loop - -loop: ; preds = %loop, %entry - %indvars.iv = phi i32 [ 0, %entry ], [ %indvars.iv.next, %loop ] - %b = add i32 %a, 1 - %b.pow.2 = mul i32 %b, %b - %result = add i32 %b.pow.2, %indvars.iv - %indvars.iv.next = add nuw nsw i32 %indvars.iv, 1 - %exitcond = icmp eq i32 %indvars.iv.next, 80 - br i1 %exitcond, label %exit, label %loop - -exit: ; preds = %loop - ret i32 %result -} - -; Show that b^8 is expanded correctly. -define i32 @test_02(i32 %a) { -; CHECK-LABEL: @test_02 -; CHECK: entry: -; CHECK-NEXT: br label %loop -; CHECK: loop: -; CHECK-NEXT: [[IV:[^ ]+]] = phi i32 [ [[IV_INC:[^ ]+]], %loop ], [ 0, %entry ] -; CHECK-NEXT: [[IV_INC]] = add nsw i32 [[IV]], -1 -; CHECK-NEXT: [[EXITCOND:[^ ]+]] = icmp eq i32 [[IV_INC]], -80 -; CHECK-NEXT: br i1 [[EXITCOND]], label %exit, label %loop -; CHECK: exit: -; CHECK-NEXT: [[B:[^ ]+]] = add i32 %a, 1 -; CHECK-NEXT: [[B2:[^ ]+]] = mul i32 [[B]], [[B]] -; CHECK-NEXT: [[B4:[^ ]+]] = mul i32 [[B2]], [[B2]] -; CHECK-NEXT: [[B8:[^ ]+]] = mul i32 [[B4]], [[B4]] -; CHECK-NEXT: [[R1:[^ ]+]] = add i32 [[B8]], -1 -; CHECK-NEXT: [[R2:[^ ]+]] = sub i32 [[R1]], [[IV_INC]] -; CHECK-NEXT: ret i32 [[R2]] -entry: - br label %loop - -loop: ; preds = %loop, %entry - %indvars.iv = phi i32 [ 0, %entry ], [ %indvars.iv.next, %loop ] - %b = add i32 %a, 1 - %b.pow.2 = mul i32 %b, %b - %b.pow.4 = mul i32 %b.pow.2, %b.pow.2 - %b.pow.8 = mul i32 %b.pow.4, %b.pow.4 - %result = add i32 %b.pow.8, %indvars.iv - %indvars.iv.next = add nuw nsw i32 %indvars.iv, 1 - %exitcond = icmp eq i32 %indvars.iv.next, 80 - br i1 %exitcond, label %exit, label %loop - -exit: ; preds = %loop - ret i32 %result -} - -; Show that b^27 (27 = 1 + 2 + 8 + 16) is expanded correctly. -define i32 @test_03(i32 %a) { -; CHECK-LABEL: @test_03 -; CHECK: entry: -; CHECK-NEXT: br label %loop -; CHECK: loop: -; CHECK-NEXT: [[IV:[^ ]+]] = phi i32 [ [[IV_INC:[^ ]+]], %loop ], [ 0, %entry ] -; CHECK-NEXT: [[IV_INC]] = add nsw i32 [[IV]], -1 -; CHECK-NEXT: [[EXITCOND:[^ ]+]] = icmp eq i32 [[IV_INC]], -80 -; CHECK-NEXT: br i1 [[EXITCOND]], label %exit, label %loop -; CHECK: exit: -; CHECK-NEXT: [[B:[^ ]+]] = add i32 %a, 1 -; CHECK-NEXT: [[B2:[^ ]+]] = mul i32 [[B]], [[B]] -; CHECK-NEXT: [[B3:[^ ]+]] = mul i32 [[B]], [[B2]] -; CHECK-NEXT: [[B4:[^ ]+]] = mul i32 [[B2]], [[B2]] -; CHECK-NEXT: [[B8:[^ ]+]] = mul i32 [[B4]], [[B4]] -; CHECK-NEXT: [[B11:[^ ]+]] = mul i32 [[B3]], [[B8]] -; CHECK-NEXT: [[B16:[^ ]+]] = mul i32 [[B8]], [[B8]] -; CHECK-NEXT: [[B27:[^ ]+]] = mul i32 [[B11]], [[B16]] -; CHECK-NEXT: [[R1:[^ ]+]] = add i32 [[B27]], -1 -; CHECK-NEXT: [[R2:[^ ]+]] = sub i32 [[R1]], [[IV_INC]] -; CHECK-NEXT: ret i32 [[R2]] -entry: - br label %loop - -loop: ; preds = %loop, %entry - %indvars.iv = phi i32 [ 0, %entry ], [ %indvars.iv.next, %loop ] - %b = add i32 %a, 1 - %b.pow.2 = mul i32 %b, %b - %b.pow.4 = mul i32 %b.pow.2, %b.pow.2 - %b.pow.8 = mul i32 %b.pow.4, %b.pow.4 - %b.pow.16 = mul i32 %b.pow.8, %b.pow.8 - %b.pow.24 = mul i32 %b.pow.16, %b.pow.8 - %b.pow.25 = mul i32 %b.pow.24, %b - %b.pow.26 = mul i32 %b.pow.25, %b - %b.pow.27 = mul i32 %b.pow.26, %b - %result = add i32 %b.pow.27, %indvars.iv - %indvars.iv.next = add nuw nsw i32 %indvars.iv, 1 - %exitcond = icmp eq i32 %indvars.iv.next, 80 - br i1 %exitcond, label %exit, label %loop - -exit: ; preds = %loop - ret i32 %result -} - -; Show how linear calculation of b^16 is turned into logarithmic. -define i32 @test_04(i32 %a) { -; CHECK-LABEL: @test_04 -; CHECK: entry: -; CHECK-NEXT: br label %loop -; CHECK: loop: -; CHECK-NEXT: [[IV:[^ ]+]] = phi i32 [ [[IV_INC:[^ ]+]], %loop ], [ 0, %entry ] -; CHECK-NEXT: [[IV_INC]] = add nsw i32 [[IV]], -1 -; CHECK-NEXT: [[EXITCOND:[^ ]+]] = icmp eq i32 [[IV_INC]], -80 -; CHECK-NEXT: br i1 [[EXITCOND]], label %exit, label %loop -; CHECK: exit: -; CHECK-NEXT: [[B:[^ ]+]] = add i32 %a, 1 -; CHECK-NEXT: [[B2:[^ ]+]] = mul i32 [[B]], [[B]] -; CHECK-NEXT: [[B4:[^ ]+]] = mul i32 [[B2]], [[B2]] -; CHECK-NEXT: [[B8:[^ ]+]] = mul i32 [[B4]], [[B4]] -; CHECK-NEXT: [[B16:[^ ]+]] = mul i32 [[B8]], [[B8]] -; CHECK-NEXT: [[R1:[^ ]+]] = add i32 [[B16]], -1 -; CHECK-NEXT: [[R2:[^ ]+]] = sub i32 [[R1]], [[IV_INC]] -; CHECK-NEXT: ret i32 [[R2]] -entry: - br label %loop - -loop: ; preds = %loop, %entry - %indvars.iv = phi i32 [ 0, %entry ], [ %indvars.iv.next, %loop ] - %b = add i32 %a, 1 - %b.pow.2 = mul i32 %b, %b - %b.pow.3 = mul i32 %b.pow.2, %b - %b.pow.4 = mul i32 %b.pow.3, %b - %b.pow.5 = mul i32 %b.pow.4, %b - %b.pow.6 = mul i32 %b.pow.5, %b - %b.pow.7 = mul i32 %b.pow.6, %b - %b.pow.8 = mul i32 %b.pow.7, %b - %b.pow.9 = mul i32 %b.pow.8, %b - %b.pow.10 = mul i32 %b.pow.9, %b - %b.pow.11 = mul i32 %b.pow.10, %b - %b.pow.12 = mul i32 %b.pow.11, %b - %b.pow.13 = mul i32 %b.pow.12, %b - %b.pow.14 = mul i32 %b.pow.13, %b - %b.pow.15 = mul i32 %b.pow.14, %b - %b.pow.16 = mul i32 %b.pow.15, %b - %result = add i32 %b.pow.16, %indvars.iv - %indvars.iv.next = add nuw nsw i32 %indvars.iv, 1 - %exitcond = icmp eq i32 %indvars.iv.next, 80 - br i1 %exitcond, label %exit, label %loop - -exit: ; preds = %loop - ret i32 %result -} - -; The output here is reasonably big, we just check that the amount of expanded -; instructions is sane. -define i32 @test_05(i32 %a) { -; CHECK-LABEL: @test_05 -; CHECK: entry: -; CHECK-NEXT: br label %loop -; CHECK: loop: -; CHECK-NEXT: [[IV:[^ ]+]] = phi i32 [ [[IV_INC:[^ ]+]], %loop ], [ 0, %entry ] -; CHECK-NEXT: [[IV_INC]] = add nsw i32 [[IV]], -1 -; CHECK-NEXT: [[EXITCOND:[^ ]+]] = icmp eq i32 [[IV_INC]], -80 -; CHECK-NEXT: br i1 [[EXITCOND]], label %exit, label %loop -; CHECK: exit: -; CHECK: %100 -; CHECK-NOT: %150 - -entry: - br label %loop - -loop: ; preds = %loop, %entry - %indvars.iv = phi i32 [ 0, %entry ], [ %indvars.iv.next, %loop ] - %tmp3 = add i32 %a, 1 - %tmp4 = mul i32 %tmp3, %tmp3 - %tmp5 = mul i32 %tmp4, %tmp4 - %tmp6 = mul i32 %tmp5, %tmp5 - %tmp7 = mul i32 %tmp6, %tmp6 - %tmp8 = mul i32 %tmp7, %tmp7 - %tmp9 = mul i32 %tmp8, %tmp8 - %tmp10 = mul i32 %tmp9, %tmp9 - %tmp11 = mul i32 %tmp10, %tmp10 - %tmp12 = mul i32 %tmp11, %tmp11 - %tmp13 = mul i32 %tmp12, %tmp12 - %tmp14 = mul i32 %tmp13, %tmp13 - %tmp15 = mul i32 %tmp14, %tmp14 - %tmp16 = mul i32 %tmp15, %tmp15 - %tmp17 = mul i32 %tmp16, %tmp16 - %tmp18 = mul i32 %tmp17, %tmp17 - %tmp19 = mul i32 %tmp18, %tmp18 - %tmp20 = mul i32 %tmp19, %tmp19 - %tmp22 = add i32 %tmp20, %indvars.iv - %indvars.iv.next = add nuw nsw i32 %indvars.iv, 1 - %exitcond = icmp eq i32 %indvars.iv.next, 80 - br i1 %exitcond, label %exit, label %loop - -exit: ; preds = %loop - ret i32 %tmp22 -} - -; Show that the transformation works even if the calculation involves different -; values inside. -define i32 @test_06(i32 %a, i32 %c) { -; CHECK-LABEL: @test_06 -; CHECK: entry: -; CHECK-NEXT: br label %loop -; CHECK: loop: -; CHECK-NEXT: [[IV:[^ ]+]] = phi i32 [ [[IV_INC:[^ ]+]], %loop ], [ 0, %entry ] -; CHECK-NEXT: [[IV_INC]] = add nsw i32 [[IV]], -1 -; CHECK-NEXT: [[EXITCOND:[^ ]+]] = icmp eq i32 [[IV_INC]], -80 -; CHECK-NEXT: br i1 [[EXITCOND]], label %exit, label %loop -; CHECK: exit: -; CHECK: [[B:[^ ]+]] = add i32 %a, 1 -; CHECK-NEXT: [[B2:[^ ]+]] = mul i32 [[B]], [[B]] -; CHECK-NEXT: [[B4:[^ ]+]] = mul i32 [[B2]], [[B2]] -; CHECK-NEXT: [[B8:[^ ]+]] = mul i32 [[B4]], [[B4]] -; CHECK-NEXT: [[B16:[^ ]+]] = mul i32 [[B8]], [[B8]] -entry: - br label %loop - -loop: ; preds = %loop, %entry - %indvars.iv = phi i32 [ 0, %entry ], [ %indvars.iv.next, %loop ] - %b = add i32 %a, 1 - %b.pow.2.tmp = mul i32 %b, %b - %b.pow.2 = mul i32 %b.pow.2.tmp, %c - %b.pow.3 = mul i32 %b.pow.2, %b - %b.pow.4 = mul i32 %b.pow.3, %b - %b.pow.5 = mul i32 %b.pow.4, %b - %b.pow.6.tmp = mul i32 %b.pow.5, %b - %b.pow.6 = mul i32 %b.pow.6.tmp, %c - %b.pow.7 = mul i32 %b.pow.6, %b - %b.pow.8 = mul i32 %b.pow.7, %b - %b.pow.9 = mul i32 %b.pow.8, %b - %b.pow.10 = mul i32 %b.pow.9, %b - %b.pow.11 = mul i32 %b.pow.10, %b - %b.pow.12.tmp = mul i32 %b.pow.11, %b - %b.pow.12 = mul i32 %c, %b.pow.12.tmp - %b.pow.13 = mul i32 %b.pow.12, %b - %b.pow.14 = mul i32 %b.pow.13, %b - %b.pow.15 = mul i32 %b.pow.14, %b - %b.pow.16 = mul i32 %b.pow.15, %b - %result = add i32 %b.pow.16, %indvars.iv - %indvars.iv.next = add nuw nsw i32 %indvars.iv, 1 - %exitcond = icmp eq i32 %indvars.iv.next, 80 - br i1 %exitcond, label %exit, label %loop - -exit: ; preds = %loop - ret i32 %result -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/canonical-2.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/canonical-2.ll deleted file mode 100644 index 69bae3a5115..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/canonical-2.ll +++ /dev/null @@ -1,36 +0,0 @@ -; REQUIRES: asserts -; RUN: opt -mtriple=x86_64-unknown-linux-gnu -loop-reduce -S < %s -; PR33077. Check the LSR Use formula to be inserted is already canonicalized and -; will not trigger assertion. - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" - -; Function Attrs: uwtable -define void @foo() { -cHeapLvb.exit: - br label %not_zero48.us - -not_zero48.us: ; preds = %not_zero48.us, %cHeapLvb.exit - %indvars.iv.us = phi i64 [ %indvars.iv.next.us.7, %not_zero48.us ], [ undef, %cHeapLvb.exit ] - %0 = phi i32 [ %13, %not_zero48.us ], [ undef, %cHeapLvb.exit ] - %indvars.iv.next.us = add nuw nsw i64 %indvars.iv.us, 1 - %1 = add i32 %0, 2 - %2 = getelementptr inbounds i32, i32 addrspace(1)* undef, i64 %indvars.iv.next.us - %3 = load i32, i32 addrspace(1)* %2, align 4 - %4 = add i32 %0, 3 - %5 = load i32, i32 addrspace(1)* undef, align 4 - %6 = sub i32 undef, %5 - %factor.us.2 = shl i32 %6, 1 - %7 = add i32 %factor.us.2, %1 - %8 = load i32, i32 addrspace(1)* undef, align 4 - %9 = sub i32 %7, %8 - %factor.us.3 = shl i32 %9, 1 - %10 = add i32 %factor.us.3, %4 - %11 = load i32, i32 addrspace(1)* undef, align 4 - %12 = sub i32 %10, %11 - %factor.us.4 = shl i32 %12, 1 - %13 = add i32 %0, 8 - %indvars.iv.next.us.7 = add nsw i64 %indvars.iv.us, 8 - br label %not_zero48.us -} - diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/canonical.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/canonical.ll deleted file mode 100644 index 6b6acb86874..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/canonical.ll +++ /dev/null @@ -1,65 +0,0 @@ -; RUN: opt -mtriple=x86_64-unknown-linux-gnu -loop-reduce -lsr-insns-cost=false -S < %s | FileCheck %s -; Check LSR formula canonicalization will put loop invariant regs before -; induction variable of current loop, so exprs involving loop invariant regs -; can be promoted outside of current loop. - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" - -define void @foo(i32 %size, i32 %nsteps, i8* nocapture %maxarray, i8* nocapture readnone %buffer, i32 %init) local_unnamed_addr #0 { -entry: - %cmp25 = icmp sgt i32 %nsteps, 0 - br i1 %cmp25, label %for.cond1.preheader.lr.ph, label %for.end12 - -for.cond1.preheader.lr.ph: ; preds = %entry - %cmp223 = icmp sgt i32 %size, 1 - %t0 = sext i32 %init to i64 - %wide.trip.count = zext i32 %size to i64 - %wide.trip.count31 = zext i32 %nsteps to i64 - br label %for.cond1.preheader - -for.cond1.preheader: ; preds = %for.inc10, %for.cond1.preheader.lr.ph - %indvars.iv28 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next29, %for.inc10 ] - br i1 %cmp223, label %for.body3.lr.ph, label %for.inc10 - -for.body3.lr.ph: ; preds = %for.cond1.preheader - %t1 = add nsw i64 %indvars.iv28, %t0 - %t2 = trunc i64 %indvars.iv28 to i8 - br label %for.body3 - -; Make sure loop invariant items are grouped together so that load address can -; be represented in one getelementptr. -; CHECK-LABEL: for.body3: -; CHECK-NEXT: [[LSR:%[^,]+]] = phi i64 [ 1, %for.body3.lr.ph ], [ {{.*}}, %for.body3 ] -; CHECK-NOT: = phi i64 -; CHECK-NEXT: [[LOADADDR:%[^,]+]] = getelementptr i8, i8* {{.*}}, i64 [[LSR]] -; CHECK-NEXT: = load i8, i8* [[LOADADDR]], align 1 -; CHECK: br i1 %exitcond, label %for.inc10.loopexit, label %for.body3 - -for.body3: ; preds = %for.body3, %for.body3.lr.ph - %indvars.iv = phi i64 [ 1, %for.body3.lr.ph ], [ %indvars.iv.next, %for.body3 ] - %t5 = trunc i64 %indvars.iv to i8 - %t3 = add nsw i64 %t1, %indvars.iv - %arrayidx = getelementptr inbounds i8, i8* %maxarray, i64 %t3 - %t4 = load i8, i8* %arrayidx, align 1 - %add5 = add i8 %t4, %t5 - %add6 = add i8 %add5, %t2 - %arrayidx9 = getelementptr inbounds i8, i8* %maxarray, i64 %indvars.iv - store i8 %add6, i8* %arrayidx9, align 1 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 - %exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count - br i1 %exitcond, label %for.inc10.loopexit, label %for.body3 - -for.inc10.loopexit: ; preds = %for.body3 - br label %for.inc10 - -for.inc10: ; preds = %for.inc10.loopexit, %for.cond1.preheader - %indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1 - %exitcond32 = icmp eq i64 %indvars.iv.next29, %wide.trip.count31 - br i1 %exitcond32, label %for.end12.loopexit, label %for.cond1.preheader - -for.end12.loopexit: ; preds = %for.inc10 - br label %for.end12 - -for.end12: ; preds = %for.end12.loopexit, %entry - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/incorrect-offset-scaling.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/incorrect-offset-scaling.ll deleted file mode 100644 index 00c3222b005..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/incorrect-offset-scaling.ll +++ /dev/null @@ -1,46 +0,0 @@ -; RUN: opt -S -loop-reduce < %s | FileCheck %s - -target triple = "x86_64-unknown-unknown" -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" - -define void @incorrect_offset_scaling(i64, i64*) { -top: - br label %L - -L: ; preds = %idxend.10, %idxend, %L2, %top - br i1 undef, label %L, label %L1 - -L1: ; preds = %L1.preheader, %L2 - %r13 = phi i64 [ %r1, %L2 ], [ 1, %L ] -; CHECK: %lsr.iv = phi i64 [ 0, %L{{[^ ]+}} ], [ %lsr.iv.next, %L2 ] -; CHECK-NOT: %lsr.iv = phi i64 [ -1, %L{{[^ ]+}} ], [ %lsr.iv.next, %L2 ] -; CHECK: br - %r0 = add i64 %r13, -1 - br label %idxend.8 - -L2: ; preds = %idxend.8 - %r1 = add i64 %r13, 1 - br i1 undef, label %L, label %L1 - -if6: ; preds = %idxend.8 - %r2 = add i64 %0, -1 - %r3 = load i64, i64* %1, align 8 -; CHECK: %r2 = add i64 %0, -1 -; CHECK: %r3 = load i64 - br label %ib - -idxend.8: ; preds = %L1 - br i1 undef, label %if6, label %L2 - -ib: ; preds = %if6 - %r4 = mul i64 %r3, %r0 - %r5 = add i64 %r2, %r4 - %r6 = icmp ult i64 %r5, undef -; CHECK: %r4 = mul i64 %r3, %lsr.iv -; CHECK: %r5 = add i64 %r2, %r4 -; CHECK: %r6 = icmp ult i64 %r5, undef -; CHECK: %r7 = getelementptr i64, i64* undef, i64 %r5 - %r7 = getelementptr i64, i64* undef, i64 %r5 - store i64 1, i64* %r7, align 8 - br label %L -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/ivchain-X86.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/ivchain-X86.ll deleted file mode 100644 index 0be39d3814a..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/ivchain-X86.ll +++ /dev/null @@ -1,576 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc < %s -O3 -mtriple=x86_64-unknown-unknown -mcpu=core2 | FileCheck %s -check-prefix=X64 -; RUN: llc < %s -O3 -mtriple=i686-unknown-unknown -mcpu=core2 | FileCheck %s -check-prefix=X32 - -; @simple is the most basic chain of address induction variables. Chaining -; saves at least one register and avoids complex addressing and setup -; code. -; -; %x * 4 -; no other address computation in the preheader -; no complex address modes -; -; no expensive address computation in the preheader -; no complex address modes - -define i32 @simple(i32* %a, i32* %b, i32 %x) nounwind { -; X64-LABEL: simple: -; X64: # %bb.0: # %entry -; X64-NEXT: movslq %edx, %rcx -; X64-NEXT: shlq $2, %rcx -; X64-NEXT: xorl %eax, %eax -; X64-NEXT: .p2align 4, 0x90 -; X64-NEXT: .LBB0_1: # %loop -; X64-NEXT: # =>This Inner Loop Header: Depth=1 -; X64-NEXT: addl (%rdi), %eax -; X64-NEXT: leaq (%rdi,%rcx), %r8 -; X64-NEXT: addl (%rdi,%rcx), %eax -; X64-NEXT: leaq (%r8,%rcx), %rdx -; X64-NEXT: addl (%rcx,%r8), %eax -; X64-NEXT: addl (%rcx,%rdx), %eax -; X64-NEXT: addq %rcx, %rdx -; X64-NEXT: addq %rcx, %rdx -; X64-NEXT: movq %rdx, %rdi -; X64-NEXT: cmpq %rsi, %rdx -; X64-NEXT: jne .LBB0_1 -; X64-NEXT: # %bb.2: # %exit -; X64-NEXT: retq -; -; X32-LABEL: simple: -; X32: # %bb.0: # %entry -; X32-NEXT: pushl %ebx -; X32-NEXT: pushl %edi -; X32-NEXT: pushl %esi -; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx -; X32-NEXT: movl {{[0-9]+}}(%esp), %esi -; X32-NEXT: movl {{[0-9]+}}(%esp), %edx -; X32-NEXT: shll $2, %edx -; X32-NEXT: xorl %eax, %eax -; X32-NEXT: .p2align 4, 0x90 -; X32-NEXT: .LBB0_1: # %loop -; X32-NEXT: # =>This Inner Loop Header: Depth=1 -; X32-NEXT: addl (%esi), %eax -; X32-NEXT: leal (%esi,%edx), %edi -; X32-NEXT: addl (%esi,%edx), %eax -; X32-NEXT: leal (%edi,%edx), %ebx -; X32-NEXT: addl (%edx,%edi), %eax -; X32-NEXT: addl (%edx,%ebx), %eax -; X32-NEXT: addl %edx, %ebx -; X32-NEXT: addl %edx, %ebx -; X32-NEXT: movl %ebx, %esi -; X32-NEXT: cmpl %ecx, %ebx -; X32-NEXT: jne .LBB0_1 -; X32-NEXT: # %bb.2: # %exit -; X32-NEXT: popl %esi -; X32-NEXT: popl %edi -; X32-NEXT: popl %ebx -; X32-NEXT: retl -entry: - br label %loop -loop: - %iv = phi i32* [ %a, %entry ], [ %iv4, %loop ] - %s = phi i32 [ 0, %entry ], [ %s4, %loop ] - %v = load i32, i32* %iv - %iv1 = getelementptr inbounds i32, i32* %iv, i32 %x - %v1 = load i32, i32* %iv1 - %iv2 = getelementptr inbounds i32, i32* %iv1, i32 %x - %v2 = load i32, i32* %iv2 - %iv3 = getelementptr inbounds i32, i32* %iv2, i32 %x - %v3 = load i32, i32* %iv3 - %s1 = add i32 %s, %v - %s2 = add i32 %s1, %v1 - %s3 = add i32 %s2, %v2 - %s4 = add i32 %s3, %v3 - %iv4 = getelementptr inbounds i32, i32* %iv3, i32 %x - %cmp = icmp eq i32* %iv4, %b - br i1 %cmp, label %exit, label %loop -exit: - ret i32 %s4 -} - -; @user is not currently chained because the IV is live across memory ops. -; -; expensive address computation in the preheader -; complex address modes -define i32 @user(i32* %a, i32* %b, i32 %x) nounwind { -; X64-LABEL: user: -; X64: # %bb.0: # %entry -; X64-NEXT: movslq %edx, %rcx -; X64-NEXT: movq %rcx, %rdx -; X64-NEXT: shlq $4, %rdx -; X64-NEXT: leaq (,%rcx,4), %rax -; X64-NEXT: leaq (%rax,%rax,2), %r8 -; X64-NEXT: xorl %eax, %eax -; X64-NEXT: .p2align 4, 0x90 -; X64-NEXT: .LBB1_1: # %loop -; X64-NEXT: # =>This Inner Loop Header: Depth=1 -; X64-NEXT: addl (%rdi), %eax -; X64-NEXT: addl (%rdi,%rcx,4), %eax -; X64-NEXT: addl (%rdi,%rcx,8), %eax -; X64-NEXT: addl (%rdi,%r8), %eax -; X64-NEXT: movl %eax, (%rdi) -; X64-NEXT: addq %rdx, %rdi -; X64-NEXT: cmpq %rdi, %rsi -; X64-NEXT: jne .LBB1_1 -; X64-NEXT: # %bb.2: # %exit -; X64-NEXT: retq -; -; X32-LABEL: user: -; X32: # %bb.0: # %entry -; X32-NEXT: pushl %ebx -; X32-NEXT: pushl %edi -; X32-NEXT: pushl %esi -; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx -; X32-NEXT: movl {{[0-9]+}}(%esp), %edx -; X32-NEXT: movl {{[0-9]+}}(%esp), %esi -; X32-NEXT: movl %ecx, %edi -; X32-NEXT: shll $4, %edi -; X32-NEXT: leal (,%ecx,4), %eax -; X32-NEXT: leal (%eax,%eax,2), %ebx -; X32-NEXT: xorl %eax, %eax -; X32-NEXT: .p2align 4, 0x90 -; X32-NEXT: .LBB1_1: # %loop -; X32-NEXT: # =>This Inner Loop Header: Depth=1 -; X32-NEXT: addl (%esi), %eax -; X32-NEXT: addl (%esi,%ecx,4), %eax -; X32-NEXT: addl (%esi,%ecx,8), %eax -; X32-NEXT: addl (%esi,%ebx), %eax -; X32-NEXT: movl %eax, (%esi) -; X32-NEXT: addl %edi, %esi -; X32-NEXT: cmpl %esi, %edx -; X32-NEXT: jne .LBB1_1 -; X32-NEXT: # %bb.2: # %exit -; X32-NEXT: popl %esi -; X32-NEXT: popl %edi -; X32-NEXT: popl %ebx -; X32-NEXT: retl -entry: - br label %loop -loop: - %iv = phi i32* [ %a, %entry ], [ %iv4, %loop ] - %s = phi i32 [ 0, %entry ], [ %s4, %loop ] - %v = load i32, i32* %iv - %iv1 = getelementptr inbounds i32, i32* %iv, i32 %x - %v1 = load i32, i32* %iv1 - %iv2 = getelementptr inbounds i32, i32* %iv1, i32 %x - %v2 = load i32, i32* %iv2 - %iv3 = getelementptr inbounds i32, i32* %iv2, i32 %x - %v3 = load i32, i32* %iv3 - %s1 = add i32 %s, %v - %s2 = add i32 %s1, %v1 - %s3 = add i32 %s2, %v2 - %s4 = add i32 %s3, %v3 - %iv4 = getelementptr inbounds i32, i32* %iv3, i32 %x - store i32 %s4, i32* %iv - %cmp = icmp eq i32* %iv4, %b - br i1 %cmp, label %exit, label %loop -exit: - ret i32 %s4 -} - -; @extrastride is a slightly more interesting case of a single -; complete chain with multiple strides. The test case IR is what LSR -; used to do, and exactly what we don't want to do. LSR's new IV -; chaining feature should now undo the damage. -; -; We currently don't handle this on X64 because the sexts cause -; strange increment expressions like this: -; IV + ((sext i32 (2 * %s) to i64) + (-1 * (sext i32 %s to i64))) -; -; For x32, no spills in the preheader, no complex address modes, no reloads. - -define void @extrastride(i8* nocapture %main, i32 %main_stride, i32* nocapture %res, i32 %x, i32 %y, i32 %z) nounwind { -; X64-LABEL: extrastride: -; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rbp -; X64-NEXT: pushq %r14 -; X64-NEXT: pushq %rbx -; X64-NEXT: # kill: def $ecx killed $ecx def $rcx -; X64-NEXT: # kill: def $esi killed $esi def $rsi -; X64-NEXT: testl %r9d, %r9d -; X64-NEXT: je .LBB2_3 -; X64-NEXT: # %bb.1: # %for.body.lr.ph -; X64-NEXT: leal (%rsi,%rsi), %r14d -; X64-NEXT: leal (%rsi,%rsi,2), %ebx -; X64-NEXT: addl %esi, %ecx -; X64-NEXT: leal (,%rsi,4), %eax -; X64-NEXT: leal (%rcx,%rsi,4), %ebp -; X64-NEXT: movslq %eax, %r10 -; X64-NEXT: movslq %ebx, %r11 -; X64-NEXT: movslq %r14d, %rbx -; X64-NEXT: movslq %esi, %rsi -; X64-NEXT: movslq %r8d, %rcx -; X64-NEXT: shlq $2, %rcx -; X64-NEXT: movslq %ebp, %rax -; X64-NEXT: .p2align 4, 0x90 -; X64-NEXT: .LBB2_2: # %for.body -; X64-NEXT: # =>This Inner Loop Header: Depth=1 -; X64-NEXT: movl (%rdi,%rsi), %ebp -; X64-NEXT: addl (%rdi), %ebp -; X64-NEXT: addl (%rdi,%rbx), %ebp -; X64-NEXT: addl (%rdi,%r11), %ebp -; X64-NEXT: addl (%rdi,%r10), %ebp -; X64-NEXT: movl %ebp, (%rdx) -; X64-NEXT: addq %rax, %rdi -; X64-NEXT: addq %rcx, %rdx -; X64-NEXT: decl %r9d -; X64-NEXT: jne .LBB2_2 -; X64-NEXT: .LBB2_3: # %for.end -; X64-NEXT: popq %rbx -; X64-NEXT: popq %r14 -; X64-NEXT: popq %rbp -; X64-NEXT: retq -; -; X32-LABEL: extrastride: -; X32: # %bb.0: # %entry -; X32-NEXT: pushl %ebp -; X32-NEXT: pushl %ebx -; X32-NEXT: pushl %edi -; X32-NEXT: pushl %esi -; X32-NEXT: movl {{[0-9]+}}(%esp), %eax -; X32-NEXT: testl %eax, %eax -; X32-NEXT: je .LBB2_3 -; X32-NEXT: # %bb.1: # %for.body.lr.ph -; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx -; X32-NEXT: movl {{[0-9]+}}(%esp), %edx -; X32-NEXT: movl {{[0-9]+}}(%esp), %esi -; X32-NEXT: movl {{[0-9]+}}(%esp), %ebx -; X32-NEXT: movl {{[0-9]+}}(%esp), %edi -; X32-NEXT: addl %esi, %edi -; X32-NEXT: shll $2, %ecx -; X32-NEXT: .p2align 4, 0x90 -; X32-NEXT: .LBB2_2: # %for.body -; X32-NEXT: # =>This Inner Loop Header: Depth=1 -; X32-NEXT: movl (%ebx,%esi), %ebp -; X32-NEXT: addl (%ebx), %ebp -; X32-NEXT: leal (%ebx,%esi), %ebx -; X32-NEXT: addl (%esi,%ebx), %ebp -; X32-NEXT: leal (%ebx,%esi), %ebx -; X32-NEXT: addl (%esi,%ebx), %ebp -; X32-NEXT: leal (%ebx,%esi), %ebx -; X32-NEXT: addl (%esi,%ebx), %ebp -; X32-NEXT: movl %ebp, (%edx) -; X32-NEXT: leal (%ebx,%esi), %ebx -; X32-NEXT: addl %edi, %ebx -; X32-NEXT: addl %ecx, %edx -; X32-NEXT: decl %eax -; X32-NEXT: jne .LBB2_2 -; X32-NEXT: .LBB2_3: # %for.end -; X32-NEXT: popl %esi -; X32-NEXT: popl %edi -; X32-NEXT: popl %ebx -; X32-NEXT: popl %ebp -; X32-NEXT: retl -entry: - %cmp8 = icmp eq i32 %z, 0 - br i1 %cmp8, label %for.end, label %for.body.lr.ph - -for.body.lr.ph: ; preds = %entry - %add.ptr.sum = shl i32 %main_stride, 1 ; s*2 - %add.ptr1.sum = add i32 %add.ptr.sum, %main_stride ; s*3 - %add.ptr2.sum = add i32 %x, %main_stride ; s + x - %add.ptr4.sum = shl i32 %main_stride, 2 ; s*4 - %add.ptr3.sum = add i32 %add.ptr2.sum, %add.ptr4.sum ; total IV stride = s*5+x - br label %for.body - -for.body: ; preds = %for.body.lr.ph, %for.body - %main.addr.011 = phi i8* [ %main, %for.body.lr.ph ], [ %add.ptr6, %for.body ] - %i.010 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ] - %res.addr.09 = phi i32* [ %res, %for.body.lr.ph ], [ %add.ptr7, %for.body ] - %0 = bitcast i8* %main.addr.011 to i32* - %1 = load i32, i32* %0, align 4 - %add.ptr = getelementptr inbounds i8, i8* %main.addr.011, i32 %main_stride - %2 = bitcast i8* %add.ptr to i32* - %3 = load i32, i32* %2, align 4 - %add.ptr1 = getelementptr inbounds i8, i8* %main.addr.011, i32 %add.ptr.sum - %4 = bitcast i8* %add.ptr1 to i32* - %5 = load i32, i32* %4, align 4 - %add.ptr2 = getelementptr inbounds i8, i8* %main.addr.011, i32 %add.ptr1.sum - %6 = bitcast i8* %add.ptr2 to i32* - %7 = load i32, i32* %6, align 4 - %add.ptr3 = getelementptr inbounds i8, i8* %main.addr.011, i32 %add.ptr4.sum - %8 = bitcast i8* %add.ptr3 to i32* - %9 = load i32, i32* %8, align 4 - %add = add i32 %3, %1 - %add4 = add i32 %add, %5 - %add5 = add i32 %add4, %7 - %add6 = add i32 %add5, %9 - store i32 %add6, i32* %res.addr.09, align 4 - %add.ptr6 = getelementptr inbounds i8, i8* %main.addr.011, i32 %add.ptr3.sum - %add.ptr7 = getelementptr inbounds i32, i32* %res.addr.09, i32 %y - %inc = add i32 %i.010, 1 - %cmp = icmp eq i32 %inc, %z - br i1 %cmp, label %for.end, label %for.body - -for.end: ; preds = %for.body, %entry - ret void -} - -; @foldedidx is an unrolled variant of this loop: -; for (unsigned long i = 0; i < len; i += s) { -; c[i] = a[i] + b[i]; -; } -; where 's' can be folded into the addressing mode. -; Consequently, we should *not* form any chains. - -define void @foldedidx(i8* nocapture %a, i8* nocapture %b, i8* nocapture %c) nounwind ssp { -; X64-LABEL: foldedidx: -; X64: # %bb.0: # %entry -; X64-NEXT: movl $3, %eax -; X64-NEXT: .p2align 4, 0x90 -; X64-NEXT: .LBB3_1: # %for.body -; X64-NEXT: # =>This Inner Loop Header: Depth=1 -; X64-NEXT: movzbl -3(%rdi,%rax), %r8d -; X64-NEXT: movzbl -3(%rsi,%rax), %ecx -; X64-NEXT: addl %r8d, %ecx -; X64-NEXT: movb %cl, -3(%rdx,%rax) -; X64-NEXT: movzbl -2(%rdi,%rax), %r8d -; X64-NEXT: movzbl -2(%rsi,%rax), %ecx -; X64-NEXT: addl %r8d, %ecx -; X64-NEXT: movb %cl, -2(%rdx,%rax) -; X64-NEXT: movzbl -1(%rdi,%rax), %r8d -; X64-NEXT: movzbl -1(%rsi,%rax), %ecx -; X64-NEXT: addl %r8d, %ecx -; X64-NEXT: movb %cl, -1(%rdx,%rax) -; X64-NEXT: movzbl (%rdi,%rax), %r8d -; X64-NEXT: movzbl (%rsi,%rax), %ecx -; X64-NEXT: addl %r8d, %ecx -; X64-NEXT: movb %cl, (%rdx,%rax) -; X64-NEXT: addq $4, %rax -; X64-NEXT: cmpl $403, %eax # imm = 0x193 -; X64-NEXT: jne .LBB3_1 -; X64-NEXT: # %bb.2: # %for.end -; X64-NEXT: retq -; -; X32-LABEL: foldedidx: -; X32: # %bb.0: # %entry -; X32-NEXT: pushl %ebx -; X32-NEXT: pushl %edi -; X32-NEXT: pushl %esi -; X32-NEXT: movl $3, %eax -; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx -; X32-NEXT: movl {{[0-9]+}}(%esp), %edx -; X32-NEXT: movl {{[0-9]+}}(%esp), %esi -; X32-NEXT: .p2align 4, 0x90 -; X32-NEXT: .LBB3_1: # %for.body -; X32-NEXT: # =>This Inner Loop Header: Depth=1 -; X32-NEXT: movzbl -3(%esi,%eax), %edi -; X32-NEXT: movzbl -3(%edx,%eax), %ebx -; X32-NEXT: addl %edi, %ebx -; X32-NEXT: movb %bl, -3(%ecx,%eax) -; X32-NEXT: movzbl -2(%esi,%eax), %edi -; X32-NEXT: movzbl -2(%edx,%eax), %ebx -; X32-NEXT: addl %edi, %ebx -; X32-NEXT: movb %bl, -2(%ecx,%eax) -; X32-NEXT: movzbl -1(%esi,%eax), %edi -; X32-NEXT: movzbl -1(%edx,%eax), %ebx -; X32-NEXT: addl %edi, %ebx -; X32-NEXT: movb %bl, -1(%ecx,%eax) -; X32-NEXT: movzbl (%esi,%eax), %edi -; X32-NEXT: movzbl (%edx,%eax), %ebx -; X32-NEXT: addl %edi, %ebx -; X32-NEXT: movb %bl, (%ecx,%eax) -; X32-NEXT: addl $4, %eax -; X32-NEXT: cmpl $403, %eax # imm = 0x193 -; X32-NEXT: jne .LBB3_1 -; X32-NEXT: # %bb.2: # %for.end -; X32-NEXT: popl %esi -; X32-NEXT: popl %edi -; X32-NEXT: popl %ebx -; X32-NEXT: retl -entry: - br label %for.body - -for.body: ; preds = %for.body, %entry - %i.07 = phi i32 [ 0, %entry ], [ %inc.3, %for.body ] - %arrayidx = getelementptr inbounds i8, i8* %a, i32 %i.07 - %0 = load i8, i8* %arrayidx, align 1 - %conv5 = zext i8 %0 to i32 - %arrayidx1 = getelementptr inbounds i8, i8* %b, i32 %i.07 - %1 = load i8, i8* %arrayidx1, align 1 - %conv26 = zext i8 %1 to i32 - %add = add nsw i32 %conv26, %conv5 - %conv3 = trunc i32 %add to i8 - %arrayidx4 = getelementptr inbounds i8, i8* %c, i32 %i.07 - store i8 %conv3, i8* %arrayidx4, align 1 - %inc1 = or i32 %i.07, 1 - %arrayidx.1 = getelementptr inbounds i8, i8* %a, i32 %inc1 - %2 = load i8, i8* %arrayidx.1, align 1 - %conv5.1 = zext i8 %2 to i32 - %arrayidx1.1 = getelementptr inbounds i8, i8* %b, i32 %inc1 - %3 = load i8, i8* %arrayidx1.1, align 1 - %conv26.1 = zext i8 %3 to i32 - %add.1 = add nsw i32 %conv26.1, %conv5.1 - %conv3.1 = trunc i32 %add.1 to i8 - %arrayidx4.1 = getelementptr inbounds i8, i8* %c, i32 %inc1 - store i8 %conv3.1, i8* %arrayidx4.1, align 1 - %inc.12 = or i32 %i.07, 2 - %arrayidx.2 = getelementptr inbounds i8, i8* %a, i32 %inc.12 - %4 = load i8, i8* %arrayidx.2, align 1 - %conv5.2 = zext i8 %4 to i32 - %arrayidx1.2 = getelementptr inbounds i8, i8* %b, i32 %inc.12 - %5 = load i8, i8* %arrayidx1.2, align 1 - %conv26.2 = zext i8 %5 to i32 - %add.2 = add nsw i32 %conv26.2, %conv5.2 - %conv3.2 = trunc i32 %add.2 to i8 - %arrayidx4.2 = getelementptr inbounds i8, i8* %c, i32 %inc.12 - store i8 %conv3.2, i8* %arrayidx4.2, align 1 - %inc.23 = or i32 %i.07, 3 - %arrayidx.3 = getelementptr inbounds i8, i8* %a, i32 %inc.23 - %6 = load i8, i8* %arrayidx.3, align 1 - %conv5.3 = zext i8 %6 to i32 - %arrayidx1.3 = getelementptr inbounds i8, i8* %b, i32 %inc.23 - %7 = load i8, i8* %arrayidx1.3, align 1 - %conv26.3 = zext i8 %7 to i32 - %add.3 = add nsw i32 %conv26.3, %conv5.3 - %conv3.3 = trunc i32 %add.3 to i8 - %arrayidx4.3 = getelementptr inbounds i8, i8* %c, i32 %inc.23 - store i8 %conv3.3, i8* %arrayidx4.3, align 1 - %inc.3 = add nsw i32 %i.07, 4 - %exitcond.3 = icmp eq i32 %inc.3, 400 - br i1 %exitcond.3, label %for.end, label %for.body - -for.end: ; preds = %for.body - ret void -} - -; @multioper tests instructions with multiple IV user operands. We -; should be able to chain them independent of each other. - -define void @multioper(i32* %a, i32 %n) nounwind { -; X64-LABEL: multioper: -; X64: # %bb.0: # %entry -; X64-NEXT: xorl %eax, %eax -; X64-NEXT: .p2align 4, 0x90 -; X64-NEXT: .LBB4_1: # %for.body -; X64-NEXT: # =>This Inner Loop Header: Depth=1 -; X64-NEXT: movl %eax, (%rdi,%rax,4) -; X64-NEXT: leal 1(%rax), %ecx -; X64-NEXT: movl %ecx, 4(%rdi,%rax,4) -; X64-NEXT: leal 2(%rax), %ecx -; X64-NEXT: movl %ecx, 8(%rdi,%rax,4) -; X64-NEXT: leal 3(%rax), %ecx -; X64-NEXT: movl %ecx, 12(%rdi,%rax,4) -; X64-NEXT: addq $4, %rax -; X64-NEXT: cmpl %esi, %eax -; X64-NEXT: jl .LBB4_1 -; X64-NEXT: # %bb.2: # %exit -; X64-NEXT: retq -; -; X32-LABEL: multioper: -; X32: # %bb.0: # %entry -; X32-NEXT: pushl %esi -; X32-NEXT: xorl %eax, %eax -; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx -; X32-NEXT: movl {{[0-9]+}}(%esp), %edx -; X32-NEXT: .p2align 4, 0x90 -; X32-NEXT: .LBB4_1: # %for.body -; X32-NEXT: # =>This Inner Loop Header: Depth=1 -; X32-NEXT: movl %eax, (%edx,%eax,4) -; X32-NEXT: leal 1(%eax), %esi -; X32-NEXT: movl %esi, 4(%edx,%eax,4) -; X32-NEXT: leal 2(%eax), %esi -; X32-NEXT: movl %esi, 8(%edx,%eax,4) -; X32-NEXT: leal 3(%eax), %esi -; X32-NEXT: movl %esi, 12(%edx,%eax,4) -; X32-NEXT: addl $4, %eax -; X32-NEXT: cmpl %ecx, %eax -; X32-NEXT: jl .LBB4_1 -; X32-NEXT: # %bb.2: # %exit -; X32-NEXT: popl %esi -; X32-NEXT: retl -entry: - br label %for.body - -for.body: - %p = phi i32* [ %p.next, %for.body ], [ %a, %entry ] - %i = phi i32 [ %inc4, %for.body ], [ 0, %entry ] - store i32 %i, i32* %p, align 4 - %inc1 = or i32 %i, 1 - %add.ptr.i1 = getelementptr inbounds i32, i32* %p, i32 1 - store i32 %inc1, i32* %add.ptr.i1, align 4 - %inc2 = add nsw i32 %i, 2 - %add.ptr.i2 = getelementptr inbounds i32, i32* %p, i32 2 - store i32 %inc2, i32* %add.ptr.i2, align 4 - %inc3 = add nsw i32 %i, 3 - %add.ptr.i3 = getelementptr inbounds i32, i32* %p, i32 3 - store i32 %inc3, i32* %add.ptr.i3, align 4 - %p.next = getelementptr inbounds i32, i32* %p, i32 4 - %inc4 = add nsw i32 %i, 4 - %cmp = icmp slt i32 %inc4, %n - br i1 %cmp, label %for.body, label %exit - -exit: - ret void -} - -; @testCmpZero has a ICmpZero LSR use that should not be hidden from -; LSR. Profitable chains should have more than one nonzero increment -; anyway. - -define void @testCmpZero(i8* %src, i8* %dst, i32 %srcidx, i32 %dstidx, i32 %len) nounwind ssp { -; X64-LABEL: testCmpZero: -; X64: # %bb.0: # %entry -; X64-NEXT: movslq %edx, %rdx -; X64-NEXT: addq %rdx, %rdi -; X64-NEXT: movslq %ecx, %r9 -; X64-NEXT: addq %rsi, %r9 -; X64-NEXT: addl %edx, %r8d -; X64-NEXT: movslq %r8d, %rcx -; X64-NEXT: subq %rdx, %rcx -; X64-NEXT: xorl %edx, %edx -; X64-NEXT: .p2align 4, 0x90 -; X64-NEXT: .LBB5_1: # %for.body82.us -; X64-NEXT: # =>This Inner Loop Header: Depth=1 -; X64-NEXT: movzbl (%r9,%rdx,4), %eax -; X64-NEXT: movb %al, (%rdi,%rdx) -; X64-NEXT: incq %rdx -; X64-NEXT: cmpq %rdx, %rcx -; X64-NEXT: jne .LBB5_1 -; X64-NEXT: # %bb.2: # %return -; X64-NEXT: retq -; -; X32-LABEL: testCmpZero: -; X32: # %bb.0: # %entry -; X32-NEXT: pushl %ebx -; X32-NEXT: pushl %esi -; X32-NEXT: movl {{[0-9]+}}(%esp), %eax -; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx -; X32-NEXT: addl {{[0-9]+}}(%esp), %ecx -; X32-NEXT: movl {{[0-9]+}}(%esp), %edx -; X32-NEXT: addl {{[0-9]+}}(%esp), %edx -; X32-NEXT: xorl %esi, %esi -; X32-NEXT: .p2align 4, 0x90 -; X32-NEXT: .LBB5_1: # %for.body82.us -; X32-NEXT: # =>This Inner Loop Header: Depth=1 -; X32-NEXT: movzbl (%edx,%esi,4), %ebx -; X32-NEXT: movb %bl, (%ecx,%esi) -; X32-NEXT: incl %esi -; X32-NEXT: cmpl %esi, %eax -; X32-NEXT: jne .LBB5_1 -; X32-NEXT: # %bb.2: # %return -; X32-NEXT: popl %esi -; X32-NEXT: popl %ebx -; X32-NEXT: retl -entry: - %dest0 = getelementptr inbounds i8, i8* %src, i32 %srcidx - %source0 = getelementptr inbounds i8, i8* %dst, i32 %dstidx - %add.ptr79.us.sum = add i32 %srcidx, %len - %lftr.limit = getelementptr i8, i8* %src, i32 %add.ptr79.us.sum - br label %for.body82.us - -for.body82.us: - %dest = phi i8* [ %dest0, %entry ], [ %incdec.ptr91.us, %for.body82.us ] - %source = phi i8* [ %source0, %entry ], [ %add.ptr83.us, %for.body82.us ] - %0 = bitcast i8* %source to i32* - %1 = load i32, i32* %0, align 4 - %trunc = trunc i32 %1 to i8 - %add.ptr83.us = getelementptr inbounds i8, i8* %source, i32 4 - %incdec.ptr91.us = getelementptr inbounds i8, i8* %dest, i32 1 - store i8 %trunc, i8* %dest, align 1 - %exitcond = icmp eq i8* %incdec.ptr91.us, %lftr.limit - br i1 %exitcond, label %return, label %for.body82.us - -return: - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/ivchain-stress-X86.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/ivchain-stress-X86.ll deleted file mode 100644 index 7925bf01020..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/ivchain-stress-X86.ll +++ /dev/null @@ -1,96 +0,0 @@ -; REQUIRES: asserts -; RUN: llc < %s -O3 -march=x86-64 -mcpu=core2 -stress-ivchain | FileCheck %s -check-prefix=X64 -; RUN: llc < %s -O3 -march=x86 -mcpu=core2 -stress-ivchain | FileCheck %s -check-prefix=X32 - -; @sharedidx is an unrolled variant of this loop: -; for (unsigned long i = 0; i < len; i += s) { -; c[i] = a[i] + b[i]; -; } -; where 's' cannot be folded into the addressing mode. -; -; This is not quite profitable to chain. But with -stress-ivchain, we -; can form three address chains in place of the shared induction -; variable. - -; X64: sharedidx: -; X64: %for.body.preheader -; X64-NOT: leal ({{.*}},4) -; X64: %for.body.1 - -; X32: sharedidx: -; X32: %for.body.2 -; X32: add -; X32: add -; X32: add -; X32: add -; X32: add -; X32: %for.body.3 -define void @sharedidx(i8* nocapture %a, i8* nocapture %b, i8* nocapture %c, i32 %s, i32 %len) nounwind ssp { -entry: - %cmp8 = icmp eq i32 %len, 0 - br i1 %cmp8, label %for.end, label %for.body - -for.body: ; preds = %entry, %for.body.3 - %i.09 = phi i32 [ %add5.3, %for.body.3 ], [ 0, %entry ] - %arrayidx = getelementptr inbounds i8, i8* %a, i32 %i.09 - %0 = load i8, i8* %arrayidx, align 1 - %conv6 = zext i8 %0 to i32 - %arrayidx1 = getelementptr inbounds i8, i8* %b, i32 %i.09 - %1 = load i8, i8* %arrayidx1, align 1 - %conv27 = zext i8 %1 to i32 - %add = add nsw i32 %conv27, %conv6 - %conv3 = trunc i32 %add to i8 - %arrayidx4 = getelementptr inbounds i8, i8* %c, i32 %i.09 - store i8 %conv3, i8* %arrayidx4, align 1 - %add5 = add i32 %i.09, %s - %cmp = icmp ult i32 %add5, %len - br i1 %cmp, label %for.body.1, label %for.end - -for.end: ; preds = %for.body, %for.body.1, %for.body.2, %for.body.3, %entry - ret void - -for.body.1: ; preds = %for.body - %arrayidx.1 = getelementptr inbounds i8, i8* %a, i32 %add5 - %2 = load i8, i8* %arrayidx.1, align 1 - %conv6.1 = zext i8 %2 to i32 - %arrayidx1.1 = getelementptr inbounds i8, i8* %b, i32 %add5 - %3 = load i8, i8* %arrayidx1.1, align 1 - %conv27.1 = zext i8 %3 to i32 - %add.1 = add nsw i32 %conv27.1, %conv6.1 - %conv3.1 = trunc i32 %add.1 to i8 - %arrayidx4.1 = getelementptr inbounds i8, i8* %c, i32 %add5 - store i8 %conv3.1, i8* %arrayidx4.1, align 1 - %add5.1 = add i32 %add5, %s - %cmp.1 = icmp ult i32 %add5.1, %len - br i1 %cmp.1, label %for.body.2, label %for.end - -for.body.2: ; preds = %for.body.1 - %arrayidx.2 = getelementptr inbounds i8, i8* %a, i32 %add5.1 - %4 = load i8, i8* %arrayidx.2, align 1 - %conv6.2 = zext i8 %4 to i32 - %arrayidx1.2 = getelementptr inbounds i8, i8* %b, i32 %add5.1 - %5 = load i8, i8* %arrayidx1.2, align 1 - %conv27.2 = zext i8 %5 to i32 - %add.2 = add nsw i32 %conv27.2, %conv6.2 - %conv3.2 = trunc i32 %add.2 to i8 - %arrayidx4.2 = getelementptr inbounds i8, i8* %c, i32 %add5.1 - store i8 %conv3.2, i8* %arrayidx4.2, align 1 - %add5.2 = add i32 %add5.1, %s - %cmp.2 = icmp ult i32 %add5.2, %len - br i1 %cmp.2, label %for.body.3, label %for.end - -for.body.3: ; preds = %for.body.2 - %arrayidx.3 = getelementptr inbounds i8, i8* %a, i32 %add5.2 - %6 = load i8, i8* %arrayidx.3, align 1 - %conv6.3 = zext i8 %6 to i32 - %arrayidx1.3 = getelementptr inbounds i8, i8* %b, i32 %add5.2 - %7 = load i8, i8* %arrayidx1.3, align 1 - %conv27.3 = zext i8 %7 to i32 - %add.3 = add nsw i32 %conv27.3, %conv6.3 - %conv3.3 = trunc i32 %add.3 to i8 - %arrayidx4.3 = getelementptr inbounds i8, i8* %c, i32 %add5.2 - store i8 %conv3.3, i8* %arrayidx4.3, align 1 - %add5.3 = add i32 %add5.2, %s - %cmp.3 = icmp ult i32 %add5.3, %len - br i1 %cmp.3, label %for.body, label %for.end -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/lit.local.cfg b/llvm/test/Transforms/LoopStrengthReduce/X86/lit.local.cfg deleted file mode 100644 index e71f3cc4c41..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/lit.local.cfg +++ /dev/null @@ -1,3 +0,0 @@ -if not 'X86' in config.root.targets: - config.unsupported = True - diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/lsr-expand-quadratic.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/lsr-expand-quadratic.ll deleted file mode 100644 index deca954fea7..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/lsr-expand-quadratic.ll +++ /dev/null @@ -1,58 +0,0 @@ -; REQUIRES: x86-registered-target -; RUN: opt -loop-reduce -S < %s | FileCheck %s - -; Strength reduction analysis here relies on IV Users analysis, that -; only finds users among instructions with types that are treated as -; legal by the data layout. When running this test on pure non-x86 -; configs (for example, ARM 64), it gets confused with the target -; triple and uses a default data layout instead. This default layout -; does not have any legal types (even i32), so the transformation -; does not happen. - -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-S128" -target triple = "x86_64-apple-macosx" - -; PR15470: LSR miscompile. The test2 function should return '1'. -; -; SCEV expander cannot expand quadratic recurrences outside of the -; loop. This recurrence depends on %sub.us, so can't be expanded. -; We cannot fold SCEVUnknown (sub.us) with recurrences since it is -; declared after the loop. -; -; CHECK-LABEL: @test2 -; CHECK-LABEL: test2.loop: -; CHECK: %lsr.iv1 = phi i32 [ %lsr.iv.next2, %test2.loop ], [ -16777216, %entry ] -; CHECK: %lsr.iv = phi i32 [ %lsr.iv.next, %test2.loop ], [ 1, %entry ] -; CHECK: %lsr.iv.next = add nsw i32 %lsr.iv, -1 -; CHECK: %lsr.iv.next2 = add nsw i32 %lsr.iv1, 16777216 -; -; CHECK-LABEL: for.end: -; CHECK: %tobool.us = icmp eq i32 %lsr.iv.next, 0 -; CHECK: %sub.us = select i1 %tobool.us, i32 0, i32 0 -; CHECK: %0 = sub i32 0, %sub.us -; CHECK: %1 = sub i32 %0, %lsr.iv.next -; CHECK: %sext.us = mul i32 %lsr.iv.next2, %1 -; CHECK: %f = ashr i32 %sext.us, 24 -; CHECK: ret i32 %f -define i32 @test2() { -entry: - br label %test2.loop - -test2.loop: - %inc1115.us = phi i32 [ 0, %entry ], [ %inc11.us, %test2.loop ] - %inc11.us = add nsw i32 %inc1115.us, 1 - %cmp.us = icmp slt i32 %inc11.us, 2 - br i1 %cmp.us, label %test2.loop, label %for.end - -for.end: - %tobool.us = icmp eq i32 %inc1115.us, 0 - %sub.us = select i1 %tobool.us, i32 0, i32 0 - %mul.us = shl i32 %inc1115.us, 24 - %sub.cond.us = sub nsw i32 %inc1115.us, %sub.us - %sext.us = mul i32 %mul.us, %sub.cond.us - %f = ashr i32 %sext.us, 24 - br label %exit - -exit: - ret i32 %f -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/lsr-filtering-scaledreg.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/lsr-filtering-scaledreg.ll deleted file mode 100644 index 4ce6f1a79fb..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/lsr-filtering-scaledreg.ll +++ /dev/null @@ -1,60 +0,0 @@ -; RUN: opt < %s -loop-reduce -lsr-filter-same-scaled-reg=true -mtriple=x86_64-unknown-linux-gnu -S | FileCheck %s - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" - -%struct.ham = type { i8, i8, [5 x i32], i64, i64, i64 } - -@global = external local_unnamed_addr global %struct.ham, align 8 - -define void @foo() local_unnamed_addr { -bb: - %tmp = load i64, i64* getelementptr inbounds (%struct.ham, %struct.ham* @global, i64 0, i32 3), align 8 - %tmp1 = and i64 %tmp, 1792 - %tmp2 = load i64, i64* getelementptr inbounds (%struct.ham, %struct.ham* @global, i64 0, i32 4), align 8 - %tmp3 = add i64 %tmp1, %tmp2 - %tmp4 = load i8*, i8** null, align 8 - %tmp5 = getelementptr inbounds i8, i8* %tmp4, i64 0 - %tmp6 = sub i64 0, %tmp3 - %tmp7 = getelementptr inbounds i8, i8* %tmp4, i64 %tmp6 - %tmp8 = inttoptr i64 0 to i8* - br label %bb9 - -; Without filtering non-optimal formulae with the same ScaledReg and Scale, the strategy -; to narrow LSR search space by picking winner reg will generate only one lsr.iv and -; unoptimal result. -; CHECK-LABEL: @foo( -; CHECK: bb9: -; CHECK-NEXT: = phi i8* -; CHECK-NEXT: = phi i8* - -bb9: ; preds = %bb12, %bb - %tmp10 = phi i8* [ %tmp7, %bb ], [ %tmp16, %bb12 ] - %tmp11 = phi i8* [ %tmp8, %bb ], [ %tmp17, %bb12 ] - br i1 false, label %bb18, label %bb12 - -bb12: ; preds = %bb9 - %tmp13 = getelementptr inbounds i8, i8* %tmp10, i64 8 - %tmp14 = bitcast i8* %tmp13 to i64* - %tmp15 = load i64, i64* %tmp14, align 1 - %tmp16 = getelementptr inbounds i8, i8* %tmp10, i64 16 - %tmp17 = getelementptr inbounds i8, i8* %tmp11, i64 16 - br label %bb9 - -bb18: ; preds = %bb9 - %tmp19 = icmp ugt i8* %tmp11, null - %tmp20 = getelementptr inbounds i8, i8* %tmp10, i64 8 - %tmp21 = getelementptr inbounds i8, i8* %tmp11, i64 8 - %tmp22 = select i1 %tmp19, i8* %tmp10, i8* %tmp20 - %tmp23 = select i1 %tmp19, i8* %tmp11, i8* %tmp21 - br label %bb24 - -bb24: ; preds = %bb24, %bb18 - %tmp25 = phi i8* [ %tmp27, %bb24 ], [ %tmp22, %bb18 ] - %tmp26 = phi i8* [ %tmp29, %bb24 ], [ %tmp23, %bb18 ] - %tmp27 = getelementptr inbounds i8, i8* %tmp25, i64 1 - %tmp28 = load i8, i8* %tmp25, align 1 - %tmp29 = getelementptr inbounds i8, i8* %tmp26, i64 1 - store i8 %tmp28, i8* %tmp26, align 1 - %tmp30 = icmp eq i8* %tmp29, %tmp5 - br label %bb24 -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/lsr-insns-1.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/lsr-insns-1.ll deleted file mode 100644 index b96dc62a29f..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/lsr-insns-1.ll +++ /dev/null @@ -1,101 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -loop-reduce -mtriple=x86_64 -S | FileCheck %s -check-prefix=BOTH -check-prefix=INSN -; RUN: opt < %s -loop-reduce -mtriple=x86_64 -lsr-insns-cost=false -S | FileCheck %s -check-prefix=BOTH -check-prefix=REGS -; RUN: llc < %s -O2 -mtriple=x86_64-unknown-unknown -lsr-insns-cost | FileCheck %s - -; OPT test checks that LSR optimize compare for static counter to compare with 0. - -; LLC test checks that LSR optimize compare for static counter. -; That means that instead of creating the following: -; movl %ecx, (%rdx,%rax,4) -; incq %rax -; cmpq $1024, %rax -; LSR should optimize out cmp: -; movl %ecx, 4096(%rdx,%rax) -; addq $4, %rax -; or -; movl %ecx, 4096(%rdx,%rax,4) -; incq %rax - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" - -define void @foo(i32* nocapture readonly %x, i32* nocapture readonly %y, i32* nocapture %q) { -; INSN-LABEL: @foo( -; INSN-NEXT: entry: -; INSN-NEXT: [[Q1:%.*]] = bitcast i32* [[Q:%.*]] to i8* -; INSN-NEXT: [[Y3:%.*]] = bitcast i32* [[Y:%.*]] to i8* -; INSN-NEXT: [[X7:%.*]] = bitcast i32* [[X:%.*]] to i8* -; INSN-NEXT: br label [[FOR_BODY:%.*]] -; INSN: for.cond.cleanup: -; INSN-NEXT: ret void -; INSN: for.body: -; INSN-NEXT: [[LSR_IV:%.*]] = phi i64 [ [[LSR_IV_NEXT:%.*]], [[FOR_BODY]] ], [ -4096, [[ENTRY:%.*]] ] -; INSN-NEXT: [[UGLYGEP8:%.*]] = getelementptr i8, i8* [[X7]], i64 [[LSR_IV]] -; INSN-NEXT: [[UGLYGEP89:%.*]] = bitcast i8* [[UGLYGEP8]] to i32* -; INSN-NEXT: [[SCEVGEP10:%.*]] = getelementptr i32, i32* [[UGLYGEP89]], i64 1024 -; INSN-NEXT: [[TMP:%.*]] = load i32, i32* [[SCEVGEP10]], align 4 -; INSN-NEXT: [[UGLYGEP4:%.*]] = getelementptr i8, i8* [[Y3]], i64 [[LSR_IV]] -; INSN-NEXT: [[UGLYGEP45:%.*]] = bitcast i8* [[UGLYGEP4]] to i32* -; INSN-NEXT: [[SCEVGEP6:%.*]] = getelementptr i32, i32* [[UGLYGEP45]], i64 1024 -; INSN-NEXT: [[TMP1:%.*]] = load i32, i32* [[SCEVGEP6]], align 4 -; INSN-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP1]], [[TMP]] -; INSN-NEXT: [[UGLYGEP:%.*]] = getelementptr i8, i8* [[Q1]], i64 [[LSR_IV]] -; INSN-NEXT: [[UGLYGEP2:%.*]] = bitcast i8* [[UGLYGEP]] to i32* -; INSN-NEXT: [[SCEVGEP:%.*]] = getelementptr i32, i32* [[UGLYGEP2]], i64 1024 -; INSN-NEXT: store i32 [[ADD]], i32* [[SCEVGEP]], align 4 -; INSN-NEXT: [[LSR_IV_NEXT]] = add nsw i64 [[LSR_IV]], 4 -; INSN-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[LSR_IV_NEXT]], 0 -; INSN-NEXT: br i1 [[EXITCOND]], label [[FOR_COND_CLEANUP:%.*]], label [[FOR_BODY]] -; -; REGS-LABEL: @foo( -; REGS-NEXT: entry: -; REGS-NEXT: br label [[FOR_BODY:%.*]] -; REGS: for.cond.cleanup: -; REGS-NEXT: ret void -; REGS: for.body: -; REGS-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] -; REGS-NEXT: [[SCEVGEP2:%.*]] = getelementptr i32, i32* [[X:%.*]], i64 [[INDVARS_IV]] -; REGS-NEXT: [[TMP:%.*]] = load i32, i32* [[SCEVGEP2]], align 4 -; REGS-NEXT: [[SCEVGEP1:%.*]] = getelementptr i32, i32* [[Y:%.*]], i64 [[INDVARS_IV]] -; REGS-NEXT: [[TMP1:%.*]] = load i32, i32* [[SCEVGEP1]], align 4 -; REGS-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP1]], [[TMP]] -; REGS-NEXT: [[SCEVGEP:%.*]] = getelementptr i32, i32* [[Q:%.*]], i64 [[INDVARS_IV]] -; REGS-NEXT: store i32 [[ADD]], i32* [[SCEVGEP]], align 4 -; REGS-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 -; REGS-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], 1024 -; REGS-NEXT: br i1 [[EXITCOND]], label [[FOR_COND_CLEANUP:%.*]], label [[FOR_BODY]] -; -; CHECK-LABEL: foo: -; CHECK: # %bb.0: # %entry -; CHECK-NEXT: movq $-4096, %rax # imm = 0xF000 -; CHECK-NEXT: .p2align 4, 0x90 -; CHECK-NEXT: .LBB0_1: # %for.body -; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: movl 4096(%rsi,%rax), %ecx -; CHECK-NEXT: addl 4096(%rdi,%rax), %ecx -; CHECK-NEXT: movl %ecx, 4096(%rdx,%rax) -; CHECK-NEXT: addq $4, %rax -; CHECK-NEXT: jne .LBB0_1 -; CHECK-NEXT: # %bb.2: # %for.cond.cleanup -; CHECK-NEXT: retq -entry: - br label %for.body - -for.cond.cleanup: ; preds = %for.body - ret void - -for.body: ; preds = %for.body, %entry - %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] - %arrayidx = getelementptr inbounds i32, i32* %x, i64 %indvars.iv - %tmp = load i32, i32* %arrayidx, align 4 - %arrayidx2 = getelementptr inbounds i32, i32* %y, i64 %indvars.iv - %tmp1 = load i32, i32* %arrayidx2, align 4 - %add = add nsw i32 %tmp1, %tmp - %arrayidx4 = getelementptr inbounds i32, i32* %q, i64 %indvars.iv - store i32 %add, i32* %arrayidx4, align 4 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 - %exitcond = icmp eq i64 %indvars.iv.next, 1024 - br i1 %exitcond, label %for.cond.cleanup, label %for.body -} - diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/lsr-insns-2.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/lsr-insns-2.ll deleted file mode 100644 index 239cc023350..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/lsr-insns-2.ll +++ /dev/null @@ -1,58 +0,0 @@ -; RUN: opt < %s -loop-reduce -mtriple=x86_64 -S | FileCheck %s -check-prefix=BOTH -check-prefix=INSN -; RUN: opt < %s -loop-reduce -mtriple=x86_64 -lsr-insns-cost=false -S | FileCheck %s -check-prefix=BOTH -check-prefix=REGS -; RUN: llc < %s -O2 -march=x86-64 -lsr-insns-cost -asm-verbose=0 | FileCheck %s - -; OPT checks that LSR prefers less instructions to less registers. -; For x86 LSR should prefer complicated address to new lsr induction -; variables. - -; BOTH: for.body: -; INSN: getelementptr i32, i32* %x, i64 %indvars.iv -; INSN: getelementptr i32, i32* %y, i64 %indvars.iv -; INSN: getelementptr i32, i32* %q, i64 %indvars.iv -; REGS %lsr.iv4 = phi -; REGS %lsr.iv2 = phi -; REGS %lsr.iv1 = phi -; REGS: getelementptr i32, i32* %lsr.iv1, i64 1 -; REGS: getelementptr i32, i32* %lsr.iv2, i64 1 -; REGS: getelementptr i32, i32* %lsr.iv4, i64 1 - -; LLC checks that LSR prefers less instructions to less registers. -; LSR should prefer complicated address to additonal add instructions. - -; CHECK: LBB0_2: -; CHECK-NEXT: movl (%r{{.+}}, -; CHECK-NEXT: addl (%r{{.+}}, -; CHECK-NEXT: movl %e{{.+}}, (%r{{.+}}, - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" - -; Function Attrs: norecurse nounwind uwtable -define void @foo(i32* nocapture readonly %x, i32* nocapture readonly %y, i32* nocapture %q, i32 %n) { -entry: - %cmp10 = icmp sgt i32 %n, 0 - br i1 %cmp10, label %for.body.preheader, label %for.cond.cleanup - -for.body.preheader: ; preds = %entry - %wide.trip.count = zext i32 %n to i64 - br label %for.body - -for.cond.cleanup.loopexit: ; preds = %for.body - br label %for.cond.cleanup - -for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry - ret void - -for.body: ; preds = %for.body, %for.body.preheader - %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ] - %arrayidx = getelementptr inbounds i32, i32* %x, i64 %indvars.iv - %tmp = load i32, i32* %arrayidx, align 4 - %arrayidx2 = getelementptr inbounds i32, i32* %y, i64 %indvars.iv - %tmp1 = load i32, i32* %arrayidx2, align 4 - %add = add nsw i32 %tmp1, %tmp - %arrayidx4 = getelementptr inbounds i32, i32* %q, i64 %indvars.iv - store i32 %add, i32* %arrayidx4, align 4 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 - %exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count - br i1 %exitcond, label %for.cond.cleanup.loopexit, label %for.body -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/lsr-overflow.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/lsr-overflow.ll deleted file mode 100644 index 0b71d92bf2a..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/lsr-overflow.ll +++ /dev/null @@ -1,38 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -lsr-complexity-limit=50 -loop-reduce -S %s | FileCheck %s - -target triple = "x86_64-apple-macosx10.14.0" -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" - -define void @overflow1(i64 %a) { -; CHECK-LABEL: @overflow1( -; CHECK-NEXT: bb: -; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[A:%.*]], -1 -; CHECK-NEXT: br label [[BB1:%.*]] -; CHECK: bb1: -; CHECK-NEXT: [[LSR_IV:%.*]] = phi i64 [ [[LSR_IV_NEXT:%.*]], [[BB1]] ], [ [[TMP0]], [[BB:%.*]] ] -; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[LSR_IV]], -9223372036854775808 -; CHECK-NEXT: [[TMP4:%.*]] = icmp ne i64 [[TMP1]], -1 -; CHECK-NEXT: [[TMP5:%.*]] = and i1 [[TMP4]], true -; CHECK-NEXT: [[LSR_IV_NEXT]] = add i64 [[LSR_IV]], 1 -; CHECK-NEXT: br i1 [[TMP5]], label [[BB1]], label [[BB7:%.*]] -; CHECK: bb7: -; CHECK-NEXT: [[TMP9:%.*]] = and i64 [[LSR_IV_NEXT]], 1 -; CHECK-NEXT: [[TMP10:%.*]] = icmp eq i64 [[TMP9]], 0 -; CHECK-NEXT: unreachable -; -bb: - br label %bb1 - -bb1: ; preds = %bb1, %bb - %tmp = phi i64 [ %a, %bb ], [ %tmp6, %bb1 ] - %tmp4 = icmp ne i64 %tmp, -9223372036854775808 - %tmp5 = and i1 %tmp4, 1 - %tmp6 = add i64 %tmp, 1 - br i1 %tmp5, label %bb1, label %bb7 - -bb7: ; preds = %bb1 - %tmp9 = and i64 %tmp, 1 - %tmp10 = icmp eq i64 %tmp9, 0 - unreachable -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/macro-fuse-cmp.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/macro-fuse-cmp.ll deleted file mode 100644 index 10a725a7ef2..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/macro-fuse-cmp.ll +++ /dev/null @@ -1,141 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: opt < %s -loop-reduce -mcpu=btver2 -S | FileCheck %s --check-prefix=JAG -; RUN: opt < %s -loop-reduce -mcpu=bdver2 -S | FileCheck %s --check-prefix=BUL -; RUN: opt < %s -loop-reduce -mcpu=haswell -S | FileCheck %s --check-prefix=HSW - -; RUN: llc < %s | FileCheck %s --check-prefix=BASE -; RUN: llc < %s -mattr=macrofusion | FileCheck %s --check-prefix=FUSE -; RUN: llc < %s -mattr=branchfusion | FileCheck %s --check-prefix=FUSE - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-unknown" - -; PR35681 - https://bugs.llvm.org/show_bug.cgi?id=35681 -; FIXME: If a CPU can macro-fuse a compare and branch, then we discount that -; cost in LSR and avoid generating large offsets in each memory access. -; This reduces code size and may improve decode throughput. - -define void @maxArray(double* noalias nocapture %x, double* noalias nocapture readonly %y) { -; JAG-LABEL: @maxArray( -; JAG-NEXT: entry: -; JAG-NEXT: [[Y1:%.*]] = bitcast double* [[Y:%.*]] to i8* -; JAG-NEXT: [[X3:%.*]] = bitcast double* [[X:%.*]] to i8* -; JAG-NEXT: br label [[VECTOR_BODY:%.*]] -; JAG: vector.body: -; JAG-NEXT: [[LSR_IV:%.*]] = phi i64 [ [[LSR_IV_NEXT:%.*]], [[VECTOR_BODY]] ], [ -524288, [[ENTRY:%.*]] ] -; JAG-NEXT: [[UGLYGEP7:%.*]] = getelementptr i8, i8* [[X3]], i64 [[LSR_IV]] -; JAG-NEXT: [[UGLYGEP78:%.*]] = bitcast i8* [[UGLYGEP7]] to <2 x double>* -; JAG-NEXT: [[SCEVGEP9:%.*]] = getelementptr <2 x double>, <2 x double>* [[UGLYGEP78]], i64 32768 -; JAG-NEXT: [[UGLYGEP:%.*]] = getelementptr i8, i8* [[Y1]], i64 [[LSR_IV]] -; JAG-NEXT: [[UGLYGEP2:%.*]] = bitcast i8* [[UGLYGEP]] to <2 x double>* -; JAG-NEXT: [[SCEVGEP:%.*]] = getelementptr <2 x double>, <2 x double>* [[UGLYGEP2]], i64 32768 -; JAG-NEXT: [[XVAL:%.*]] = load <2 x double>, <2 x double>* [[SCEVGEP9]], align 8 -; JAG-NEXT: [[YVAL:%.*]] = load <2 x double>, <2 x double>* [[SCEVGEP]], align 8 -; JAG-NEXT: [[CMP:%.*]] = fcmp ogt <2 x double> [[YVAL]], [[XVAL]] -; JAG-NEXT: [[MAX:%.*]] = select <2 x i1> [[CMP]], <2 x double> [[YVAL]], <2 x double> [[XVAL]] -; JAG-NEXT: [[UGLYGEP4:%.*]] = getelementptr i8, i8* [[X3]], i64 [[LSR_IV]] -; JAG-NEXT: [[UGLYGEP45:%.*]] = bitcast i8* [[UGLYGEP4]] to <2 x double>* -; JAG-NEXT: [[SCEVGEP6:%.*]] = getelementptr <2 x double>, <2 x double>* [[UGLYGEP45]], i64 32768 -; JAG-NEXT: store <2 x double> [[MAX]], <2 x double>* [[SCEVGEP6]], align 8 -; JAG-NEXT: [[LSR_IV_NEXT]] = add nsw i64 [[LSR_IV]], 16 -; JAG-NEXT: [[DONE:%.*]] = icmp eq i64 [[LSR_IV_NEXT]], 0 -; JAG-NEXT: br i1 [[DONE]], label [[EXIT:%.*]], label [[VECTOR_BODY]] -; JAG: exit: -; JAG-NEXT: ret void -; -; BUL-LABEL: @maxArray( -; BUL-NEXT: entry: -; BUL-NEXT: br label [[VECTOR_BODY:%.*]] -; BUL: vector.body: -; BUL-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] -; BUL-NEXT: [[SCEVGEP4:%.*]] = getelementptr double, double* [[X:%.*]], i64 [[INDEX]] -; BUL-NEXT: [[SCEVGEP45:%.*]] = bitcast double* [[SCEVGEP4]] to <2 x double>* -; BUL-NEXT: [[SCEVGEP:%.*]] = getelementptr double, double* [[Y:%.*]], i64 [[INDEX]] -; BUL-NEXT: [[SCEVGEP1:%.*]] = bitcast double* [[SCEVGEP]] to <2 x double>* -; BUL-NEXT: [[XVAL:%.*]] = load <2 x double>, <2 x double>* [[SCEVGEP45]], align 8 -; BUL-NEXT: [[YVAL:%.*]] = load <2 x double>, <2 x double>* [[SCEVGEP1]], align 8 -; BUL-NEXT: [[CMP:%.*]] = fcmp ogt <2 x double> [[YVAL]], [[XVAL]] -; BUL-NEXT: [[MAX:%.*]] = select <2 x i1> [[CMP]], <2 x double> [[YVAL]], <2 x double> [[XVAL]] -; BUL-NEXT: [[SCEVGEP2:%.*]] = getelementptr double, double* [[X]], i64 [[INDEX]] -; BUL-NEXT: [[SCEVGEP23:%.*]] = bitcast double* [[SCEVGEP2]] to <2 x double>* -; BUL-NEXT: store <2 x double> [[MAX]], <2 x double>* [[SCEVGEP23]], align 8 -; BUL-NEXT: [[INDEX_NEXT]] = add i64 [[INDEX]], 2 -; BUL-NEXT: [[DONE:%.*]] = icmp eq i64 [[INDEX_NEXT]], 65536 -; BUL-NEXT: br i1 [[DONE]], label [[EXIT:%.*]], label [[VECTOR_BODY]] -; BUL: exit: -; BUL-NEXT: ret void -; -; HSW-LABEL: @maxArray( -; HSW-NEXT: entry: -; HSW-NEXT: br label [[VECTOR_BODY:%.*]] -; HSW: vector.body: -; HSW-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] -; HSW-NEXT: [[SCEVGEP4:%.*]] = getelementptr double, double* [[X:%.*]], i64 [[INDEX]] -; HSW-NEXT: [[SCEVGEP45:%.*]] = bitcast double* [[SCEVGEP4]] to <2 x double>* -; HSW-NEXT: [[SCEVGEP:%.*]] = getelementptr double, double* [[Y:%.*]], i64 [[INDEX]] -; HSW-NEXT: [[SCEVGEP1:%.*]] = bitcast double* [[SCEVGEP]] to <2 x double>* -; HSW-NEXT: [[XVAL:%.*]] = load <2 x double>, <2 x double>* [[SCEVGEP45]], align 8 -; HSW-NEXT: [[YVAL:%.*]] = load <2 x double>, <2 x double>* [[SCEVGEP1]], align 8 -; HSW-NEXT: [[CMP:%.*]] = fcmp ogt <2 x double> [[YVAL]], [[XVAL]] -; HSW-NEXT: [[MAX:%.*]] = select <2 x i1> [[CMP]], <2 x double> [[YVAL]], <2 x double> [[XVAL]] -; HSW-NEXT: [[SCEVGEP2:%.*]] = getelementptr double, double* [[X]], i64 [[INDEX]] -; HSW-NEXT: [[SCEVGEP23:%.*]] = bitcast double* [[SCEVGEP2]] to <2 x double>* -; HSW-NEXT: store <2 x double> [[MAX]], <2 x double>* [[SCEVGEP23]], align 8 -; HSW-NEXT: [[INDEX_NEXT]] = add i64 [[INDEX]], 2 -; HSW-NEXT: [[DONE:%.*]] = icmp eq i64 [[INDEX_NEXT]], 65536 -; HSW-NEXT: br i1 [[DONE]], label [[EXIT:%.*]], label [[VECTOR_BODY]] -; HSW: exit: -; HSW-NEXT: ret void -; -; BASE-LABEL: maxArray: -; BASE: # %bb.0: # %entry -; BASE-NEXT: movq $-524288, %rax # imm = 0xFFF80000 -; BASE-NEXT: .p2align 4, 0x90 -; BASE-NEXT: .LBB0_1: # %vector.body -; BASE-NEXT: # =>This Inner Loop Header: Depth=1 -; BASE-NEXT: movupd 524288(%rdi,%rax), %xmm0 -; BASE-NEXT: movupd 524288(%rsi,%rax), %xmm1 -; BASE-NEXT: maxpd %xmm0, %xmm1 -; BASE-NEXT: movupd %xmm1, 524288(%rdi,%rax) -; BASE-NEXT: addq $16, %rax -; BASE-NEXT: jne .LBB0_1 -; BASE-NEXT: # %bb.2: # %exit -; BASE-NEXT: retq -; FUSE-LABEL: maxArray: -; FUSE: # %bb.0: # %entry -; FUSE-NEXT: xorl %eax, %eax -; FUSE-NEXT: .p2align 4, 0x90 -; FUSE-NEXT: .LBB0_1: # %vector.body -; FUSE-NEXT: # =>This Inner Loop Header: Depth=1 -; FUSE-NEXT: movupd (%rdi,%rax,8), %xmm0 -; FUSE-NEXT: movupd (%rsi,%rax,8), %xmm1 -; FUSE-NEXT: maxpd %xmm0, %xmm1 -; FUSE-NEXT: movupd %xmm1, (%rdi,%rax,8) -; FUSE-NEXT: addq $2, %rax -; FUSE-NEXT: cmpq $65536, %rax # imm = 0x10000 -; FUSE-NEXT: jne .LBB0_1 -; FUSE-NEXT: # %bb.2: # %exit -; FUSE-NEXT: retq -entry: - br label %vector.body - -vector.body: - %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ] - %gepx = getelementptr inbounds double, double* %x, i64 %index - %gepy = getelementptr inbounds double, double* %y, i64 %index - %xptr = bitcast double* %gepx to <2 x double>* - %yptr = bitcast double* %gepy to <2 x double>* - %xval = load <2 x double>, <2 x double>* %xptr, align 8 - %yval = load <2 x double>, <2 x double>* %yptr, align 8 - %cmp = fcmp ogt <2 x double> %yval, %xval - %max = select <2 x i1> %cmp, <2 x double> %yval, <2 x double> %xval - %xptr_again = bitcast double* %gepx to <2 x double>* - store <2 x double> %max, <2 x double>* %xptr_again, align 8 - %index.next = add i64 %index, 2 - %done = icmp eq i64 %index.next, 65536 - br i1 %done, label %exit, label %vector.body - -exit: - ret void -} - diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/nested-loop.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/nested-loop.ll deleted file mode 100644 index b9af5a0c68a..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/nested-loop.ll +++ /dev/null @@ -1,93 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -loop-reduce -S < %s | FileCheck %s - -; Check when we use an outerloop induction variable inside of an innerloop -; induction value expr, LSR can still choose to use single induction variable -; for the innerloop and share it in multiple induction value exprs. - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define void @foo(i32 %size, i32 %nsteps, i32 %hsize, i32* %lined, i8* %maxarray) { -; CHECK-LABEL: @foo( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[CMP215:%.*]] = icmp sgt i32 [[SIZE:%.*]], 1 -; CHECK-NEXT: [[T0:%.*]] = zext i32 [[SIZE]] to i64 -; CHECK-NEXT: [[T1:%.*]] = sext i32 [[NSTEPS:%.*]] to i64 -; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[T0]], -1 -; CHECK-NEXT: br label [[FOR_BODY:%.*]] -; CHECK: for.body: -; CHECK-NEXT: [[LSR_IV1:%.*]] = phi i64 [ [[LSR_IV_NEXT2:%.*]], [[FOR_INC:%.*]] ], [ 1, [[ENTRY:%.*]] ] -; CHECK-NEXT: [[INDVARS_IV2:%.*]] = phi i64 [ [[INDVARS_IV_NEXT3:%.*]], [[FOR_INC]] ], [ 0, [[ENTRY]] ] -; CHECK-NEXT: br i1 [[CMP215]], label [[FOR_BODY2_PREHEADER:%.*]], label [[FOR_INC]] -; CHECK: for.body2.preheader: -; CHECK-NEXT: br label [[FOR_BODY2:%.*]] -; CHECK: for.body2: -; CHECK-NEXT: [[LSR_IV3:%.*]] = phi i8* [ [[SCEVGEP:%.*]], [[FOR_BODY2]] ], [ [[MAXARRAY:%.*]], [[FOR_BODY2_PREHEADER]] ] -; CHECK-NEXT: [[LSR_IV:%.*]] = phi i64 [ [[LSR_IV_NEXT:%.*]], [[FOR_BODY2]] ], [ [[TMP0]], [[FOR_BODY2_PREHEADER]] ] -; CHECK-NEXT: [[SCEVGEP6:%.*]] = getelementptr i8, i8* [[LSR_IV3]], i64 1 -; CHECK-NEXT: [[V1:%.*]] = load i8, i8* [[SCEVGEP6]], align 1 -; CHECK-NEXT: [[SCEVGEP5:%.*]] = getelementptr i8, i8* [[LSR_IV3]], i64 [[TMP0]] -; CHECK-NEXT: [[V2:%.*]] = load i8, i8* [[SCEVGEP5]], align 1 -; CHECK-NEXT: [[TMPV:%.*]] = xor i8 [[V1]], [[V2]] -; CHECK-NEXT: [[SCEVGEP4:%.*]] = getelementptr i8, i8* [[LSR_IV3]], i64 [[LSR_IV1]] -; CHECK-NEXT: store i8 [[TMPV]], i8* [[SCEVGEP4]], align 1 -; CHECK-NEXT: [[LSR_IV_NEXT]] = add i64 [[LSR_IV]], -1 -; CHECK-NEXT: [[SCEVGEP]] = getelementptr i8, i8* [[LSR_IV3]], i64 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[LSR_IV_NEXT]], 0 -; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY2]], label [[FOR_INC_LOOPEXIT:%.*]] -; CHECK: for.inc.loopexit: -; CHECK-NEXT: br label [[FOR_INC]] -; CHECK: for.inc: -; CHECK-NEXT: [[INDVARS_IV_NEXT3]] = add nuw nsw i64 [[INDVARS_IV2]], 1 -; CHECK-NEXT: [[LSR_IV_NEXT2]] = add nuw nsw i64 [[LSR_IV1]], [[T0]] -; CHECK-NEXT: [[CMP:%.*]] = icmp slt i64 [[INDVARS_IV_NEXT3]], [[T1]] -; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END_LOOPEXIT:%.*]] -; CHECK: for.end.loopexit: -; CHECK-NEXT: ret void -; -entry: - %cmp215 = icmp sgt i32 %size, 1 - %t0 = zext i32 %size to i64 - %t1 = sext i32 %nsteps to i64 - %sub2 = sub i64 %t0, 2 - br label %for.body - -for.body: ; preds = %for.inc, %entry - %indvars.iv2 = phi i64 [ %indvars.iv.next3, %for.inc ], [ 0, %entry ] - %t2 = mul nsw i64 %indvars.iv2, %t0 - br i1 %cmp215, label %for.body2.preheader, label %for.inc - -for.body2.preheader: ; preds = %for.body - br label %for.body2 - -; Check LSR only generates two induction variables for for.body2 one for compare and -; one to shared by multiple array accesses. - -for.body2: ; preds = %for.body2.preheader, %for.body2 - %indvars.iv = phi i64 [ 1, %for.body2.preheader ], [ %indvars.iv.next, %for.body2 ] - %arrayidx1 = getelementptr inbounds i8, i8* %maxarray, i64 %indvars.iv - %v1 = load i8, i8* %arrayidx1, align 1 - %idx2 = add nsw i64 %indvars.iv, %sub2 - %arrayidx2 = getelementptr inbounds i8, i8* %maxarray, i64 %idx2 - %v2 = load i8, i8* %arrayidx2, align 1 - %tmpv = xor i8 %v1, %v2 - %t4 = add nsw i64 %t2, %indvars.iv - %add.ptr = getelementptr inbounds i8, i8* %maxarray, i64 %t4 - store i8 %tmpv, i8* %add.ptr, align 1 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 - %wide.trip.count = zext i32 %size to i64 - %exitcond = icmp ne i64 %indvars.iv.next, %wide.trip.count - br i1 %exitcond, label %for.body2, label %for.inc.loopexit - -for.inc.loopexit: ; preds = %for.body2 - br label %for.inc - -for.inc: ; preds = %for.inc.loopexit, %for.body - %indvars.iv.next3 = add nuw nsw i64 %indvars.iv2, 1 - %cmp = icmp slt i64 %indvars.iv.next3, %t1 - br i1 %cmp, label %for.body, label %for.end.loopexit - -for.end.loopexit: ; preds = %for.inc - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/no_superflous_induction_vars.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/no_superflous_induction_vars.ll deleted file mode 100644 index a6613c53d78..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/no_superflous_induction_vars.ll +++ /dev/null @@ -1,50 +0,0 @@ -; RUN: opt -S -loop-reduce -mcpu=corei7-avx -mtriple=x86_64-apple-macosx < %s | FileCheck %s - -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" - -define void @indvar_expansion(i8* nocapture readonly %rowsptr) { -entry: - br label %for.cond - -; SCEVExpander used to create induction variables in the loop %for.cond while -; expanding the recurrence start value of loop strength reduced values from -; %vector.body. - -; CHECK-LABEL: indvar_expansion -; CHECK: for.cond: -; CHECK-NOT: phi i3 -; CHECK: br i1 {{.+}}, label %for.cond - -for.cond: - %indvars.iv44 = phi i64 [ %indvars.iv.next45, %for.cond ], [ 0, %entry ] - %cmp = icmp eq i8 undef, 0 - %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1 - br i1 %cmp, label %for.cond, label %for.cond2 - -for.cond2: - br i1 undef, label %for.cond2, label %for.body14.lr.ph - -for.body14.lr.ph: - %sext = shl i64 %indvars.iv44, 32 - %0 = ashr exact i64 %sext, 32 - %1 = sub i64 undef, %indvars.iv44 - %2 = and i64 %1, 4294967295 - %3 = add i64 %2, 1 - %fold = add i64 %1, 1 - %n.mod.vf = and i64 %fold, 7 - %n.vec = sub i64 %3, %n.mod.vf - %end.idx.rnd.down = add i64 %n.vec, %0 - br label %vector.body - -vector.body: - %index = phi i64 [ %index.next, %vector.body ], [ %0, %for.body14.lr.ph ] - %4 = getelementptr inbounds i8, i8* %rowsptr, i64 %index - %5 = bitcast i8* %4 to <4 x i8>* - %wide.load = load <4 x i8>, <4 x i8>* %5, align 1 - %index.next = add i64 %index, 8 - %6 = icmp eq i64 %index.next, %end.idx.rnd.down - br i1 %6, label %for.end24, label %vector.body - -for.end24: - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/pr17473.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/pr17473.ll deleted file mode 100644 index 5b7bb884604..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/pr17473.ll +++ /dev/null @@ -1,67 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | FileCheck %s - -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx10.9.0" - -; LSR shouldn't normalize IV if it can't be denormalized to the original -; expression. In this testcase, the normalized expression was denormalized to -; an expression different from the original, and we were losing sign extension. - -; CHECK: [[TMP:%[a-z]+]] = trunc i32 {{.*}} to i8 -; CHECK: {{%[a-z0-9]+}} = sext i8 [[TMP]] to i32 - -@j = common global i32 0, align 4 -@c = common global i32 0, align 4 -@g = common global i32 0, align 4 -@h = common global i8 0, align 1 -@d = common global i32 0, align 4 -@i = common global i32 0, align 4 -@e = common global i32 0, align 4 -@.str = private unnamed_addr constant [4 x i8] c"%x\0A\00", align 1 -@a = common global i32 0, align 4 -@b = common global i16 0, align 2 - -; Function Attrs: nounwind optsize ssp uwtable -define i32 @main() #0 { -entry: - store i8 0, i8* @h, align 1 - %0 = load i32, i32* @j, align 4 - %tobool.i = icmp eq i32 %0, 0 - %1 = load i32, i32* @d, align 4 - %cmp3 = icmp sgt i32 %1, -1 - %.lobit = lshr i32 %1, 31 - %.lobit.not = xor i32 %.lobit, 1 - br label %for.body - -for.body: ; preds = %entry, %fn3.exit - %inc9 = phi i8 [ 0, %entry ], [ %inc, %fn3.exit ] - %conv = sext i8 %inc9 to i32 - br i1 %tobool.i, label %fn3.exit, label %land.rhs.i - -land.rhs.i: ; preds = %for.body - store i32 0, i32* @c, align 4 - br label %fn3.exit - -fn3.exit: ; preds = %for.body, %land.rhs.i - %inc = add i8 %inc9, 1 - %cmp = icmp sgt i8 %inc, -1 - br i1 %cmp, label %for.body, label %for.end - -for.end: ; preds = %fn3.exit - %.lobit.not. = select i1 %cmp3, i32 %.lobit.not, i32 0 - store i32 %conv, i32* @g, align 4 - store i32 %.lobit.not., i32* @i, align 4 - store i8 %inc, i8* @h, align 1 - %conv7 = sext i8 %inc to i32 - %add = add nsw i32 %conv7, %conv - store i32 %add, i32* @e, align 4 - %call = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %add) #2 - ret i32 0 -} - -; Function Attrs: nounwind optsize -declare i32 @printf(i8* nocapture readonly, ...) #1 - -attributes #0 = { nounwind optsize ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { nounwind optsize "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #2 = { nounwind optsize } diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/pr28719.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/pr28719.ll deleted file mode 100644 index 0e74ff20073..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/pr28719.ll +++ /dev/null @@ -1,47 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | FileCheck %s - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@a = global i32 0, align 4 -@b = global i8 0, align 1 -@c = global [4 x i8] zeroinitializer, align 1 - -; Just make sure we don't generate code with uses not dominated by defs. -; CHECK-LABEL: @main( -define i32 @main() { -entry: - %a0 = load i32, i32* @a, align 4 - %cmpa = icmp slt i32 %a0, 4 - br i1 %cmpa, label %preheader, label %for.end - -preheader: - %b0 = load i8, i8* @b, align 1 - %b0sext = sext i8 %b0 to i64 - br label %for.body - -for.body: - %iv = phi i64 [ 0, %preheader ], [ %iv.next, %lor.false ] - %mul = mul nsw i64 %b0sext, %iv - %multrunc = trunc i64 %mul to i32 - %cmp = icmp eq i32 %multrunc, 0 - br i1 %cmp, label %lor.false, label %if.then - -lor.false: - %cgep = getelementptr inbounds [4 x i8], [4 x i8]* @c, i64 0, i64 %iv - %ci = load i8, i8* %cgep, align 1 - %cisext = sext i8 %ci to i32 - %ivtrunc = trunc i64 %iv to i32 - %cmp2 = icmp eq i32 %cisext, %ivtrunc - %iv.next = add i64 %iv, 1 - br i1 %cmp2, label %for.body, label %if.then - -if.then: - tail call void @abort() - unreachable - -for.end: - ret i32 0 -} - -declare void @abort() diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/pr40514.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/pr40514.ll deleted file mode 100644 index 4ffcfd8549e..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/pr40514.ll +++ /dev/null @@ -1,57 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -loop-reduce -S | FileCheck %s - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:1" -target triple = "x86_64-unknown-linux-gnu" - -define i32 @pluto(i32 %arg) #0 { -; CHECK-LABEL: @pluto( -; CHECK-NEXT: bb: -; CHECK-NEXT: br label [[BB10:%.*]] -; CHECK: bb1: -; CHECK-NEXT: store i64 [[LSR_IV_NEXT2:%.*]], i64 addrspace(1)* undef, align 8 -; CHECK-NEXT: ret i32 [[LSR_IV_NEXT:%.*]] -; CHECK: bb10: -; CHECK-NEXT: [[LSR_IV1:%.*]] = phi i64 [ [[LSR_IV_NEXT2]], [[BB10]] ], [ 9, [[BB:%.*]] ] -; CHECK-NEXT: [[LSR_IV:%.*]] = phi i32 [ [[LSR_IV_NEXT]], [[BB10]] ], [ undef, [[BB]] ] -; CHECK-NEXT: [[LSR_IV_NEXT]] = add i32 [[LSR_IV]], 1 -; CHECK-NEXT: [[LSR_IV_NEXT2]] = add nuw nsw i64 [[LSR_IV1]], 1 -; CHECK-NEXT: br i1 true, label [[BB1:%.*]], label [[BB10]] -; - -bb: - br label %bb10 - -bb1: ; preds = %bb10 - %tmp = and i64 %tmp24, 4294967295 - %tmp2 = shl i64 %tmp23, 33 - %tmp3 = ashr exact i64 %tmp2, 32 - %tmp4 = add i64 undef, %tmp - %tmp5 = add i64 %tmp4, %tmp3 - %tmp6 = add i64 %tmp5, undef - %tmp7 = add i64 %tmp6, undef - %tmp8 = add i64 undef, %tmp7 - store i64 %tmp8, i64 addrspace(1)* undef, align 8 - %tmp9 = trunc i64 %tmp7 to i32 - ret i32 %tmp9 - -bb10: ; preds = %bb10, %bb - %tmp11 = phi i64 [ 9, %bb ], [ %tmp24, %bb10 ] - %tmp12 = shl i64 undef, 1 - %tmp13 = mul i64 %tmp12, %tmp12 - %tmp14 = shl i64 %tmp13, 1 - %tmp15 = mul i64 %tmp14, %tmp14 - %tmp16 = shl i64 %tmp15, 1 - %tmp17 = mul i64 %tmp16, %tmp16 - %tmp18 = shl i64 %tmp17, 1 - %tmp19 = mul i64 %tmp18, %tmp18 - %tmp20 = shl i64 %tmp19, 1 - %tmp21 = mul i64 %tmp20, %tmp20 - %tmp22 = shl i64 %tmp21, 1 - %tmp23 = mul i64 %tmp22, %tmp22 - %tmp24 = add nuw nsw i64 %tmp11, 1 - br i1 undef, label %bb1, label %bb10 -} - - -attributes #0 = { "target-cpu"="broadwell" "target-features"="+sse2,+cx16,+sahf,-tbm,-avx512ifma,-sha,-gfni,-fma4,-vpclmulqdq,+prfchw,+bmi2,-cldemote,+fsgsbase,-ptwrite,-xsavec,+popcnt,+aes,-avx512bitalg,-movdiri,-xsaves,-avx512er,-avx512vnni,-avx512vpopcntdq,-pconfig,-clwb,-avx512f,-clzero,-pku,+mmx,-lwp,-rdpid,-xop,+rdseed,-waitpkg,-movdir64b,-sse4a,-avx512bw,-clflushopt,+xsave,-avx512vbmi2,+64bit,-avx512vl,+invpcid,-avx512cd,+avx,-vaes,+rtm,+fma,+bmi,+rdrnd,-mwaitx,+sse4.1,+sse4.2,+avx2,-wbnoinvd,+sse,+lzcnt,+pclmul,-prefetchwt1,+f16c,+ssse3,-sgx,-shstk,+cmov,-avx512vbmi,+movbe,+xsaveopt,-avx512dq,+adx,-avx512pf,+sse3" } diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/sibling-loops.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/sibling-loops.ll deleted file mode 100644 index a69d6adc0f0..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/sibling-loops.ll +++ /dev/null @@ -1,97 +0,0 @@ -; RUN: opt -loop-reduce -S < %s | FileCheck %s -; We find it is very bad to allow LSR formula containing SCEVAddRecExpr Reg -; from siblings of current loop. When one loop is LSR optimized, it can -; insert lsr.iv for other sibling loops, which sometimes leads to many extra -; lsr.iv inserted for loops. - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" - -@cond = common local_unnamed_addr global i64 0, align 8 - -; Check there is no extra lsr.iv generated in foo. -; CHECK-LABEL: @foo( -; CHECK-NOT: lsr.iv{{[0-9]+}} = -; -define void @foo(i64 %N) local_unnamed_addr { -entry: - br label %do.body - -do.body: ; preds = %do.body, %entry - %i.0 = phi i64 [ 0, %entry ], [ %inc, %do.body ] - tail call void @goo(i64 %i.0, i64 %i.0) - %inc = add nuw nsw i64 %i.0, 1 - %t0 = load i64, i64* @cond, align 8 - %tobool = icmp eq i64 %t0, 0 - br i1 %tobool, label %do.body2.preheader, label %do.body - -do.body2.preheader: ; preds = %do.body - br label %do.body2 - -do.body2: ; preds = %do.body2.preheader, %do.body2 - %i.1 = phi i64 [ %inc3, %do.body2 ], [ 0, %do.body2.preheader ] - %j.1 = phi i64 [ %inc4, %do.body2 ], [ %inc, %do.body2.preheader ] - tail call void @goo(i64 %i.1, i64 %j.1) - %inc3 = add nuw nsw i64 %i.1, 1 - %inc4 = add nsw i64 %j.1, 1 - %t1 = load i64, i64* @cond, align 8 - %tobool6 = icmp eq i64 %t1, 0 - br i1 %tobool6, label %do.body8.preheader, label %do.body2 - -do.body8.preheader: ; preds = %do.body2 - br label %do.body8 - -do.body8: ; preds = %do.body8.preheader, %do.body8 - %i.2 = phi i64 [ %inc9, %do.body8 ], [ 0, %do.body8.preheader ] - %j.2 = phi i64 [ %inc10, %do.body8 ], [ %inc4, %do.body8.preheader ] - tail call void @goo(i64 %i.2, i64 %j.2) - %inc9 = add nuw nsw i64 %i.2, 1 - %inc10 = add nsw i64 %j.2, 1 - %t2 = load i64, i64* @cond, align 8 - %tobool12 = icmp eq i64 %t2, 0 - br i1 %tobool12, label %do.body14.preheader, label %do.body8 - -do.body14.preheader: ; preds = %do.body8 - br label %do.body14 - -do.body14: ; preds = %do.body14.preheader, %do.body14 - %i.3 = phi i64 [ %inc15, %do.body14 ], [ 0, %do.body14.preheader ] - %j.3 = phi i64 [ %inc16, %do.body14 ], [ %inc10, %do.body14.preheader ] - tail call void @goo(i64 %i.3, i64 %j.3) - %inc15 = add nuw nsw i64 %i.3, 1 - %inc16 = add nsw i64 %j.3, 1 - %t3 = load i64, i64* @cond, align 8 - %tobool18 = icmp eq i64 %t3, 0 - br i1 %tobool18, label %do.body20.preheader, label %do.body14 - -do.body20.preheader: ; preds = %do.body14 - br label %do.body20 - -do.body20: ; preds = %do.body20.preheader, %do.body20 - %i.4 = phi i64 [ %inc21, %do.body20 ], [ 0, %do.body20.preheader ] - %j.4 = phi i64 [ %inc22, %do.body20 ], [ %inc16, %do.body20.preheader ] - tail call void @goo(i64 %i.4, i64 %j.4) - %inc21 = add nuw nsw i64 %i.4, 1 - %inc22 = add nsw i64 %j.4, 1 - %t4 = load i64, i64* @cond, align 8 - %tobool24 = icmp eq i64 %t4, 0 - br i1 %tobool24, label %do.body26.preheader, label %do.body20 - -do.body26.preheader: ; preds = %do.body20 - br label %do.body26 - -do.body26: ; preds = %do.body26.preheader, %do.body26 - %i.5 = phi i64 [ %inc27, %do.body26 ], [ 0, %do.body26.preheader ] - %j.5 = phi i64 [ %inc28, %do.body26 ], [ %inc22, %do.body26.preheader ] - tail call void @goo(i64 %i.5, i64 %j.5) - %inc27 = add nuw nsw i64 %i.5, 1 - %inc28 = add nsw i64 %j.5, 1 - %t5 = load i64, i64* @cond, align 8 - %tobool30 = icmp eq i64 %t5, 0 - br i1 %tobool30, label %do.end31, label %do.body26 - -do.end31: ; preds = %do.body26 - ret void -} - -declare void @goo(i64, i64) local_unnamed_addr - diff --git a/llvm/test/Transforms/LoopStrengthReduce/addrec-gep-address-space.ll b/llvm/test/Transforms/LoopStrengthReduce/addrec-gep-address-space.ll deleted file mode 100644 index 5650f81a308..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/addrec-gep-address-space.ll +++ /dev/null @@ -1,88 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | FileCheck %s -; CHECK: bb1: -; CHECK: load double, double addrspace(1)* [[IV:%[^,]+]] -; CHECK: store double {{.*}}, double addrspace(1)* [[IV]] - -; CHECK-NOT: cast -; Make sure the GEP has the right index type -; CHECK: getelementptr double, double addrspace(1)* [[IV]], i16 1 -; CHECK: br {{.*}} label %bb1 - -; Make sure the GEP has the right index type -; CHECK: getelementptr double, double addrspace(1)* {{.*}}, i16 - - -; This test tests several things. The load and store should use the -; same address instead of having it computed twice, and SCEVExpander should -; be able to reconstruct the full getelementptr, despite it having a few -; obstacles set in its way. -; We only check that the inner loop (bb1-bb2) is "reduced" because LSR -; currently only operates on inner loops. - -target datalayout = "e-p:64:64:64-p1:16:16:16-n16:32:64" - -define void @foo(i64 %n, i64 %m, i64 %o, i64 %q, double addrspace(1)* nocapture %p) nounwind { -entry: - %tmp = icmp sgt i64 %n, 0 ; <i1> [#uses=1] - br i1 %tmp, label %bb.nph3, label %return - -bb.nph: ; preds = %bb2.preheader - %tmp1 = mul i64 %tmp16, %i.02 ; <i64> [#uses=1] - %tmp2 = mul i64 %tmp19, %i.02 ; <i64> [#uses=1] - br label %bb1 - -bb1: ; preds = %bb2, %bb.nph - %j.01 = phi i64 [ %tmp9, %bb2 ], [ 0, %bb.nph ] ; <i64> [#uses=3] - %tmp3 = add i64 %j.01, %tmp1 ; <i64> [#uses=1] - %tmp4 = add i64 %j.01, %tmp2 ; <i64> [#uses=1] - %z0 = add i64 %tmp3, 5203 - %tmp5 = getelementptr double, double addrspace(1)* %p, i64 %z0 ; <double addrspace(1)*> [#uses=1] - %tmp6 = load double, double addrspace(1)* %tmp5, align 8 ; <double> [#uses=1] - %tmp7 = fdiv double %tmp6, 2.100000e+00 ; <double> [#uses=1] - %z1 = add i64 %tmp4, 5203 - %tmp8 = getelementptr double, double addrspace(1)* %p, i64 %z1 ; <double addrspace(1)*> [#uses=1] - store double %tmp7, double addrspace(1)* %tmp8, align 8 - %tmp9 = add i64 %j.01, 1 ; <i64> [#uses=2] - br label %bb2 - -bb2: ; preds = %bb1 - %tmp10 = icmp slt i64 %tmp9, %m ; <i1> [#uses=1] - br i1 %tmp10, label %bb1, label %bb2.bb3_crit_edge - -bb2.bb3_crit_edge: ; preds = %bb2 - br label %bb3 - -bb3: ; preds = %bb2.preheader, %bb2.bb3_crit_edge - %tmp11 = add i64 %i.02, 1 ; <i64> [#uses=2] - br label %bb4 - -bb4: ; preds = %bb3 - %tmp12 = icmp slt i64 %tmp11, %n ; <i1> [#uses=1] - br i1 %tmp12, label %bb2.preheader, label %bb4.return_crit_edge - -bb4.return_crit_edge: ; preds = %bb4 - br label %bb4.return_crit_edge.split - -bb4.return_crit_edge.split: ; preds = %bb.nph3, %bb4.return_crit_edge - br label %return - -bb.nph3: ; preds = %entry - %tmp13 = icmp sgt i64 %m, 0 ; <i1> [#uses=1] - %tmp14 = mul i64 %n, 37 ; <i64> [#uses=1] - %tmp15 = mul i64 %tmp14, %o ; <i64> [#uses=1] - %tmp16 = mul i64 %tmp15, %q ; <i64> [#uses=1] - %tmp17 = mul i64 %n, 37 ; <i64> [#uses=1] - %tmp18 = mul i64 %tmp17, %o ; <i64> [#uses=1] - %tmp19 = mul i64 %tmp18, %q ; <i64> [#uses=1] - br i1 %tmp13, label %bb.nph3.split, label %bb4.return_crit_edge.split - -bb.nph3.split: ; preds = %bb.nph3 - br label %bb2.preheader - -bb2.preheader: ; preds = %bb.nph3.split, %bb4 - %i.02 = phi i64 [ %tmp11, %bb4 ], [ 0, %bb.nph3.split ] ; <i64> [#uses=3] - br i1 true, label %bb.nph, label %bb3 - -return: ; preds = %bb4.return_crit_edge.split, %entry - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/addrec-gep.ll b/llvm/test/Transforms/LoopStrengthReduce/addrec-gep.ll deleted file mode 100644 index 6919a33d8a2..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/addrec-gep.ll +++ /dev/null @@ -1,82 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | FileCheck %s -; CHECK: bb1: -; CHECK: load double, double* [[IV:%[^,]+]] -; CHECK: store double {{.*}}, double* [[IV]] -; CHECK: getelementptr double, double* -; CHECK-NOT: cast -; CHECK: br {{.*}} label %bb1 - -; This test tests several things. The load and store should use the -; same address instead of having it computed twice, and SCEVExpander should -; be able to reconstruct the full getelementptr, despite it having a few -; obstacles set in its way. -; We only check that the inner loop (bb1-bb2) is "reduced" because LSR -; currently only operates on inner loops. - -target datalayout = "e-p:64:64:64-n32:64" - -define void @foo(i64 %n, i64 %m, i64 %o, i64 %q, double* nocapture %p) nounwind { -entry: - %tmp = icmp sgt i64 %n, 0 ; <i1> [#uses=1] - br i1 %tmp, label %bb.nph3, label %return - -bb.nph: ; preds = %bb2.preheader - %tmp1 = mul i64 %tmp16, %i.02 ; <i64> [#uses=1] - %tmp2 = mul i64 %tmp19, %i.02 ; <i64> [#uses=1] - br label %bb1 - -bb1: ; preds = %bb2, %bb.nph - %j.01 = phi i64 [ %tmp9, %bb2 ], [ 0, %bb.nph ] ; <i64> [#uses=3] - %tmp3 = add i64 %j.01, %tmp1 ; <i64> [#uses=1] - %tmp4 = add i64 %j.01, %tmp2 ; <i64> [#uses=1] - %z0 = add i64 %tmp3, 5203 - %tmp5 = getelementptr double, double* %p, i64 %z0 ; <double*> [#uses=1] - %tmp6 = load double, double* %tmp5, align 8 ; <double> [#uses=1] - %tmp7 = fdiv double %tmp6, 2.100000e+00 ; <double> [#uses=1] - %z1 = add i64 %tmp4, 5203 - %tmp8 = getelementptr double, double* %p, i64 %z1 ; <double*> [#uses=1] - store double %tmp7, double* %tmp8, align 8 - %tmp9 = add i64 %j.01, 1 ; <i64> [#uses=2] - br label %bb2 - -bb2: ; preds = %bb1 - %tmp10 = icmp slt i64 %tmp9, %m ; <i1> [#uses=1] - br i1 %tmp10, label %bb1, label %bb2.bb3_crit_edge - -bb2.bb3_crit_edge: ; preds = %bb2 - br label %bb3 - -bb3: ; preds = %bb2.preheader, %bb2.bb3_crit_edge - %tmp11 = add i64 %i.02, 1 ; <i64> [#uses=2] - br label %bb4 - -bb4: ; preds = %bb3 - %tmp12 = icmp slt i64 %tmp11, %n ; <i1> [#uses=1] - br i1 %tmp12, label %bb2.preheader, label %bb4.return_crit_edge - -bb4.return_crit_edge: ; preds = %bb4 - br label %bb4.return_crit_edge.split - -bb4.return_crit_edge.split: ; preds = %bb.nph3, %bb4.return_crit_edge - br label %return - -bb.nph3: ; preds = %entry - %tmp13 = icmp sgt i64 %m, 0 ; <i1> [#uses=1] - %tmp14 = mul i64 %n, 37 ; <i64> [#uses=1] - %tmp15 = mul i64 %tmp14, %o ; <i64> [#uses=1] - %tmp16 = mul i64 %tmp15, %q ; <i64> [#uses=1] - %tmp17 = mul i64 %n, 37 ; <i64> [#uses=1] - %tmp18 = mul i64 %tmp17, %o ; <i64> [#uses=1] - %tmp19 = mul i64 %tmp18, %q ; <i64> [#uses=1] - br i1 %tmp13, label %bb.nph3.split, label %bb4.return_crit_edge.split - -bb.nph3.split: ; preds = %bb.nph3 - br label %bb2.preheader - -bb2.preheader: ; preds = %bb.nph3.split, %bb4 - %i.02 = phi i64 [ %tmp11, %bb4 ], [ 0, %bb.nph3.split ] ; <i64> [#uses=3] - br i1 true, label %bb.nph, label %bb3 - -return: ; preds = %bb4.return_crit_edge.split, %entry - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/address-space-loop.ll b/llvm/test/Transforms/LoopStrengthReduce/address-space-loop.ll deleted file mode 100644 index 57ba665b5f4..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/address-space-loop.ll +++ /dev/null @@ -1,56 +0,0 @@ -; RUN: opt -S -loop-reduce < %s | FileCheck %s - -; LSR shouldn't consider %t8 to be an interesting user of %t6, and it -; should be able to form pretty GEPs. - -target datalayout = "e-p:64:64:64-p1:16:16:16-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" - -; Copy of uglygep with a different address space -; This tests expandAddToGEP uses the right smaller integer type for -; another address space -define void @Z4() nounwind { -; CHECK-LABEL: @Z4( -bb: - br label %bb3 - -bb1: ; preds = %bb3 - br i1 undef, label %bb10, label %bb2 - -bb2: ; preds = %bb1 - %t = add i16 %t4, 1 ; <i16> [#uses=1] - br label %bb3 - -bb3: ; preds = %bb2, %bb - %t4 = phi i16 [ %t, %bb2 ], [ 0, %bb ] ; <i16> [#uses=3] - br label %bb1 - -; CHECK: bb10: -; CHECK-NEXT: %t7 = icmp eq i16 %t4, 0 -; Host %t2 computation outside the loop. -; CHECK-NEXT: [[SCEVGEP:%[^ ]+]] = getelementptr i8, i8 addrspace(1)* undef, i16 %t4 -; CHECK-NEXT: br label %bb14 -bb10: ; preds = %bb9 - %t7 = icmp eq i16 %t4, 0 ; <i1> [#uses=1] - %t3 = add i16 %t4, 16 ; <i16> [#uses=1] - br label %bb14 - -; CHECK: bb14: -; CHECK-NEXT: store i8 undef, i8 addrspace(1)* [[SCEVGEP]] -; CHECK-NEXT: %t6 = load float addrspace(1)*, float addrspace(1)* addrspace(1)* undef -; Fold %t3's add within the address. -; CHECK-NEXT: [[SCEVGEP1:%[^ ]+]] = getelementptr float, float addrspace(1)* %t6, i16 4 -; CHECK-NEXT: [[SCEVGEP2:%[^ ]+]] = bitcast float addrspace(1)* [[SCEVGEP1]] to i8 addrspace(1)* -; Use the induction variable (%t4) to access the right element -; CHECK-NEXT: [[ADDRESS:%[^ ]+]] = getelementptr i8, i8 addrspace(1)* [[SCEVGEP2]], i16 %t4 -; CHECK-NEXT: store i8 undef, i8 addrspace(1)* [[ADDRESS]] -; CHECK-NEXT: br label %bb14 -bb14: ; preds = %bb14, %bb10 - %t2 = getelementptr inbounds i8, i8 addrspace(1)* undef, i16 %t4 ; <i8*> [#uses=1] - store i8 undef, i8 addrspace(1)* %t2 - %t6 = load float addrspace(1)*, float addrspace(1)* addrspace(1)* undef - %t8 = bitcast float addrspace(1)* %t6 to i8 addrspace(1)* ; <i8*> [#uses=1] - %t9 = getelementptr inbounds i8, i8 addrspace(1)* %t8, i16 %t3 ; <i8*> [#uses=1] - store i8 undef, i8 addrspace(1)* %t9 - br label %bb14 -} - diff --git a/llvm/test/Transforms/LoopStrengthReduce/count-to-zero.ll b/llvm/test/Transforms/LoopStrengthReduce/count-to-zero.ll deleted file mode 100644 index ca93e38ab64..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/count-to-zero.ll +++ /dev/null @@ -1,45 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | FileCheck %s -; rdar://7382068 - -; Provide legal integer types. -target datalayout = "n8:16:32:64" - -define void @t(i32 %c) nounwind optsize { -entry: - br label %bb6 - -bb1: ; preds = %bb6 - %tmp = icmp eq i32 %c_addr.1, 20 ; <i1> [#uses=1] - br i1 %tmp, label %bb2, label %bb3 - -bb2: ; preds = %bb1 - %tmp1 = tail call i32 @f20(i32 %c_addr.1) nounwind ; <i32> [#uses=1] - br label %bb7 - -bb3: ; preds = %bb1 - %tmp2 = icmp slt i32 %c_addr.1, 10 ; <i1> [#uses=1] - %tmp3 = add nsw i32 %c_addr.1, 1 ; <i32> [#uses=1] - %tmp4 = add i32 %c_addr.1, -1 ; <i32> [#uses=1] - %c_addr.1.be = select i1 %tmp2, i32 %tmp3, i32 %tmp4 ; <i32> [#uses=1] - %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1] -; CHECK: add nsw i32 %lsr.iv, -1 - br label %bb6 - -bb6: ; preds = %bb3, %entry - %indvar = phi i32 [ %indvar.next, %bb3 ], [ 0, %entry ] ; <i32> [#uses=2] - %c_addr.1 = phi i32 [ %c_addr.1.be, %bb3 ], [ %c, %entry ] ; <i32> [#uses=7] - %tmp5 = icmp eq i32 %indvar, 9999 ; <i1> [#uses=1] -; CHECK: icmp eq i32 %lsr.iv, 0 - %tmp6 = icmp eq i32 %c_addr.1, 100 ; <i1> [#uses=1] - %or.cond = or i1 %tmp5, %tmp6 ; <i1> [#uses=1] - br i1 %or.cond, label %bb7, label %bb1 - -bb7: ; preds = %bb6, %bb2 - %c_addr.0 = phi i32 [ %tmp1, %bb2 ], [ %c_addr.1, %bb6 ] ; <i32> [#uses=1] - tail call void @bar(i32 %c_addr.0) nounwind - ret void -} - -declare i32 @f20(i32) - -declare void @bar(i32) diff --git a/llvm/test/Transforms/LoopStrengthReduce/dead-phi.ll b/llvm/test/Transforms/LoopStrengthReduce/dead-phi.ll deleted file mode 100644 index 07a942f70bd..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/dead-phi.ll +++ /dev/null @@ -1,21 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | grep phi | count 1 - -define void @foo(i32 %n) { -entry: - br label %loop - -loop: - %i = phi i32 [ 0, %entry ], [ %i.next, %loop ] - - ; These three instructions form an isolated cycle and can be deleted. - %j = phi i32 [ 0, %entry ], [ %j.y, %loop ] - %j.x = add i32 %j, 1 - %j.y = mul i32 %j.x, 2 - - %i.next = add i32 %i, 1 - %c = icmp ne i32 %i.next, %n - br i1 %c, label %loop, label %exit - -exit: - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/different-type-ivs.ll b/llvm/test/Transforms/LoopStrengthReduce/different-type-ivs.ll deleted file mode 100644 index c24f877a550..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/different-type-ivs.ll +++ /dev/null @@ -1,25 +0,0 @@ -; RUN: opt < %s -loop-reduce -disable-output -; Test to make sure that loop-reduce never crashes on IV's -; with different types but identical strides. - -define void @foo() { -entry: - br label %no_exit -no_exit: ; preds = %no_exit, %entry - %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %no_exit ] ; <i32> [#uses=3] - %indvar.upgrd.1 = trunc i32 %indvar to i16 ; <i16> [#uses=1] - %X.0.0 = mul i16 %indvar.upgrd.1, 1234 ; <i16> [#uses=1] - %tmp. = mul i32 %indvar, 1234 ; <i32> [#uses=1] - %tmp.5 = sext i16 %X.0.0 to i32 ; <i32> [#uses=1] - %tmp.3 = call i32 (...) @bar( i32 %tmp.5, i32 %tmp. ) ; <i32> [#uses=0] - %tmp.0 = call i1 @pred( ) ; <i1> [#uses=1] - %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1] - br i1 %tmp.0, label %return, label %no_exit -return: ; preds = %no_exit - ret void -} - -declare i1 @pred() - -declare i32 @bar(...) - diff --git a/llvm/test/Transforms/LoopStrengthReduce/dominate-assert.ll b/llvm/test/Transforms/LoopStrengthReduce/dominate-assert.ll deleted file mode 100644 index ff26c76b3c1..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/dominate-assert.ll +++ /dev/null @@ -1,113 +0,0 @@ -; RUN: opt -loop-reduce < %s -; we used to crash on this one - -declare i8* @_Znwm() -declare i32 @__gxx_personality_v0(...) -declare void @g() -define void @f() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { -bb0: - br label %bb1 -bb1: - %v0 = phi i64 [ 0, %bb0 ], [ %v1, %bb1 ] - %v1 = add nsw i64 %v0, 1 - br i1 undef, label %bb2, label %bb1 -bb2: - %v2 = icmp eq i64 %v0, 0 - br i1 %v2, label %bb6, label %bb3 -bb3: - %v3 = invoke noalias i8* @_Znwm() - to label %bb5 unwind label %bb4 -bb4: - %v4 = landingpad { i8*, i32 } - cleanup - br label %bb9 -bb5: - %v5 = bitcast i8* %v3 to i32** - %add.ptr.i = getelementptr inbounds i32*, i32** %v5, i64 %v0 - br label %bb6 -bb6: - %v6 = phi i32** [ null, %bb2 ], [ %add.ptr.i, %bb5 ] - invoke void @g() - to label %bb7 unwind label %bb8 -bb7: - unreachable -bb8: - %v7 = landingpad { i8*, i32 } - cleanup - br label %bb9 -bb9: - resume { i8*, i32 } zeroinitializer -} - - -define void @h() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { -bb1: - invoke void @g() optsize - to label %bb2 unwind label %bb5 -bb2: - %arrayctor.cur = phi i8* [ undef, %bb1 ], [ %arrayctor.next, %bb3 ] - invoke void @g() optsize - to label %bb3 unwind label %bb6 -bb3: - %arrayctor.next = getelementptr inbounds i8, i8* %arrayctor.cur, i64 1 - br label %bb2 -bb4: - ret void -bb5: - %tmp = landingpad { i8*, i32 } - cleanup - invoke void @g() optsize - to label %bb4 unwind label %bb7 -bb6: - %tmp1 = landingpad { i8*, i32 } - cleanup - %arraydestroy.isempty = icmp eq i8* undef, %arrayctor.cur - ret void -bb7: - %lpad.nonloopexit = landingpad { i8*, i32 } - catch i8* null - ret void -} - -; PR17425 -define void @i() { -entry: - br label %while.cond - -while.cond: ; preds = %while.cond, %entry - %c.0 = phi i16* [ undef, %entry ], [ %incdec.ptr, %while.cond ] - %incdec.ptr = getelementptr inbounds i16, i16* %c.0, i64 1 - br i1 undef, label %while.cond1, label %while.cond - -while.cond1: ; preds = %while.cond1, %while.cond - %c.1 = phi i16* [ %incdec.ptr5, %while.cond1 ], [ %c.0, %while.cond ] - %incdec.ptr5 = getelementptr inbounds i16, i16* %c.1, i64 1 - br i1 undef, label %while.cond7, label %while.cond1 - -while.cond7: ; preds = %while.cond7, %while.cond1 - %0 = phi i16* [ %incdec.ptr10, %while.cond7 ], [ %c.1, %while.cond1 ] - %incdec.ptr10 = getelementptr inbounds i16, i16* %0, i64 1 - br i1 undef, label %while.cond12.preheader, label %while.cond7 - -while.cond12.preheader: ; preds = %while.cond7 - br i1 undef, label %while.end16, label %while.body13.lr.ph - -while.body13: ; preds = %if.else, %while.body13.lr.ph - %1 = phi i16* [ %2, %while.body13.lr.ph ], [ %incdec.ptr15, %if.else ] - br i1 undef, label %while.cond12.outer.loopexit, label %if.else - -while.cond12.outer.loopexit: ; preds = %while.body13 - br i1 undef, label %while.end16, label %while.body13.lr.ph - -while.body13.lr.ph: ; preds = %while.cond12.outer.loopexit, %while.cond12.preheader - %2 = phi i16* [ %1, %while.cond12.outer.loopexit ], [ undef, %while.cond12.preheader ] - br label %while.body13 - -if.else: ; preds = %while.body13 - %incdec.ptr15 = getelementptr inbounds i16, i16* %1, i64 1 - %cmp = icmp eq i16* %incdec.ptr15, %0 - br i1 %cmp, label %while.end16, label %while.body13 - -while.end16: ; preds = %if.else, %while.cond12.outer.loopexit, %while.cond12.preheader - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/dont-hoist-simple-loop-constants.ll b/llvm/test/Transforms/LoopStrengthReduce/dont-hoist-simple-loop-constants.ll deleted file mode 100644 index 7b92acee5a9..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/dont-hoist-simple-loop-constants.ll +++ /dev/null @@ -1,23 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | \ -; RUN: not grep "bitcast i32 1 to i32" -; END. -; The setlt wants to use a value that is incremented one more than the dominant -; IV. Don't insert the 1 outside the loop, preventing folding it into the add. - -define void @test([700 x i32]* %nbeaux_.0__558, i32* %i_.16574) { -then.0: - br label %no_exit.2 -no_exit.2: ; preds = %no_exit.2, %then.0 - %indvar630 = phi i32 [ 0, %then.0 ], [ %indvar.next631, %no_exit.2 ] ; <i32> [#uses=4] - %gep.upgrd.1 = zext i32 %indvar630 to i64 ; <i64> [#uses=1] - %tmp.38 = getelementptr [700 x i32], [700 x i32]* %nbeaux_.0__558, i32 0, i64 %gep.upgrd.1 ; <i32*> [#uses=1] - store i32 0, i32* %tmp.38 - %inc.2 = add i32 %indvar630, 2 ; <i32> [#uses=2] - %tmp.34 = icmp slt i32 %inc.2, 701 ; <i1> [#uses=1] - %indvar.next631 = add i32 %indvar630, 1 ; <i32> [#uses=1] - br i1 %tmp.34, label %no_exit.2, label %loopexit.2.loopexit -loopexit.2.loopexit: ; preds = %no_exit.2 - store i32 %inc.2, i32* %i_.16574 - ret void -} - diff --git a/llvm/test/Transforms/LoopStrengthReduce/dont_insert_redundant_ops.ll b/llvm/test/Transforms/LoopStrengthReduce/dont_insert_redundant_ops.ll deleted file mode 100644 index 4a6ec50ab97..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/dont_insert_redundant_ops.ll +++ /dev/null @@ -1,40 +0,0 @@ -; Check that this test makes INDVAR and related stuff dead. -; RUN: opt < %s -loop-reduce -S | FileCheck %s - -; CHECK: phi -; CHECK: phi -; CHECK-NOT: phi - -declare i1 @pred() - -define void @test1({ i32, i32 }* %P) { -; <label>:0 - br label %Loop -Loop: ; preds = %Loop, %0 - %INDVAR = phi i32 [ 0, %0 ], [ %INDVAR2, %Loop ] ; <i32> [#uses=3] - %gep1 = getelementptr { i32, i32 }, { i32, i32 }* %P, i32 %INDVAR, i32 0 ; <i32*> [#uses=1] - store i32 0, i32* %gep1 - %gep2 = getelementptr { i32, i32 }, { i32, i32 }* %P, i32 %INDVAR, i32 1 ; <i32*> [#uses=1] - store i32 0, i32* %gep2 - %INDVAR2 = add i32 %INDVAR, 1 ; <i32> [#uses=1] - %cond = call i1 @pred( ) ; <i1> [#uses=1] - br i1 %cond, label %Loop, label %Out -Out: ; preds = %Loop - ret void -} - -define void @test2([2 x i32]* %P) { -; <label>:0 - br label %Loop -Loop: ; preds = %Loop, %0 - %INDVAR = phi i32 [ 0, %0 ], [ %INDVAR2, %Loop ] ; <i32> [#uses=3] - %gep1 = getelementptr [2 x i32], [2 x i32]* %P, i32 %INDVAR, i64 0 ; <i32*> [#uses=1] - store i32 0, i32* %gep1 - %gep2 = getelementptr [2 x i32], [2 x i32]* %P, i32 %INDVAR, i64 1 ; <i32*> [#uses=1] - store i32 0, i32* %gep2 - %INDVAR2 = add i32 %INDVAR, 1 ; <i32> [#uses=1] - %cond = call i1 @pred( ) ; <i1> [#uses=1] - br i1 %cond, label %Loop, label %Out -Out: ; preds = %Loop - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/dont_reduce_bytes.ll b/llvm/test/Transforms/LoopStrengthReduce/dont_reduce_bytes.ll deleted file mode 100644 index 4974f485d1c..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/dont_reduce_bytes.ll +++ /dev/null @@ -1,22 +0,0 @@ -; Don't reduce the byte access to P[i], at least not on targets that -; support an efficient 'mem[r1+r2]' addressing mode. - -; RUN: opt < %s -loop-reduce -disable-output - - -declare i1 @pred(i32) - -define void @test(i8* %PTR) { -; <label>:0 - br label %Loop -Loop: ; preds = %Loop, %0 - %INDVAR = phi i32 [ 0, %0 ], [ %INDVAR2, %Loop ] ; <i32> [#uses=2] - %STRRED = getelementptr i8, i8* %PTR, i32 %INDVAR ; <i8*> [#uses=1] - store i8 0, i8* %STRRED - %INDVAR2 = add i32 %INDVAR, 1 ; <i32> [#uses=2] - ;; cannot eliminate indvar - %cond = call i1 @pred( i32 %INDVAR2 ) ; <i1> [#uses=1] - br i1 %cond, label %Loop, label %Out -Out: ; preds = %Loop - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/dont_reverse.ll b/llvm/test/Transforms/LoopStrengthReduce/dont_reverse.ll deleted file mode 100644 index 551bd03f0ae..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/dont_reverse.ll +++ /dev/null @@ -1,25 +0,0 @@ -; RUN: opt < %s -loop-reduce -S \ -; RUN: | grep "icmp eq i2 %lsr.iv.next, %xmp4344" - -; Don't reverse the iteration if the rhs of the compare is defined -; inside the loop. - -; Provide legal integer types. -; Declare i2 as legal so that IVUsers accepts to consider %indvar3451 -target datalayout = "n2:8:16:32:64" - -define void @Fill_Buffer(i2* %p) nounwind { -entry: - br label %bb8 - -bb8: - %indvar34 = phi i32 [ 0, %entry ], [ %indvar.next35, %bb8 ] - %indvar3451 = trunc i32 %indvar34 to i2 - %xmp4344 = load i2, i2* %p - %xmp104 = icmp eq i2 %indvar3451, %xmp4344 - %indvar.next35 = add i32 %indvar34, 1 - br i1 %xmp104, label %bb10, label %bb8 - -bb10: - unreachable -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/ephemeral.ll b/llvm/test/Transforms/LoopStrengthReduce/ephemeral.ll deleted file mode 100644 index a0d1d44b1ba..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/ephemeral.ll +++ /dev/null @@ -1,41 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | FileCheck %s - -target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64" - -; for (int i = 0; i < n; ++i) { -; use(i * 5 + 3); -; // i * a + b is ephemeral and shouldn't be promoted by LSR -; __builtin_assume(i * a + b >= 0); -; } -define void @ephemeral(i32 %a, i32 %b, i32 %n) { -; CHECK-LABEL: @ephemeral( -entry: - br label %loop - -loop: - %i = phi i32 [ 0, %entry ], [ %inc, %loop ] - ; Only i and i * 5 + 3 should be indvars, not i * a + b. -; CHECK: phi i32 -; CHECK: phi i32 -; CHECK-NOT: phi i32 - %inc = add nsw i32 %i, 1 - %exitcond = icmp eq i32 %inc, %n - - %0 = mul nsw i32 %i, 5 - %1 = add nsw i32 %0, 3 - call void @use(i32 %1) - - %2 = mul nsw i32 %i, %a - %3 = add nsw i32 %2, %b - %4 = icmp sgt i32 %3, -1 - call void @llvm.assume(i1 %4) - - br i1 %exitcond, label %exit, label %loop - -exit: - ret void -} - -declare void @use(i32) - -declare void @llvm.assume(i1) diff --git a/llvm/test/Transforms/LoopStrengthReduce/exit_compare_live_range.ll b/llvm/test/Transforms/LoopStrengthReduce/exit_compare_live_range.ll deleted file mode 100644 index 498be1a9a1a..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/exit_compare_live_range.ll +++ /dev/null @@ -1,21 +0,0 @@ -; Make sure that the compare instruction occurs after the increment to avoid -; having overlapping live ranges that result in copies. We want the setcc -; instruction immediately before the conditional branch. -; -; RUN: opt -S -loop-reduce < %s | FileCheck %s - -define void @foo(float* %D, i32 %E) { -entry: - br label %no_exit -no_exit: ; preds = %no_exit, %entry - %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %no_exit ] ; <i32> [#uses=1] - store volatile float 0.000000e+00, float* %D - %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=2] -; CHECK: icmp -; CHECK-NEXT: br i1 - %exitcond = icmp eq i32 %indvar.next, %E ; <i1> [#uses=1] - br i1 %exitcond, label %loopexit, label %no_exit -loopexit: ; preds = %no_exit - ret void -} - diff --git a/llvm/test/Transforms/LoopStrengthReduce/funclet.ll b/llvm/test/Transforms/LoopStrengthReduce/funclet.ll deleted file mode 100644 index 1bee3706caf..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/funclet.ll +++ /dev/null @@ -1,245 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | FileCheck %s - -target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" -target triple = "i686-pc-windows-msvc" - -declare i32 @_except_handler3(...) -declare i32 @__CxxFrameHandler3(...) - -declare void @external(i32*) -declare void @reserve() - -define void @f() personality i32 (...)* @_except_handler3 { -entry: - br label %throw - -throw: ; preds = %throw, %entry - %tmp96 = getelementptr inbounds i8, i8* undef, i32 1 - invoke void @reserve() - to label %throw unwind label %pad - -pad: ; preds = %throw - %phi2 = phi i8* [ %tmp96, %throw ] - %cs = catchswitch within none [label %unreachable] unwind label %blah2 - -unreachable: - catchpad within %cs [] - unreachable - -blah2: - %cleanuppadi4.i.i.i = cleanuppad within none [] - br label %loop_body - -loop_body: ; preds = %iter, %pad - %tmp99 = phi i8* [ %tmp101, %iter ], [ %phi2, %blah2 ] - %tmp100 = icmp eq i8* %tmp99, undef - br i1 %tmp100, label %unwind_out, label %iter - -iter: ; preds = %loop_body - %tmp101 = getelementptr inbounds i8, i8* %tmp99, i32 1 - br i1 undef, label %unwind_out, label %loop_body - -unwind_out: ; preds = %iter, %loop_body - cleanupret from %cleanuppadi4.i.i.i unwind to caller -} - -; CHECK-LABEL: define void @f( -; CHECK: cleanuppad within none [] -; CHECK-NEXT: ptrtoint i8* %phi2 to i32 - -define void @g() personality i32 (...)* @_except_handler3 { -entry: - br label %throw - -throw: ; preds = %throw, %entry - %tmp96 = getelementptr inbounds i8, i8* undef, i32 1 - invoke void @reserve() - to label %throw unwind label %pad - -pad: - %phi2 = phi i8* [ %tmp96, %throw ] - %cs = catchswitch within none [label %unreachable, label %blah] unwind to caller - -unreachable: - catchpad within %cs [] - unreachable - -blah: - %catchpad = catchpad within %cs [] - br label %loop_body - -unwind_out: - catchret from %catchpad to label %leave - -leave: - ret void - -loop_body: ; preds = %iter, %pad - %tmp99 = phi i8* [ %tmp101, %iter ], [ %phi2, %blah ] - %tmp100 = icmp eq i8* %tmp99, undef - br i1 %tmp100, label %unwind_out, label %iter - -iter: ; preds = %loop_body - %tmp101 = getelementptr inbounds i8, i8* %tmp99, i32 1 - br i1 undef, label %unwind_out, label %loop_body -} - -; CHECK-LABEL: define void @g( -; CHECK: blah: -; CHECK-NEXT: catchpad within %cs [] -; CHECK-NEXT: ptrtoint i8* %phi2 to i32 - - -define void @h() personality i32 (...)* @_except_handler3 { -entry: - br label %throw - -throw: ; preds = %throw, %entry - %tmp96 = getelementptr inbounds i8, i8* undef, i32 1 - invoke void @reserve() - to label %throw unwind label %pad - -pad: - %cs = catchswitch within none [label %unreachable, label %blug] unwind to caller - -unreachable: - catchpad within %cs [] - unreachable - -blug: - %phi2 = phi i8* [ %tmp96, %pad ] - %catchpad = catchpad within %cs [] - br label %loop_body - -unwind_out: - catchret from %catchpad to label %leave - -leave: - ret void - -loop_body: ; preds = %iter, %pad - %tmp99 = phi i8* [ %tmp101, %iter ], [ %phi2, %blug ] - %tmp100 = icmp eq i8* %tmp99, undef - br i1 %tmp100, label %unwind_out, label %iter - -iter: ; preds = %loop_body - %tmp101 = getelementptr inbounds i8, i8* %tmp99, i32 1 - br i1 undef, label %unwind_out, label %loop_body -} - -; CHECK-LABEL: define void @h( -; CHECK: blug: -; CHECK: catchpad within %cs [] -; CHECK-NEXT: ptrtoint i8* %phi2 to i32 - -define void @i() personality i32 (...)* @_except_handler3 { -entry: - br label %throw - -throw: ; preds = %throw, %entry - %tmp96 = getelementptr inbounds i8, i8* undef, i32 1 - invoke void @reserve() - to label %throw unwind label %catchpad - -catchpad: ; preds = %throw - %phi2 = phi i8* [ %tmp96, %throw ] - %cs = catchswitch within none [label %cp_body] unwind label %cleanuppad - -cp_body: - catchpad within %cs [] - br label %loop_head - -cleanuppad: - cleanuppad within none [] - br label %loop_head - -loop_head: - br label %loop_body - -loop_body: ; preds = %iter, %catchpad - %tmp99 = phi i8* [ %tmp101, %iter ], [ %phi2, %loop_head ] - %tmp100 = icmp eq i8* %tmp99, undef - br i1 %tmp100, label %unwind_out, label %iter - -iter: ; preds = %loop_body - %tmp101 = getelementptr inbounds i8, i8* %tmp99, i32 1 - br i1 undef, label %unwind_out, label %loop_body - -unwind_out: ; preds = %iter, %loop_body - unreachable -} - -; CHECK-LABEL: define void @i( -; CHECK: ptrtoint i8* %phi2 to i32 - -define void @test1(i32* %b, i32* %c) personality i32 (...)* @__CxxFrameHandler3 { -entry: - br label %for.cond - -for.cond: ; preds = %for.inc, %entry - %d.0 = phi i32* [ %b, %entry ], [ %incdec.ptr, %for.inc ] - invoke void @external(i32* %d.0) - to label %for.inc unwind label %catch.dispatch - -for.inc: ; preds = %for.cond - %incdec.ptr = getelementptr inbounds i32, i32* %d.0, i32 1 - br label %for.cond - -catch.dispatch: ; preds = %for.cond - %cs = catchswitch within none [label %catch] unwind label %catch.dispatch.2 - -catch: ; preds = %catch.dispatch - %0 = catchpad within %cs [i8* null, i32 64, i8* null] - catchret from %0 to label %try.cont - -try.cont: ; preds = %catch - invoke void @external(i32* %c) - to label %try.cont.7 unwind label %catch.dispatch.2 - -catch.dispatch.2: ; preds = %try.cont, %catchendblock - %e.0 = phi i32* [ %c, %try.cont ], [ %b, %catch.dispatch ] - %cs2 = catchswitch within none [label %catch.4] unwind to caller - -catch.4: ; preds = %catch.dispatch.2 - catchpad within %cs2 [i8* null, i32 64, i8* null] - unreachable - -try.cont.7: ; preds = %try.cont - ret void -} - -; CHECK-LABEL: define void @test1( -; CHECK: for.cond: -; CHECK: %d.0 = phi i32* [ %b, %entry ], [ %incdec.ptr, %for.inc ] - -; CHECK: catch.dispatch.2: -; CHECK: %e.0 = phi i32* [ %c, %try.cont ], [ %b, %catch.dispatch ] - -define i32 @test2() personality i32 (...)* @_except_handler3 { -entry: - br label %for.body - -for.body: ; preds = %for.inc, %entry - %phi = phi i32 [ %inc, %for.inc ], [ 0, %entry ] - invoke void @reserve() - to label %for.inc unwind label %catch.dispatch - -catch.dispatch: ; preds = %for.body - %tmp18 = catchswitch within none [label %catch.handler] unwind to caller - -catch.handler: ; preds = %catch.dispatch - %phi.lcssa = phi i32 [ %phi, %catch.dispatch ] - %tmp19 = catchpad within %tmp18 [i8* null] - catchret from %tmp19 to label %done - -done: - ret i32 %phi.lcssa - -for.inc: ; preds = %for.body - %inc = add i32 %phi, 1 - br label %for.body -} - -; CHECK-LABEL: define i32 @test2( -; CHECK: %phi.lcssa = phi i32 [ %phi, %catch.dispatch ] -; CHECK-NEXT: catchpad within diff --git a/llvm/test/Transforms/LoopStrengthReduce/hoist-parent-preheader.ll b/llvm/test/Transforms/LoopStrengthReduce/hoist-parent-preheader.ll deleted file mode 100644 index 27371b56e61..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/hoist-parent-preheader.ll +++ /dev/null @@ -1,32 +0,0 @@ -; RUN: opt < %s -loop-reduce -verify -target triple = "x86_64-apple-darwin10" - -define void @myquicksort(i8* %a) nounwind ssp { -entry: - br i1 undef, label %loop1, label %return - -loop1: ; preds = %bb13.loopexit, %entry - %indvar419 = phi i64 [ %indvar.next420, %loop2.exit ], [ 0, %entry ] - %tmp474 = shl i64 %indvar419, 2 - %tmp484 = add i64 %tmp474, 4 - br label %loop2 - -loop2: ; preds = %loop1, %loop2.backedge - %indvar414 = phi i64 [ %indvar.next415, %loop2.backedge ], [ 0, %loop1 ] - %tmp473 = mul i64 %indvar414, -4 - %tmp485 = add i64 %tmp484, %tmp473 - %storemerge4 = getelementptr i8, i8* %a, i64 %tmp485 - %0 = icmp ugt i8* %storemerge4, %a - br i1 false, label %loop2.exit, label %loop2.backedge - -loop2.backedge: ; preds = %loop2 - %indvar.next415 = add i64 %indvar414, 1 - br label %loop2 - -loop2.exit: ; preds = %loop2 - %indvar.next420 = add i64 %indvar419, 1 - br i1 undef, label %loop1, label %return - -return: ; preds = %loop2.exit, %entry - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/illegal-addr-modes.ll b/llvm/test/Transforms/LoopStrengthReduce/illegal-addr-modes.ll deleted file mode 100644 index cb17d587961..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/illegal-addr-modes.ll +++ /dev/null @@ -1,122 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | FileCheck %s - -target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" -target triple = "thumbv6m-arm-none-eabi" - -; These are regression tests for -; https://bugs.llvm.org/show_bug.cgi?id=34106 -; "ARMTargetLowering::isLegalAddressingMode can accept incorrect -; addressing modes for Thumb1 target" -; https://reviews.llvm.org/D34583 -; "[LSR] Narrow search space by filtering non-optimal formulae with the -; same ScaledReg and Scale." -; -; Due to a bug in ARMTargetLowering::isLegalAddressingMode LSR got -; 4*reg({0,+,-1}) and -4*reg({0,+,-1}) had the same cost for the Thumb1 target. -; Another issue was that LSR got that -1*reg was free for the Thumb1 target. - -; Test case 01: -1*reg is not free for the Thumb1 target. -; -; CHECK-LABEL: @negativeOneCase -; CHECK-NOT: mul -; CHECK: ret i8 -define i8* @negativeOneCase(i8* returned %a, i8* nocapture readonly %b, i32 %n) nounwind { -entry: - %add.ptr = getelementptr inbounds i8, i8* %a, i32 -1 - br label %while.cond - -while.cond: ; preds = %while.cond, %entry - %p.0 = phi i8* [ %add.ptr, %entry ], [ %incdec.ptr, %while.cond ] - %incdec.ptr = getelementptr inbounds i8, i8* %p.0, i32 1 - %0 = load i8, i8* %incdec.ptr, align 1 - %cmp = icmp eq i8 %0, 0 - br i1 %cmp, label %while.cond2.preheader, label %while.cond - -while.cond2.preheader: ; preds = %while.cond - br label %while.cond2 - -while.cond2: ; preds = %while.cond2.preheader, %while.body5 - %b.addr.0 = phi i8* [ %incdec.ptr6, %while.body5 ], [ %b, %while.cond2.preheader ] - %n.addr.0 = phi i32 [ %dec, %while.body5 ], [ %n, %while.cond2.preheader ] - %p.1 = phi i8* [ %incdec.ptr7, %while.body5 ], [ %incdec.ptr, %while.cond2.preheader ] - %cmp3 = icmp eq i32 %n.addr.0, 0 - br i1 %cmp3, label %while.end8, label %while.body5 - -while.body5: ; preds = %while.cond2 - %dec = add i32 %n.addr.0, -1 - %incdec.ptr6 = getelementptr inbounds i8, i8* %b.addr.0, i32 1 - %1 = load i8, i8* %b.addr.0, align 1 - %incdec.ptr7 = getelementptr inbounds i8, i8* %p.1, i32 1 - store i8 %1, i8* %p.1, align 1 - br label %while.cond2 - -while.end8: ; preds = %while.cond2 - %scevgep = getelementptr i8, i8* %incdec.ptr, i32 %n - store i8 0, i8* %scevgep, align 1 - ret i8* %a -} - -; Test case 02: 4*reg({0,+,-1}) and -4*reg({0,+,-1}) are not supported for -; the Thumb1 target. -; -; CHECK-LABEL: @negativeFourCase -; CHECK-NOT: mul -; CHECK: ret void -define void @negativeFourCase(i8* %ptr1, i32* %ptr2) nounwind { -entry: - br label %for.cond6.preheader.us.i.i - -for.cond6.preheader.us.i.i: ; preds = %if.end48.us.i.i, %entry - %addr.0108.us.i.i = phi i8* [ %scevgep.i.i, %if.end48.us.i.i ], [ %ptr1, %entry ] - %inc49.us.i.i = phi i32 [ %inc50.us.i.i, %if.end48.us.i.i ], [ 0, %entry ] - %c1.0104.us.i.i = phi i32* [ %c0.0103.us.i.i, %if.end48.us.i.i ], [ %ptr2, %entry ] - %c0.0103.us.i.i = phi i32* [ %c1.0104.us.i.i, %if.end48.us.i.i ], [ %ptr2, %entry ] - br label %for.body8.us.i.i - -if.end48.us.i.i: ; preds = %for.inc.us.i.i - %scevgep.i.i = getelementptr i8, i8* %addr.0108.us.i.i, i32 256 - %inc50.us.i.i = add nuw nsw i32 %inc49.us.i.i, 1 - %exitcond110.i.i = icmp eq i32 %inc50.us.i.i, 256 - br i1 %exitcond110.i.i, label %exit.i, label %for.cond6.preheader.us.i.i - -for.body8.us.i.i: ; preds = %for.inc.us.i.i, %for.cond6.preheader.us.i.i - %addr.198.us.i.i = phi i8* [ %addr.0108.us.i.i, %for.cond6.preheader.us.i.i ], [ %incdec.ptr.us.i.i, %for.inc.us.i.i ] - %inc.196.us.i.i = phi i32 [ 0, %for.cond6.preheader.us.i.i ], [ %inc.2.us.i.i, %for.inc.us.i.i ] - %c.093.us.i.i = phi i32 [ 0, %for.cond6.preheader.us.i.i ], [ %inc43.us.i.i, %for.inc.us.i.i ] - %incdec.ptr.us.i.i = getelementptr inbounds i8, i8* %addr.198.us.i.i, i32 1 - %0 = load i8, i8* %addr.198.us.i.i, align 1 - %cmp9.us.i.i = icmp eq i8 %0, -1 - br i1 %cmp9.us.i.i, label %if.end37.us.i.i, label %if.else.us.i.i - -if.else.us.i.i: ; preds = %for.body8.us.i.i - %add12.us.i.i = add nuw nsw i32 %c.093.us.i.i, 1 - %arrayidx13.us.i.i = getelementptr inbounds i32, i32* %c1.0104.us.i.i, i32 %add12.us.i.i - %1 = load i32, i32* %arrayidx13.us.i.i, align 4 - %arrayidx16.us.i.i = getelementptr inbounds i32, i32* %c1.0104.us.i.i, i32 %c.093.us.i.i - %2 = load i32, i32* %arrayidx16.us.i.i, align 4 - %sub19.us.i.i = add nsw i32 %c.093.us.i.i, -1 - %arrayidx20.us.i.i = getelementptr inbounds i32, i32* %c1.0104.us.i.i, i32 %sub19.us.i.i - %3 = load i32, i32* %arrayidx20.us.i.i, align 4 - br label %if.end37.us.i.i - -if.end37.us.i.i: ; preds = %if.else.us.i.i, %for.body8.us.i.i - %4 = phi i32 [ %3, %if.else.us.i.i ], [ 0, %for.body8.us.i.i ] - %arrayidx36.us.i.i = getelementptr inbounds i32, i32* %c0.0103.us.i.i, i32 %c.093.us.i.i - store i32 %4, i32* %arrayidx36.us.i.i, align 4 - %inc.us.i.i = add nsw i32 %inc.196.us.i.i, 1 - %cmp38.us.i.i = icmp sgt i32 %inc.196.us.i.i, 6 - br i1 %cmp38.us.i.i, label %if.then40.us.i.i, label %for.inc.us.i.i - -if.then40.us.i.i: ; preds = %if.end37.us.i.i - br label %for.inc.us.i.i - -for.inc.us.i.i: ; preds = %if.then40.us.i.i, %if.end37.us.i.i - %inc.2.us.i.i = phi i32 [ 0, %if.then40.us.i.i ], [ %inc.us.i.i, %if.end37.us.i.i ] - %inc43.us.i.i = add nuw nsw i32 %c.093.us.i.i, 1 - %exitcond.i.i = icmp eq i32 %inc43.us.i.i, 256 - br i1 %exitcond.i.i, label %if.end48.us.i.i, label %for.body8.us.i.i - -exit.i: ; preds = %if.end48.us.i.i - ret void -} - diff --git a/llvm/test/Transforms/LoopStrengthReduce/invariant_value_first.ll b/llvm/test/Transforms/LoopStrengthReduce/invariant_value_first.ll deleted file mode 100644 index 4d59ca9869c..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/invariant_value_first.ll +++ /dev/null @@ -1,24 +0,0 @@ -; Check that the index of 'P[outer]' is pulled out of the loop. -; RUN: opt < %s -loop-reduce -S | \ -; RUN: not grep "getelementptr.*%outer.*%INDVAR" - -target datalayout = "e-p:32:32:32-n8:16:32" -declare i1 @pred() - -declare i32 @foo() - -define void @test([10000 x i32]* %P) { -; <label>:0 - %outer = call i32 @foo( ) ; <i32> [#uses=1] - br label %Loop -Loop: ; preds = %Loop, %0 - %INDVAR = phi i32 [ 0, %0 ], [ %INDVAR2, %Loop ] ; <i32> [#uses=2] - %STRRED = getelementptr [10000 x i32], [10000 x i32]* %P, i32 %outer, i32 %INDVAR ; <i32*> [#uses=1] - store i32 0, i32* %STRRED - %INDVAR2 = add i32 %INDVAR, 1 ; <i32> [#uses=1] - %cond = call i1 @pred( ) ; <i1> [#uses=1] - br i1 %cond, label %Loop, label %Out -Out: ; preds = %Loop - ret void -} - diff --git a/llvm/test/Transforms/LoopStrengthReduce/invariant_value_first_arg.ll b/llvm/test/Transforms/LoopStrengthReduce/invariant_value_first_arg.ll deleted file mode 100644 index 57716408a29..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/invariant_value_first_arg.ll +++ /dev/null @@ -1,21 +0,0 @@ -; Check that the index of 'P[outer]' is pulled out of the loop. -; RUN: opt < %s -loop-reduce -S | \ -; RUN: not grep "getelementptr.*%outer.*%INDVAR" - -target datalayout = "e-p:32:32:32-n32" -declare i1 @pred() - -define void @test([10000 x i32]* %P, i32 %outer) { -; <label>:0 - br label %Loop -Loop: ; preds = %Loop, %0 - %INDVAR = phi i32 [ 0, %0 ], [ %INDVAR2, %Loop ] ; <i32> [#uses=2] - %STRRED = getelementptr [10000 x i32], [10000 x i32]* %P, i32 %outer, i32 %INDVAR ; <i32*> [#uses=1] - store i32 0, i32* %STRRED - %INDVAR2 = add i32 %INDVAR, 1 ; <i32> [#uses=1] - %cond = call i1 @pred( ) ; <i1> [#uses=1] - br i1 %cond, label %Loop, label %Out -Out: ; preds = %Loop - ret void -} - diff --git a/llvm/test/Transforms/LoopStrengthReduce/ivchain.ll b/llvm/test/Transforms/LoopStrengthReduce/ivchain.ll deleted file mode 100644 index 52faddea94a..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/ivchain.ll +++ /dev/null @@ -1,48 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | FileCheck %s -; RUN: opt -passes='require<scalar-evolution>,require<targetir>,loop(strength-reduce)' < %s -S | FileCheck %s -; -; PR11782: bad cast to AddRecExpr. -; A sign extend feeds an IVUser and cannot be hoisted into the AddRec. -; CollectIVChains should bailout on this case. - - -; Provide legal integer types. -target datalayout = "n8:16:32:64" - -%struct = type { i8*, i8*, i16, i64, i16, i16, i16, i64, i64, i16, i8*, i64, i64, i64 } - -; CHECK-LABEL: @test( -; CHECK: for.body: -; CHECK: lsr.iv = phi %struct -; CHECK: br -define i32 @test(i8* %h, i32 %more) nounwind uwtable { -entry: - br i1 undef, label %land.end238, label %return - -land.end238: ; preds = %if.end229 - br label %for.body - -for.body: ; preds = %sw.epilog, %land.end238 - %fbh.0 = phi %struct* [ undef, %land.end238 ], [ %incdec.ptr, %sw.epilog ] - %column_n.0 = phi i16 [ 0, %land.end238 ], [ %inc601, %sw.epilog ] - %conv250 = sext i16 %column_n.0 to i32 - %add257 = add nsw i32 %conv250, 1 - %conv258 = trunc i32 %add257 to i16 - %cmp263 = icmp ult i16 undef, 2 - br label %if.end388 - -if.end388: ; preds = %if.then380, %if.else356 - %ColLength = getelementptr inbounds %struct, %struct* %fbh.0, i64 0, i32 7 - %call405 = call signext i16 @SQLColAttribute(i8* undef, i16 zeroext %conv258, i16 zeroext 1003, i8* null, i16 signext 0, i16* null, i64* %ColLength) nounwind - br label %sw.epilog - -sw.epilog: ; preds = %sw.bb542, %sw.bb523, %if.end475 - %inc601 = add i16 %column_n.0, 1 - %incdec.ptr = getelementptr inbounds %struct, %struct* %fbh.0, i64 1 - br label %for.body - -return: ; preds = %entry - ret i32 1 -} - -declare signext i16 @SQLColAttribute(i8*, i16 zeroext, i16 zeroext, i8*, i16 signext, i16*, i64*) diff --git a/llvm/test/Transforms/LoopStrengthReduce/lsr-comp-time.ll b/llvm/test/Transforms/LoopStrengthReduce/lsr-comp-time.ll deleted file mode 100644 index 6221c4a2b04..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/lsr-comp-time.ll +++ /dev/null @@ -1,1338 +0,0 @@ -; RUN: opt -loop-reduce -S < %s | FileCheck %s -; RUN: opt -loop-reduce -lsr-complexity-limit=2147483647 -S < %s | FileCheck %s - -; Test compile time should be <1sec (no hang). -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" - -; Function Attrs: argmemonly nounwind -declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1 - -; Function Attrs: argmemonly nounwind -declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1 - -; Function Attrs: nounwind readnone uwtable -define dso_local i32 @foo(i32 %arg, i32 %arg1, i32 %arg2, i32 %arg3, i32 %arg4, i32 %arg5, i32 %arg6) local_unnamed_addr #3 { -; CHECK-LABEL: @foo( -; CHECK: bb33: -; CHECK: lsr.iv -; CHECK: bb58: -; CHECK: lsr.iv -; CHECK: bb81: -; CHECK: lsr.iv -; CHECK: bb104: -; CHECK: lsr.iv -; CHECK: bb127: -; CHECK: lsr.iv -; CHECK: bb150: -; CHECK: lsr.iv -; CHECK: bb173: -; CHECK: lsr.iv -; CHECK: bb196: -; CHECK: lsr.iv -; CHECK: bb219: -; CHECK: lsr.iv -; CHECK: bb242: -; CHECK: lsr.iv -; CHECK: bb265: -; CHECK: lsr.iv -; CHECK: bb288: -; CHECK: lsr.iv -; CHECK: bb311: -; CHECK: lsr.iv -; CHECK: bb340: -; CHECK: lsr.iv -; CHECK: bb403: -; CHECK: lsr.iv -; CHECK: bb433: -; CHECK: lsr.iv -; CHECK: bb567: -; CHECK: lsr.iv -; CHECK: bb611: -; CHECK: lsr.iv -; CHECK: bb655: -; CHECK: lsr.iv -; CHECK: bb699: -; CHECK: lsr.iv -; CHECK: bb743: -; CHECK: lsr.iv -; CHECK: bb787: -; CHECK: lsr.iv -; CHECK: bb831: -; CHECK: lsr.iv -; CHECK: bb875: -; CHECK: lsr.iv -; CHECK: bb919: -; CHECK: lsr.iv -; CHECK: bb963: -; CHECK: lsr.iv -; CHECK: bb1007: -; CHECK: lsr.iv -; CHECK: ret -; -bb: - %tmp = alloca [100 x i32], align 16 - %tmp7 = alloca [100 x i32], align 16 - %tmp8 = alloca [100 x i32], align 16 - %tmp9 = alloca [100 x [100 x i32]], align 16 - %tmp10 = alloca [100 x i32], align 16 - %tmp11 = alloca [100 x [100 x i32]], align 16 - %tmp12 = alloca [100 x i32], align 16 - %tmp13 = alloca [100 x i32], align 16 - %tmp14 = alloca [100 x [100 x i32]], align 16 - %tmp15 = alloca [100 x i32], align 16 - %tmp16 = alloca [100 x [100 x i32]], align 16 - %tmp17 = alloca [100 x [100 x i32]], align 16 - %tmp18 = alloca [100 x [100 x i32]], align 16 - %tmp19 = bitcast [100 x i32]* %tmp to i8* - call void @llvm.lifetime.start.p0i8(i64 400, i8* nonnull %tmp19) #4 - call void @llvm.memset.p0i8.i64(i8* nonnull align 16 %tmp19, i8 0, i64 400, i1 false) - %tmp20 = bitcast [100 x i32]* %tmp7 to i8* - call void @llvm.lifetime.start.p0i8(i64 400, i8* nonnull %tmp20) #4 - call void @llvm.memset.p0i8.i64(i8* nonnull align 16 %tmp20, i8 0, i64 400, i1 false) - %tmp21 = bitcast [100 x i32]* %tmp8 to i8* - call void @llvm.lifetime.start.p0i8(i64 400, i8* nonnull %tmp21) #4 - call void @llvm.memset.p0i8.i64(i8* nonnull align 16 %tmp21, i8 0, i64 400, i1 false) - %tmp22 = bitcast [100 x [100 x i32]]* %tmp9 to i8* - call void @llvm.lifetime.start.p0i8(i64 40000, i8* nonnull %tmp22) #4 - call void @llvm.memset.p0i8.i64(i8* nonnull align 16 %tmp22, i8 0, i64 40000, i1 false) - %tmp23 = bitcast [100 x i32]* %tmp10 to i8* - call void @llvm.lifetime.start.p0i8(i64 400, i8* nonnull %tmp23) #4 - call void @llvm.memset.p0i8.i64(i8* nonnull align 16 %tmp23, i8 0, i64 400, i1 false) - %tmp24 = bitcast [100 x [100 x i32]]* %tmp11 to i8* - call void @llvm.lifetime.start.p0i8(i64 40000, i8* nonnull %tmp24) #4 - call void @llvm.memset.p0i8.i64(i8* nonnull align 16 %tmp24, i8 0, i64 40000, i1 false) - %tmp25 = bitcast [100 x i32]* %tmp12 to i8* - call void @llvm.lifetime.start.p0i8(i64 400, i8* nonnull %tmp25) #4 - call void @llvm.memset.p0i8.i64(i8* nonnull align 16 %tmp25, i8 0, i64 400, i1 false) - %tmp26 = bitcast [100 x i32]* %tmp13 to i8* - call void @llvm.lifetime.start.p0i8(i64 400, i8* nonnull %tmp26) #4 - call void @llvm.memset.p0i8.i64(i8* nonnull align 16 %tmp26, i8 0, i64 400, i1 false) - %tmp27 = bitcast [100 x [100 x i32]]* %tmp14 to i8* - call void @llvm.lifetime.start.p0i8(i64 40000, i8* nonnull %tmp27) #4 - call void @llvm.memset.p0i8.i64(i8* nonnull align 16 %tmp27, i8 0, i64 40000, i1 false) - %tmp28 = bitcast [100 x i32]* %tmp15 to i8* - call void @llvm.lifetime.start.p0i8(i64 400, i8* nonnull %tmp28) #4 - call void @llvm.memset.p0i8.i64(i8* nonnull align 16 %tmp28, i8 0, i64 400, i1 false) - %tmp29 = bitcast [100 x [100 x i32]]* %tmp16 to i8* - call void @llvm.lifetime.start.p0i8(i64 40000, i8* nonnull %tmp29) #4 - call void @llvm.memset.p0i8.i64(i8* nonnull align 16 %tmp29, i8 0, i64 40000, i1 false) - %tmp30 = bitcast [100 x [100 x i32]]* %tmp17 to i8* - call void @llvm.lifetime.start.p0i8(i64 40000, i8* nonnull %tmp30) #4 - call void @llvm.memset.p0i8.i64(i8* nonnull align 16 %tmp30, i8 0, i64 40000, i1 false) - %tmp31 = bitcast [100 x [100 x i32]]* %tmp18 to i8* - call void @llvm.lifetime.start.p0i8(i64 40000, i8* nonnull %tmp31) #4 - call void @llvm.memset.p0i8.i64(i8* nonnull align 16 %tmp31, i8 0, i64 40000, i1 false) - %tmp32 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp8, i64 0, i64 3 - br label %bb33 - -bb33: ; preds = %bb33, %bb - %tmp34 = phi i64 [ 0, %bb ], [ %tmp54, %bb33 ] - %tmp35 = trunc i64 %tmp34 to i32 - %tmp36 = add i32 %tmp35, 48 - %tmp37 = urem i32 %tmp36, 101 - %tmp38 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 %tmp34 - store i32 %tmp37, i32* %tmp38, align 16 - %tmp39 = or i64 %tmp34, 1 - %tmp40 = trunc i64 %tmp39 to i32 - %tmp41 = sub i32 48, %tmp40 - %tmp42 = urem i32 %tmp41, 101 - %tmp43 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 %tmp39 - store i32 %tmp42, i32* %tmp43, align 4 - %tmp44 = or i64 %tmp34, 2 - %tmp45 = trunc i64 %tmp44 to i32 - %tmp46 = add i32 %tmp45, 48 - %tmp47 = urem i32 %tmp46, 101 - %tmp48 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 %tmp44 - store i32 %tmp47, i32* %tmp48, align 8 - %tmp49 = or i64 %tmp34, 3 - %tmp50 = trunc i64 %tmp49 to i32 - %tmp51 = sub i32 48, %tmp50 - %tmp52 = urem i32 %tmp51, 101 - %tmp53 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 %tmp49 - store i32 %tmp52, i32* %tmp53, align 4 - %tmp54 = add nuw nsw i64 %tmp34, 4 - %tmp55 = icmp eq i64 %tmp54, 100 - br i1 %tmp55, label %bb56, label %bb33 - -bb56: ; preds = %bb33 - %tmp57 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp16, i64 0, i64 88, i64 91 - br label %bb58 - -bb58: ; preds = %bb58, %bb56 - %tmp59 = phi i64 [ 0, %bb56 ], [ %tmp79, %bb58 ] - %tmp60 = trunc i64 %tmp59 to i32 - %tmp61 = add i32 %tmp60, 83 - %tmp62 = urem i32 %tmp61, 101 - %tmp63 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp7, i64 0, i64 %tmp59 - store i32 %tmp62, i32* %tmp63, align 16 - %tmp64 = or i64 %tmp59, 1 - %tmp65 = trunc i64 %tmp64 to i32 - %tmp66 = sub i32 83, %tmp65 - %tmp67 = urem i32 %tmp66, 101 - %tmp68 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp7, i64 0, i64 %tmp64 - store i32 %tmp67, i32* %tmp68, align 4 - %tmp69 = or i64 %tmp59, 2 - %tmp70 = trunc i64 %tmp69 to i32 - %tmp71 = add i32 %tmp70, 83 - %tmp72 = urem i32 %tmp71, 101 - %tmp73 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp7, i64 0, i64 %tmp69 - store i32 %tmp72, i32* %tmp73, align 8 - %tmp74 = or i64 %tmp59, 3 - %tmp75 = trunc i64 %tmp74 to i32 - %tmp76 = sub i32 83, %tmp75 - %tmp77 = urem i32 %tmp76, 101 - %tmp78 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp7, i64 0, i64 %tmp74 - store i32 %tmp77, i32* %tmp78, align 4 - %tmp79 = add nuw nsw i64 %tmp59, 4 - %tmp80 = icmp eq i64 %tmp79, 100 - br i1 %tmp80, label %bb81, label %bb58 - -bb81: ; preds = %bb81, %bb58 - %tmp82 = phi i64 [ %tmp102, %bb81 ], [ 0, %bb58 ] - %tmp83 = trunc i64 %tmp82 to i32 - %tmp84 = add i32 %tmp83, 15 - %tmp85 = urem i32 %tmp84, 101 - %tmp86 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp8, i64 0, i64 %tmp82 - store i32 %tmp85, i32* %tmp86, align 16 - %tmp87 = or i64 %tmp82, 1 - %tmp88 = trunc i64 %tmp87 to i32 - %tmp89 = sub i32 15, %tmp88 - %tmp90 = urem i32 %tmp89, 101 - %tmp91 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp8, i64 0, i64 %tmp87 - store i32 %tmp90, i32* %tmp91, align 4 - %tmp92 = or i64 %tmp82, 2 - %tmp93 = trunc i64 %tmp92 to i32 - %tmp94 = add i32 %tmp93, 15 - %tmp95 = urem i32 %tmp94, 101 - %tmp96 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp8, i64 0, i64 %tmp92 - store i32 %tmp95, i32* %tmp96, align 8 - %tmp97 = or i64 %tmp82, 3 - %tmp98 = trunc i64 %tmp97 to i32 - %tmp99 = sub i32 15, %tmp98 - %tmp100 = urem i32 %tmp99, 101 - %tmp101 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp8, i64 0, i64 %tmp97 - store i32 %tmp100, i32* %tmp101, align 4 - %tmp102 = add nuw nsw i64 %tmp82, 4 - %tmp103 = icmp eq i64 %tmp102, 100 - br i1 %tmp103, label %bb104, label %bb81 - -bb104: ; preds = %bb104, %bb81 - %tmp105 = phi i64 [ %tmp125, %bb104 ], [ 0, %bb81 ] - %tmp106 = trunc i64 %tmp105 to i32 - %tmp107 = add i32 %tmp106, 60 - %tmp108 = urem i32 %tmp107, 101 - %tmp109 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp9, i64 0, i64 0, i64 %tmp105 - store i32 %tmp108, i32* %tmp109, align 16 - %tmp110 = or i64 %tmp105, 1 - %tmp111 = trunc i64 %tmp110 to i32 - %tmp112 = sub i32 60, %tmp111 - %tmp113 = urem i32 %tmp112, 101 - %tmp114 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp9, i64 0, i64 0, i64 %tmp110 - store i32 %tmp113, i32* %tmp114, align 4 - %tmp115 = or i64 %tmp105, 2 - %tmp116 = trunc i64 %tmp115 to i32 - %tmp117 = add i32 %tmp116, 60 - %tmp118 = urem i32 %tmp117, 101 - %tmp119 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp9, i64 0, i64 0, i64 %tmp115 - store i32 %tmp118, i32* %tmp119, align 8 - %tmp120 = or i64 %tmp105, 3 - %tmp121 = trunc i64 %tmp120 to i32 - %tmp122 = sub i32 60, %tmp121 - %tmp123 = urem i32 %tmp122, 101 - %tmp124 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp9, i64 0, i64 0, i64 %tmp120 - store i32 %tmp123, i32* %tmp124, align 4 - %tmp125 = add nuw nsw i64 %tmp105, 4 - %tmp126 = icmp eq i64 %tmp125, 10000 - br i1 %tmp126, label %bb127, label %bb104 - -bb127: ; preds = %bb127, %bb104 - %tmp128 = phi i64 [ %tmp148, %bb127 ], [ 0, %bb104 ] - %tmp129 = trunc i64 %tmp128 to i32 - %tmp130 = add i32 %tmp129, 87 - %tmp131 = urem i32 %tmp130, 101 - %tmp132 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp10, i64 0, i64 %tmp128 - store i32 %tmp131, i32* %tmp132, align 16 - %tmp133 = or i64 %tmp128, 1 - %tmp134 = trunc i64 %tmp133 to i32 - %tmp135 = sub i32 87, %tmp134 - %tmp136 = urem i32 %tmp135, 101 - %tmp137 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp10, i64 0, i64 %tmp133 - store i32 %tmp136, i32* %tmp137, align 4 - %tmp138 = or i64 %tmp128, 2 - %tmp139 = trunc i64 %tmp138 to i32 - %tmp140 = add i32 %tmp139, 87 - %tmp141 = urem i32 %tmp140, 101 - %tmp142 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp10, i64 0, i64 %tmp138 - store i32 %tmp141, i32* %tmp142, align 8 - %tmp143 = or i64 %tmp128, 3 - %tmp144 = trunc i64 %tmp143 to i32 - %tmp145 = sub i32 87, %tmp144 - %tmp146 = urem i32 %tmp145, 101 - %tmp147 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp10, i64 0, i64 %tmp143 - store i32 %tmp146, i32* %tmp147, align 4 - %tmp148 = add nuw nsw i64 %tmp128, 4 - %tmp149 = icmp eq i64 %tmp148, 100 - br i1 %tmp149, label %bb150, label %bb127 - -bb150: ; preds = %bb150, %bb127 - %tmp151 = phi i64 [ %tmp171, %bb150 ], [ 0, %bb127 ] - %tmp152 = trunc i64 %tmp151 to i32 - %tmp153 = add i32 %tmp152, 36 - %tmp154 = urem i32 %tmp153, 101 - %tmp155 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp11, i64 0, i64 0, i64 %tmp151 - store i32 %tmp154, i32* %tmp155, align 16 - %tmp156 = or i64 %tmp151, 1 - %tmp157 = trunc i64 %tmp156 to i32 - %tmp158 = sub i32 36, %tmp157 - %tmp159 = urem i32 %tmp158, 101 - %tmp160 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp11, i64 0, i64 0, i64 %tmp156 - store i32 %tmp159, i32* %tmp160, align 4 - %tmp161 = or i64 %tmp151, 2 - %tmp162 = trunc i64 %tmp161 to i32 - %tmp163 = add i32 %tmp162, 36 - %tmp164 = urem i32 %tmp163, 101 - %tmp165 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp11, i64 0, i64 0, i64 %tmp161 - store i32 %tmp164, i32* %tmp165, align 8 - %tmp166 = or i64 %tmp151, 3 - %tmp167 = trunc i64 %tmp166 to i32 - %tmp168 = sub i32 36, %tmp167 - %tmp169 = urem i32 %tmp168, 101 - %tmp170 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp11, i64 0, i64 0, i64 %tmp166 - store i32 %tmp169, i32* %tmp170, align 4 - %tmp171 = add nuw nsw i64 %tmp151, 4 - %tmp172 = icmp eq i64 %tmp171, 10000 - br i1 %tmp172, label %bb173, label %bb150 - -bb173: ; preds = %bb173, %bb150 - %tmp174 = phi i64 [ %tmp194, %bb173 ], [ 0, %bb150 ] - %tmp175 = trunc i64 %tmp174 to i32 - %tmp176 = add i32 %tmp175, 27 - %tmp177 = urem i32 %tmp176, 101 - %tmp178 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp12, i64 0, i64 %tmp174 - store i32 %tmp177, i32* %tmp178, align 16 - %tmp179 = or i64 %tmp174, 1 - %tmp180 = trunc i64 %tmp179 to i32 - %tmp181 = sub i32 27, %tmp180 - %tmp182 = urem i32 %tmp181, 101 - %tmp183 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp12, i64 0, i64 %tmp179 - store i32 %tmp182, i32* %tmp183, align 4 - %tmp184 = or i64 %tmp174, 2 - %tmp185 = trunc i64 %tmp184 to i32 - %tmp186 = add i32 %tmp185, 27 - %tmp187 = urem i32 %tmp186, 101 - %tmp188 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp12, i64 0, i64 %tmp184 - store i32 %tmp187, i32* %tmp188, align 8 - %tmp189 = or i64 %tmp174, 3 - %tmp190 = trunc i64 %tmp189 to i32 - %tmp191 = sub i32 27, %tmp190 - %tmp192 = urem i32 %tmp191, 101 - %tmp193 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp12, i64 0, i64 %tmp189 - store i32 %tmp192, i32* %tmp193, align 4 - %tmp194 = add nuw nsw i64 %tmp174, 4 - %tmp195 = icmp eq i64 %tmp194, 100 - br i1 %tmp195, label %bb196, label %bb173 - -bb196: ; preds = %bb196, %bb173 - %tmp197 = phi i64 [ %tmp217, %bb196 ], [ 0, %bb173 ] - %tmp198 = trunc i64 %tmp197 to i32 - %tmp199 = add i32 %tmp198, 40 - %tmp200 = urem i32 %tmp199, 101 - %tmp201 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp13, i64 0, i64 %tmp197 - store i32 %tmp200, i32* %tmp201, align 16 - %tmp202 = or i64 %tmp197, 1 - %tmp203 = trunc i64 %tmp202 to i32 - %tmp204 = sub i32 40, %tmp203 - %tmp205 = urem i32 %tmp204, 101 - %tmp206 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp13, i64 0, i64 %tmp202 - store i32 %tmp205, i32* %tmp206, align 4 - %tmp207 = or i64 %tmp197, 2 - %tmp208 = trunc i64 %tmp207 to i32 - %tmp209 = add i32 %tmp208, 40 - %tmp210 = urem i32 %tmp209, 101 - %tmp211 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp13, i64 0, i64 %tmp207 - store i32 %tmp210, i32* %tmp211, align 8 - %tmp212 = or i64 %tmp197, 3 - %tmp213 = trunc i64 %tmp212 to i32 - %tmp214 = sub i32 40, %tmp213 - %tmp215 = urem i32 %tmp214, 101 - %tmp216 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp13, i64 0, i64 %tmp212 - store i32 %tmp215, i32* %tmp216, align 4 - %tmp217 = add nuw nsw i64 %tmp197, 4 - %tmp218 = icmp eq i64 %tmp217, 100 - br i1 %tmp218, label %bb219, label %bb196 - -bb219: ; preds = %bb219, %bb196 - %tmp220 = phi i64 [ %tmp240, %bb219 ], [ 0, %bb196 ] - %tmp221 = trunc i64 %tmp220 to i32 - %tmp222 = add i32 %tmp221, 84 - %tmp223 = urem i32 %tmp222, 101 - %tmp224 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp14, i64 0, i64 0, i64 %tmp220 - store i32 %tmp223, i32* %tmp224, align 16 - %tmp225 = or i64 %tmp220, 1 - %tmp226 = trunc i64 %tmp225 to i32 - %tmp227 = sub i32 84, %tmp226 - %tmp228 = urem i32 %tmp227, 101 - %tmp229 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp14, i64 0, i64 0, i64 %tmp225 - store i32 %tmp228, i32* %tmp229, align 4 - %tmp230 = or i64 %tmp220, 2 - %tmp231 = trunc i64 %tmp230 to i32 - %tmp232 = add i32 %tmp231, 84 - %tmp233 = urem i32 %tmp232, 101 - %tmp234 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp14, i64 0, i64 0, i64 %tmp230 - store i32 %tmp233, i32* %tmp234, align 8 - %tmp235 = or i64 %tmp220, 3 - %tmp236 = trunc i64 %tmp235 to i32 - %tmp237 = sub i32 84, %tmp236 - %tmp238 = urem i32 %tmp237, 101 - %tmp239 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp14, i64 0, i64 0, i64 %tmp235 - store i32 %tmp238, i32* %tmp239, align 4 - %tmp240 = add nuw nsw i64 %tmp220, 4 - %tmp241 = icmp eq i64 %tmp240, 10000 - br i1 %tmp241, label %bb242, label %bb219 - -bb242: ; preds = %bb242, %bb219 - %tmp243 = phi i64 [ %tmp263, %bb242 ], [ 0, %bb219 ] - %tmp244 = trunc i64 %tmp243 to i32 - %tmp245 = add i32 %tmp244, 94 - %tmp246 = urem i32 %tmp245, 101 - %tmp247 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp15, i64 0, i64 %tmp243 - store i32 %tmp246, i32* %tmp247, align 16 - %tmp248 = or i64 %tmp243, 1 - %tmp249 = trunc i64 %tmp248 to i32 - %tmp250 = sub i32 94, %tmp249 - %tmp251 = urem i32 %tmp250, 101 - %tmp252 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp15, i64 0, i64 %tmp248 - store i32 %tmp251, i32* %tmp252, align 4 - %tmp253 = or i64 %tmp243, 2 - %tmp254 = trunc i64 %tmp253 to i32 - %tmp255 = add i32 %tmp254, 94 - %tmp256 = urem i32 %tmp255, 101 - %tmp257 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp15, i64 0, i64 %tmp253 - store i32 %tmp256, i32* %tmp257, align 8 - %tmp258 = or i64 %tmp243, 3 - %tmp259 = trunc i64 %tmp258 to i32 - %tmp260 = sub i32 94, %tmp259 - %tmp261 = urem i32 %tmp260, 101 - %tmp262 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp15, i64 0, i64 %tmp258 - store i32 %tmp261, i32* %tmp262, align 4 - %tmp263 = add nuw nsw i64 %tmp243, 4 - %tmp264 = icmp eq i64 %tmp263, 100 - br i1 %tmp264, label %bb265, label %bb242 - -bb265: ; preds = %bb265, %bb242 - %tmp266 = phi i64 [ %tmp286, %bb265 ], [ 0, %bb242 ] - %tmp267 = trunc i64 %tmp266 to i32 - %tmp268 = add i32 %tmp267, 92 - %tmp269 = urem i32 %tmp268, 101 - %tmp270 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp16, i64 0, i64 0, i64 %tmp266 - store i32 %tmp269, i32* %tmp270, align 16 - %tmp271 = or i64 %tmp266, 1 - %tmp272 = trunc i64 %tmp271 to i32 - %tmp273 = sub i32 92, %tmp272 - %tmp274 = urem i32 %tmp273, 101 - %tmp275 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp16, i64 0, i64 0, i64 %tmp271 - store i32 %tmp274, i32* %tmp275, align 4 - %tmp276 = or i64 %tmp266, 2 - %tmp277 = trunc i64 %tmp276 to i32 - %tmp278 = add i32 %tmp277, 92 - %tmp279 = urem i32 %tmp278, 101 - %tmp280 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp16, i64 0, i64 0, i64 %tmp276 - store i32 %tmp279, i32* %tmp280, align 8 - %tmp281 = or i64 %tmp266, 3 - %tmp282 = trunc i64 %tmp281 to i32 - %tmp283 = sub i32 92, %tmp282 - %tmp284 = urem i32 %tmp283, 101 - %tmp285 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp16, i64 0, i64 0, i64 %tmp281 - store i32 %tmp284, i32* %tmp285, align 4 - %tmp286 = add nuw nsw i64 %tmp266, 4 - %tmp287 = icmp eq i64 %tmp286, 10000 - br i1 %tmp287, label %bb288, label %bb265 - -bb288: ; preds = %bb288, %bb265 - %tmp289 = phi i64 [ %tmp309, %bb288 ], [ 0, %bb265 ] - %tmp290 = trunc i64 %tmp289 to i32 - %tmp291 = add i32 %tmp290, 87 - %tmp292 = urem i32 %tmp291, 101 - %tmp293 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp17, i64 0, i64 0, i64 %tmp289 - store i32 %tmp292, i32* %tmp293, align 16 - %tmp294 = or i64 %tmp289, 1 - %tmp295 = trunc i64 %tmp294 to i32 - %tmp296 = sub i32 87, %tmp295 - %tmp297 = urem i32 %tmp296, 101 - %tmp298 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp17, i64 0, i64 0, i64 %tmp294 - store i32 %tmp297, i32* %tmp298, align 4 - %tmp299 = or i64 %tmp289, 2 - %tmp300 = trunc i64 %tmp299 to i32 - %tmp301 = add i32 %tmp300, 87 - %tmp302 = urem i32 %tmp301, 101 - %tmp303 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp17, i64 0, i64 0, i64 %tmp299 - store i32 %tmp302, i32* %tmp303, align 8 - %tmp304 = or i64 %tmp289, 3 - %tmp305 = trunc i64 %tmp304 to i32 - %tmp306 = sub i32 87, %tmp305 - %tmp307 = urem i32 %tmp306, 101 - %tmp308 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp17, i64 0, i64 0, i64 %tmp304 - store i32 %tmp307, i32* %tmp308, align 4 - %tmp309 = add nuw nsw i64 %tmp289, 4 - %tmp310 = icmp eq i64 %tmp309, 10000 - br i1 %tmp310, label %bb311, label %bb288 - -bb311: ; preds = %bb311, %bb288 - %tmp312 = phi i64 [ %tmp332, %bb311 ], [ 0, %bb288 ] - %tmp313 = trunc i64 %tmp312 to i32 - %tmp314 = add i32 %tmp313, 28 - %tmp315 = urem i32 %tmp314, 101 - %tmp316 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp18, i64 0, i64 0, i64 %tmp312 - store i32 %tmp315, i32* %tmp316, align 16 - %tmp317 = or i64 %tmp312, 1 - %tmp318 = trunc i64 %tmp317 to i32 - %tmp319 = sub i32 28, %tmp318 - %tmp320 = urem i32 %tmp319, 101 - %tmp321 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp18, i64 0, i64 0, i64 %tmp317 - store i32 %tmp320, i32* %tmp321, align 4 - %tmp322 = or i64 %tmp312, 2 - %tmp323 = trunc i64 %tmp322 to i32 - %tmp324 = add i32 %tmp323, 28 - %tmp325 = urem i32 %tmp324, 101 - %tmp326 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp18, i64 0, i64 0, i64 %tmp322 - store i32 %tmp325, i32* %tmp326, align 8 - %tmp327 = or i64 %tmp312, 3 - %tmp328 = trunc i64 %tmp327 to i32 - %tmp329 = sub i32 28, %tmp328 - %tmp330 = urem i32 %tmp329, 101 - %tmp331 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp18, i64 0, i64 0, i64 %tmp327 - store i32 %tmp330, i32* %tmp331, align 4 - %tmp332 = add nuw nsw i64 %tmp312, 4 - %tmp333 = icmp eq i64 %tmp332, 10000 - br i1 %tmp333, label %bb334, label %bb311 - -bb334: ; preds = %bb311 - %tmp335 = sub i32 87, %arg - %tmp336 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 69 - %tmp337 = load i32, i32* %tmp336, align 4 - %tmp338 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 68 - %tmp339 = load i32, i32* %tmp338, align 16 - br label %bb340 - -bb340: ; preds = %bb340, %bb334 - %tmp341 = phi i32 [ %tmp339, %bb334 ], [ %tmp373, %bb340 ] - %tmp342 = phi i32 [ %tmp337, %bb334 ], [ %tmp379, %bb340 ] - %tmp343 = phi i64 [ 68, %bb334 ], [ %tmp371, %bb340 ] - %tmp344 = phi i32 [ %tmp335, %bb334 ], [ %tmp382, %bb340 ] - %tmp345 = phi i32 [ %arg2, %bb334 ], [ %tmp380, %bb340 ] - %tmp346 = add nsw i64 %tmp343, -1 - %tmp347 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 %tmp346 - %tmp348 = load i32, i32* %tmp347, align 4 - %tmp349 = add nuw nsw i64 %tmp343, 1 - %tmp350 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 %tmp349 - %tmp351 = sub i32 %tmp342, %tmp348 - store i32 %tmp351, i32* %tmp350, align 4 - %tmp352 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp7, i64 0, i64 %tmp343 - %tmp353 = load i32, i32* %tmp352, align 4 - %tmp354 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 %tmp343 - %tmp355 = add i32 %tmp341, %tmp353 - store i32 %tmp355, i32* %tmp354, align 4 - %tmp356 = add i32 %tmp345, -1 - %tmp357 = sub i32 %tmp344, %tmp345 - %tmp358 = sub i32 %tmp357, %tmp351 - %tmp359 = add nsw i64 %tmp343, -2 - %tmp360 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 %tmp359 - %tmp361 = load i32, i32* %tmp360, align 4 - %tmp362 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 %tmp343 - %tmp363 = sub i32 %tmp355, %tmp361 - store i32 %tmp363, i32* %tmp362, align 4 - %tmp364 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp7, i64 0, i64 %tmp346 - %tmp365 = load i32, i32* %tmp364, align 4 - %tmp366 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 %tmp346 - %tmp367 = add i32 %tmp348, %tmp365 - store i32 %tmp367, i32* %tmp366, align 4 - %tmp368 = add i32 %tmp345, -2 - %tmp369 = sub i32 %tmp358, %tmp356 - %tmp370 = sub i32 %tmp369, %tmp363 - %tmp371 = add nsw i64 %tmp343, -3 - %tmp372 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 %tmp371 - %tmp373 = load i32, i32* %tmp372, align 4 - %tmp374 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 %tmp346 - %tmp375 = sub i32 %tmp367, %tmp373 - store i32 %tmp375, i32* %tmp374, align 4 - %tmp376 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp7, i64 0, i64 %tmp359 - %tmp377 = load i32, i32* %tmp376, align 4 - %tmp378 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 %tmp359 - %tmp379 = add i32 %tmp361, %tmp377 - store i32 %tmp379, i32* %tmp378, align 4 - %tmp380 = add i32 %tmp345, -3 - %tmp381 = sub i32 %tmp370, %tmp368 - %tmp382 = sub i32 %tmp381, %tmp375 - %tmp383 = icmp ugt i64 %tmp371, 2 - br i1 %tmp383, label %bb340, label %bb384 - -bb384: ; preds = %bb340 - %tmp385 = add i32 %arg2, -66 - %tmp386 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp7, i64 0, i64 52 - %tmp387 = load i32, i32* %tmp386, align 16 - store i32 %tmp387, i32* %tmp32, align 4 - %tmp388 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 97 - %tmp389 = load i32, i32* %tmp388, align 4 - %tmp390 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp8, i64 0, i64 31 - %tmp391 = load i32, i32* %tmp390, align 4 - %tmp392 = icmp eq i32 %tmp389, %tmp391 - br i1 %tmp392, label %bb478, label %bb393 - -bb393: ; preds = %bb384 - %tmp394 = sub i32 -79, %tmp382 - %tmp395 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp12, i64 0, i64 2 - %tmp396 = bitcast i32* %tmp395 to i8* - %tmp397 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp13, i64 0, i64 2 - %tmp398 = bitcast i32* %tmp397 to i8* - call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 8 %tmp396, i8* nonnull align 8 %tmp398, i64 304, i1 false) - br label %bb399 - -bb399: ; preds = %bb424, %bb393 - %tmp400 = phi i64 [ 77, %bb393 ], [ %tmp425, %bb424 ] - br label %bb403 - -bb401: ; preds = %bb424 - %tmp402 = add i32 %arg2, 3 - br label %bb433 - -bb403: ; preds = %bb403, %bb399 - %tmp404 = phi i64 [ 1, %bb399 ], [ %tmp414, %bb403 ] - %tmp405 = add nuw nsw i64 %tmp404, 1 - %tmp406 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp9, i64 0, i64 %tmp404, i64 %tmp405 - %tmp407 = load i32, i32* %tmp406, align 4 - %tmp408 = add i32 %tmp394, %tmp407 - store i32 %tmp408, i32* %tmp406, align 4 - %tmp409 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp11, i64 0, i64 %tmp404, i64 %tmp405 - %tmp410 = load i32, i32* %tmp409, align 4 - %tmp411 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp10, i64 0, i64 %tmp405 - %tmp412 = load i32, i32* %tmp411, align 4 - %tmp413 = add i32 %tmp412, %tmp410 - store i32 %tmp413, i32* %tmp411, align 4 - %tmp414 = add nuw nsw i64 %tmp404, 2 - %tmp415 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp9, i64 0, i64 %tmp405, i64 %tmp414 - %tmp416 = load i32, i32* %tmp415, align 4 - %tmp417 = add i32 %tmp394, %tmp416 - store i32 %tmp417, i32* %tmp415, align 4 - %tmp418 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp11, i64 0, i64 %tmp405, i64 %tmp414 - %tmp419 = load i32, i32* %tmp418, align 4 - %tmp420 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp10, i64 0, i64 %tmp414 - %tmp421 = load i32, i32* %tmp420, align 4 - %tmp422 = add i32 %tmp421, %tmp419 - store i32 %tmp422, i32* %tmp420, align 4 - %tmp423 = icmp eq i64 %tmp414, 47 - br i1 %tmp423, label %bb424, label %bb403 - -bb424: ; preds = %bb403 - %tmp425 = add nsw i64 %tmp400, -1 - %tmp426 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp8, i64 0, i64 %tmp425 - %tmp427 = load i32, i32* %tmp426, align 4 - %tmp428 = add i32 %tmp427, 2 - %tmp429 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 %tmp425 - %tmp430 = load i32, i32* %tmp429, align 4 - %tmp431 = mul i32 %tmp430, %tmp428 - store i32 %tmp431, i32* %tmp429, align 4 - %tmp432 = icmp ugt i64 %tmp425, 1 - br i1 %tmp432, label %bb399, label %bb401 - -bb433: ; preds = %bb475, %bb401 - %tmp434 = phi i64 [ 2, %bb401 ], [ %tmp437, %bb475 ] - %tmp435 = phi i32 [ 2, %bb401 ], [ %tmp476, %bb475 ] - %tmp436 = add nsw i64 %tmp434, -1 - %tmp437 = add nuw nsw i64 %tmp434, 1 - %tmp438 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp14, i64 0, i64 %tmp437, i64 %tmp434 - %tmp439 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp17, i64 0, i64 %tmp436, i64 %tmp437 - %tmp440 = mul i32 %tmp435, 47 - br label %bb441 - -bb441: ; preds = %bb473, %bb433 - %tmp442 = phi i64 [ 1, %bb433 ], [ %tmp450, %bb473 ] - %tmp443 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp8, i64 0, i64 %tmp442 - %tmp444 = load i32, i32* %tmp443, align 4 - %tmp445 = add nsw i64 %tmp442, -1 - %tmp446 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp13, i64 0, i64 %tmp445 - %tmp447 = load i32, i32* %tmp446, align 4 - %tmp448 = xor i32 %tmp444, -1 - %tmp449 = add i32 %tmp447, %tmp448 - store i32 %tmp449, i32* %tmp446, align 4 - %tmp450 = add nuw nsw i64 %tmp442, 1 - %tmp451 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp14, i64 0, i64 %tmp436, i64 %tmp450 - %tmp452 = load i32, i32* %tmp451, align 4 - %tmp453 = mul i32 %tmp452, 91 - %tmp454 = icmp eq i32 %tmp453, -30 - br i1 %tmp454, label %bb455, label %bb473 - -bb455: ; preds = %bb441 - %tmp456 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp15, i64 0, i64 %tmp442 - %tmp457 = load i32, i32* %tmp456, align 4 - %tmp458 = icmp ugt i32 %tmp457, %tmp402 - br i1 %tmp458, label %bb459, label %bb473 - -bb459: ; preds = %bb455 - %tmp460 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp16, i64 0, i64 %tmp445, i64 %tmp436 - store i32 %tmp387, i32* %tmp460, align 4 - %tmp461 = load i32, i32* %tmp57, align 4 - %tmp462 = load i32, i32* %tmp438, align 4 - %tmp463 = add i32 %tmp462, %tmp461 - %tmp464 = load i32, i32* %tmp439, align 4 - %tmp465 = add i32 %tmp464, 68 - %tmp466 = icmp eq i32 %tmp463, %tmp465 - br i1 %tmp466, label %bb471, label %bb467 - -bb467: ; preds = %bb459 - %tmp468 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp10, i64 0, i64 %tmp450 - %tmp469 = load i32, i32* %tmp468, align 4 - %tmp470 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 %tmp445 - store i32 %tmp469, i32* %tmp470, align 4 - br label %bb473 - -bb471: ; preds = %bb459 - %tmp472 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp18, i64 0, i64 %tmp437, i64 %tmp445 - store i32 %tmp440, i32* %tmp472, align 4 - br label %bb473 - -bb473: ; preds = %bb471, %bb467, %bb455, %bb441 - %tmp474 = icmp eq i64 %tmp450, 13 - br i1 %tmp474, label %bb475, label %bb441 - -bb475: ; preds = %bb473 - %tmp476 = add nuw nsw i32 %tmp435, 1 - %tmp477 = icmp eq i64 %tmp437, 69 - br i1 %tmp477, label %bb478, label %bb433 - -bb478: ; preds = %bb475, %bb384 - br label %bb479 - -bb479: ; preds = %bb479, %bb478 - %tmp480 = phi i64 [ 0, %bb478 ], [ %tmp521, %bb479 ] - %tmp481 = phi i32 [ 0, %bb478 ], [ %tmp520, %bb479 ] - %tmp482 = and i64 %tmp480, 1 - %tmp483 = icmp eq i64 %tmp482, 0 - %tmp484 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 %tmp480 - %tmp485 = load i32, i32* %tmp484, align 4 - %tmp486 = sub i32 0, %tmp485 - %tmp487 = select i1 %tmp483, i32 %tmp485, i32 %tmp486 - %tmp488 = add i32 %tmp487, %tmp481 - %tmp489 = add nuw nsw i64 %tmp480, 1 - %tmp490 = and i64 %tmp489, 1 - %tmp491 = icmp eq i64 %tmp490, 0 - %tmp492 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 %tmp489 - %tmp493 = load i32, i32* %tmp492, align 4 - %tmp494 = sub i32 0, %tmp493 - %tmp495 = select i1 %tmp491, i32 %tmp493, i32 %tmp494 - %tmp496 = add i32 %tmp495, %tmp488 - %tmp497 = add nuw nsw i64 %tmp480, 2 - %tmp498 = and i64 %tmp497, 1 - %tmp499 = icmp eq i64 %tmp498, 0 - %tmp500 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 %tmp497 - %tmp501 = load i32, i32* %tmp500, align 4 - %tmp502 = sub i32 0, %tmp501 - %tmp503 = select i1 %tmp499, i32 %tmp501, i32 %tmp502 - %tmp504 = add i32 %tmp503, %tmp496 - %tmp505 = add nuw nsw i64 %tmp480, 3 - %tmp506 = and i64 %tmp505, 1 - %tmp507 = icmp eq i64 %tmp506, 0 - %tmp508 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 %tmp505 - %tmp509 = load i32, i32* %tmp508, align 4 - %tmp510 = sub i32 0, %tmp509 - %tmp511 = select i1 %tmp507, i32 %tmp509, i32 %tmp510 - %tmp512 = add i32 %tmp511, %tmp504 - %tmp513 = add nuw nsw i64 %tmp480, 4 - %tmp514 = and i64 %tmp513, 1 - %tmp515 = icmp eq i64 %tmp514, 0 - %tmp516 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp, i64 0, i64 %tmp513 - %tmp517 = load i32, i32* %tmp516, align 4 - %tmp518 = sub i32 0, %tmp517 - %tmp519 = select i1 %tmp515, i32 %tmp517, i32 %tmp518 - %tmp520 = add i32 %tmp519, %tmp512 - %tmp521 = add nuw nsw i64 %tmp480, 5 - %tmp522 = icmp eq i64 %tmp521, 100 - br i1 %tmp522, label %bb523, label %bb479 - -bb523: ; preds = %bb523, %bb479 - %tmp524 = phi i64 [ %tmp565, %bb523 ], [ 0, %bb479 ] - %tmp525 = phi i32 [ %tmp564, %bb523 ], [ 0, %bb479 ] - %tmp526 = and i64 %tmp524, 1 - %tmp527 = icmp eq i64 %tmp526, 0 - %tmp528 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp7, i64 0, i64 %tmp524 - %tmp529 = load i32, i32* %tmp528, align 4 - %tmp530 = sub i32 0, %tmp529 - %tmp531 = select i1 %tmp527, i32 %tmp529, i32 %tmp530 - %tmp532 = add i32 %tmp531, %tmp525 - %tmp533 = add nuw nsw i64 %tmp524, 1 - %tmp534 = and i64 %tmp533, 1 - %tmp535 = icmp eq i64 %tmp534, 0 - %tmp536 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp7, i64 0, i64 %tmp533 - %tmp537 = load i32, i32* %tmp536, align 4 - %tmp538 = sub i32 0, %tmp537 - %tmp539 = select i1 %tmp535, i32 %tmp537, i32 %tmp538 - %tmp540 = add i32 %tmp539, %tmp532 - %tmp541 = add nuw nsw i64 %tmp524, 2 - %tmp542 = and i64 %tmp541, 1 - %tmp543 = icmp eq i64 %tmp542, 0 - %tmp544 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp7, i64 0, i64 %tmp541 - %tmp545 = load i32, i32* %tmp544, align 4 - %tmp546 = sub i32 0, %tmp545 - %tmp547 = select i1 %tmp543, i32 %tmp545, i32 %tmp546 - %tmp548 = add i32 %tmp547, %tmp540 - %tmp549 = add nuw nsw i64 %tmp524, 3 - %tmp550 = and i64 %tmp549, 1 - %tmp551 = icmp eq i64 %tmp550, 0 - %tmp552 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp7, i64 0, i64 %tmp549 - %tmp553 = load i32, i32* %tmp552, align 4 - %tmp554 = sub i32 0, %tmp553 - %tmp555 = select i1 %tmp551, i32 %tmp553, i32 %tmp554 - %tmp556 = add i32 %tmp555, %tmp548 - %tmp557 = add nuw nsw i64 %tmp524, 4 - %tmp558 = and i64 %tmp557, 1 - %tmp559 = icmp eq i64 %tmp558, 0 - %tmp560 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp7, i64 0, i64 %tmp557 - %tmp561 = load i32, i32* %tmp560, align 4 - %tmp562 = sub i32 0, %tmp561 - %tmp563 = select i1 %tmp559, i32 %tmp561, i32 %tmp562 - %tmp564 = add i32 %tmp563, %tmp556 - %tmp565 = add nuw nsw i64 %tmp524, 5 - %tmp566 = icmp eq i64 %tmp565, 100 - br i1 %tmp566, label %bb567, label %bb523 - -bb567: ; preds = %bb567, %bb523 - %tmp568 = phi i64 [ %tmp609, %bb567 ], [ 0, %bb523 ] - %tmp569 = phi i32 [ %tmp608, %bb567 ], [ 0, %bb523 ] - %tmp570 = and i64 %tmp568, 1 - %tmp571 = icmp eq i64 %tmp570, 0 - %tmp572 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp8, i64 0, i64 %tmp568 - %tmp573 = load i32, i32* %tmp572, align 4 - %tmp574 = sub i32 0, %tmp573 - %tmp575 = select i1 %tmp571, i32 %tmp573, i32 %tmp574 - %tmp576 = add i32 %tmp575, %tmp569 - %tmp577 = add nuw nsw i64 %tmp568, 1 - %tmp578 = and i64 %tmp577, 1 - %tmp579 = icmp eq i64 %tmp578, 0 - %tmp580 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp8, i64 0, i64 %tmp577 - %tmp581 = load i32, i32* %tmp580, align 4 - %tmp582 = sub i32 0, %tmp581 - %tmp583 = select i1 %tmp579, i32 %tmp581, i32 %tmp582 - %tmp584 = add i32 %tmp583, %tmp576 - %tmp585 = add nuw nsw i64 %tmp568, 2 - %tmp586 = and i64 %tmp585, 1 - %tmp587 = icmp eq i64 %tmp586, 0 - %tmp588 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp8, i64 0, i64 %tmp585 - %tmp589 = load i32, i32* %tmp588, align 4 - %tmp590 = sub i32 0, %tmp589 - %tmp591 = select i1 %tmp587, i32 %tmp589, i32 %tmp590 - %tmp592 = add i32 %tmp591, %tmp584 - %tmp593 = add nuw nsw i64 %tmp568, 3 - %tmp594 = and i64 %tmp593, 1 - %tmp595 = icmp eq i64 %tmp594, 0 - %tmp596 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp8, i64 0, i64 %tmp593 - %tmp597 = load i32, i32* %tmp596, align 4 - %tmp598 = sub i32 0, %tmp597 - %tmp599 = select i1 %tmp595, i32 %tmp597, i32 %tmp598 - %tmp600 = add i32 %tmp599, %tmp592 - %tmp601 = add nuw nsw i64 %tmp568, 4 - %tmp602 = and i64 %tmp601, 1 - %tmp603 = icmp eq i64 %tmp602, 0 - %tmp604 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp8, i64 0, i64 %tmp601 - %tmp605 = load i32, i32* %tmp604, align 4 - %tmp606 = sub i32 0, %tmp605 - %tmp607 = select i1 %tmp603, i32 %tmp605, i32 %tmp606 - %tmp608 = add i32 %tmp607, %tmp600 - %tmp609 = add nuw nsw i64 %tmp568, 5 - %tmp610 = icmp eq i64 %tmp609, 100 - br i1 %tmp610, label %bb611, label %bb567 - -bb611: ; preds = %bb611, %bb567 - %tmp612 = phi i64 [ %tmp653, %bb611 ], [ 0, %bb567 ] - %tmp613 = phi i32 [ %tmp652, %bb611 ], [ 0, %bb567 ] - %tmp614 = and i64 %tmp612, 1 - %tmp615 = icmp eq i64 %tmp614, 0 - %tmp616 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp9, i64 0, i64 0, i64 %tmp612 - %tmp617 = load i32, i32* %tmp616, align 4 - %tmp618 = sub i32 0, %tmp617 - %tmp619 = select i1 %tmp615, i32 %tmp617, i32 %tmp618 - %tmp620 = add i32 %tmp619, %tmp613 - %tmp621 = add nuw nsw i64 %tmp612, 1 - %tmp622 = and i64 %tmp621, 1 - %tmp623 = icmp eq i64 %tmp622, 0 - %tmp624 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp9, i64 0, i64 0, i64 %tmp621 - %tmp625 = load i32, i32* %tmp624, align 4 - %tmp626 = sub i32 0, %tmp625 - %tmp627 = select i1 %tmp623, i32 %tmp625, i32 %tmp626 - %tmp628 = add i32 %tmp627, %tmp620 - %tmp629 = add nuw nsw i64 %tmp612, 2 - %tmp630 = and i64 %tmp629, 1 - %tmp631 = icmp eq i64 %tmp630, 0 - %tmp632 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp9, i64 0, i64 0, i64 %tmp629 - %tmp633 = load i32, i32* %tmp632, align 4 - %tmp634 = sub i32 0, %tmp633 - %tmp635 = select i1 %tmp631, i32 %tmp633, i32 %tmp634 - %tmp636 = add i32 %tmp635, %tmp628 - %tmp637 = add nuw nsw i64 %tmp612, 3 - %tmp638 = and i64 %tmp637, 1 - %tmp639 = icmp eq i64 %tmp638, 0 - %tmp640 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp9, i64 0, i64 0, i64 %tmp637 - %tmp641 = load i32, i32* %tmp640, align 4 - %tmp642 = sub i32 0, %tmp641 - %tmp643 = select i1 %tmp639, i32 %tmp641, i32 %tmp642 - %tmp644 = add i32 %tmp643, %tmp636 - %tmp645 = add nuw nsw i64 %tmp612, 4 - %tmp646 = and i64 %tmp645, 1 - %tmp647 = icmp eq i64 %tmp646, 0 - %tmp648 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp9, i64 0, i64 0, i64 %tmp645 - %tmp649 = load i32, i32* %tmp648, align 4 - %tmp650 = sub i32 0, %tmp649 - %tmp651 = select i1 %tmp647, i32 %tmp649, i32 %tmp650 - %tmp652 = add i32 %tmp651, %tmp644 - %tmp653 = add nuw nsw i64 %tmp612, 5 - %tmp654 = icmp eq i64 %tmp653, 10000 - br i1 %tmp654, label %bb655, label %bb611 - -bb655: ; preds = %bb655, %bb611 - %tmp656 = phi i64 [ %tmp697, %bb655 ], [ 0, %bb611 ] - %tmp657 = phi i32 [ %tmp696, %bb655 ], [ 0, %bb611 ] - %tmp658 = and i64 %tmp656, 1 - %tmp659 = icmp eq i64 %tmp658, 0 - %tmp660 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp10, i64 0, i64 %tmp656 - %tmp661 = load i32, i32* %tmp660, align 4 - %tmp662 = sub i32 0, %tmp661 - %tmp663 = select i1 %tmp659, i32 %tmp661, i32 %tmp662 - %tmp664 = add i32 %tmp663, %tmp657 - %tmp665 = add nuw nsw i64 %tmp656, 1 - %tmp666 = and i64 %tmp665, 1 - %tmp667 = icmp eq i64 %tmp666, 0 - %tmp668 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp10, i64 0, i64 %tmp665 - %tmp669 = load i32, i32* %tmp668, align 4 - %tmp670 = sub i32 0, %tmp669 - %tmp671 = select i1 %tmp667, i32 %tmp669, i32 %tmp670 - %tmp672 = add i32 %tmp671, %tmp664 - %tmp673 = add nuw nsw i64 %tmp656, 2 - %tmp674 = and i64 %tmp673, 1 - %tmp675 = icmp eq i64 %tmp674, 0 - %tmp676 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp10, i64 0, i64 %tmp673 - %tmp677 = load i32, i32* %tmp676, align 4 - %tmp678 = sub i32 0, %tmp677 - %tmp679 = select i1 %tmp675, i32 %tmp677, i32 %tmp678 - %tmp680 = add i32 %tmp679, %tmp672 - %tmp681 = add nuw nsw i64 %tmp656, 3 - %tmp682 = and i64 %tmp681, 1 - %tmp683 = icmp eq i64 %tmp682, 0 - %tmp684 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp10, i64 0, i64 %tmp681 - %tmp685 = load i32, i32* %tmp684, align 4 - %tmp686 = sub i32 0, %tmp685 - %tmp687 = select i1 %tmp683, i32 %tmp685, i32 %tmp686 - %tmp688 = add i32 %tmp687, %tmp680 - %tmp689 = add nuw nsw i64 %tmp656, 4 - %tmp690 = and i64 %tmp689, 1 - %tmp691 = icmp eq i64 %tmp690, 0 - %tmp692 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp10, i64 0, i64 %tmp689 - %tmp693 = load i32, i32* %tmp692, align 4 - %tmp694 = sub i32 0, %tmp693 - %tmp695 = select i1 %tmp691, i32 %tmp693, i32 %tmp694 - %tmp696 = add i32 %tmp695, %tmp688 - %tmp697 = add nuw nsw i64 %tmp656, 5 - %tmp698 = icmp eq i64 %tmp697, 100 - br i1 %tmp698, label %bb699, label %bb655 - -bb699: ; preds = %bb699, %bb655 - %tmp700 = phi i64 [ %tmp741, %bb699 ], [ 0, %bb655 ] - %tmp701 = phi i32 [ %tmp740, %bb699 ], [ 0, %bb655 ] - %tmp702 = and i64 %tmp700, 1 - %tmp703 = icmp eq i64 %tmp702, 0 - %tmp704 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp11, i64 0, i64 0, i64 %tmp700 - %tmp705 = load i32, i32* %tmp704, align 4 - %tmp706 = sub i32 0, %tmp705 - %tmp707 = select i1 %tmp703, i32 %tmp705, i32 %tmp706 - %tmp708 = add i32 %tmp707, %tmp701 - %tmp709 = add nuw nsw i64 %tmp700, 1 - %tmp710 = and i64 %tmp709, 1 - %tmp711 = icmp eq i64 %tmp710, 0 - %tmp712 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp11, i64 0, i64 0, i64 %tmp709 - %tmp713 = load i32, i32* %tmp712, align 4 - %tmp714 = sub i32 0, %tmp713 - %tmp715 = select i1 %tmp711, i32 %tmp713, i32 %tmp714 - %tmp716 = add i32 %tmp715, %tmp708 - %tmp717 = add nuw nsw i64 %tmp700, 2 - %tmp718 = and i64 %tmp717, 1 - %tmp719 = icmp eq i64 %tmp718, 0 - %tmp720 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp11, i64 0, i64 0, i64 %tmp717 - %tmp721 = load i32, i32* %tmp720, align 4 - %tmp722 = sub i32 0, %tmp721 - %tmp723 = select i1 %tmp719, i32 %tmp721, i32 %tmp722 - %tmp724 = add i32 %tmp723, %tmp716 - %tmp725 = add nuw nsw i64 %tmp700, 3 - %tmp726 = and i64 %tmp725, 1 - %tmp727 = icmp eq i64 %tmp726, 0 - %tmp728 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp11, i64 0, i64 0, i64 %tmp725 - %tmp729 = load i32, i32* %tmp728, align 4 - %tmp730 = sub i32 0, %tmp729 - %tmp731 = select i1 %tmp727, i32 %tmp729, i32 %tmp730 - %tmp732 = add i32 %tmp731, %tmp724 - %tmp733 = add nuw nsw i64 %tmp700, 4 - %tmp734 = and i64 %tmp733, 1 - %tmp735 = icmp eq i64 %tmp734, 0 - %tmp736 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp11, i64 0, i64 0, i64 %tmp733 - %tmp737 = load i32, i32* %tmp736, align 4 - %tmp738 = sub i32 0, %tmp737 - %tmp739 = select i1 %tmp735, i32 %tmp737, i32 %tmp738 - %tmp740 = add i32 %tmp739, %tmp732 - %tmp741 = add nuw nsw i64 %tmp700, 5 - %tmp742 = icmp eq i64 %tmp741, 10000 - br i1 %tmp742, label %bb743, label %bb699 - -bb743: ; preds = %bb743, %bb699 - %tmp744 = phi i64 [ %tmp785, %bb743 ], [ 0, %bb699 ] - %tmp745 = phi i32 [ %tmp784, %bb743 ], [ 0, %bb699 ] - %tmp746 = and i64 %tmp744, 1 - %tmp747 = icmp eq i64 %tmp746, 0 - %tmp748 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp12, i64 0, i64 %tmp744 - %tmp749 = load i32, i32* %tmp748, align 4 - %tmp750 = sub i32 0, %tmp749 - %tmp751 = select i1 %tmp747, i32 %tmp749, i32 %tmp750 - %tmp752 = add i32 %tmp751, %tmp745 - %tmp753 = add nuw nsw i64 %tmp744, 1 - %tmp754 = and i64 %tmp753, 1 - %tmp755 = icmp eq i64 %tmp754, 0 - %tmp756 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp12, i64 0, i64 %tmp753 - %tmp757 = load i32, i32* %tmp756, align 4 - %tmp758 = sub i32 0, %tmp757 - %tmp759 = select i1 %tmp755, i32 %tmp757, i32 %tmp758 - %tmp760 = add i32 %tmp759, %tmp752 - %tmp761 = add nuw nsw i64 %tmp744, 2 - %tmp762 = and i64 %tmp761, 1 - %tmp763 = icmp eq i64 %tmp762, 0 - %tmp764 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp12, i64 0, i64 %tmp761 - %tmp765 = load i32, i32* %tmp764, align 4 - %tmp766 = sub i32 0, %tmp765 - %tmp767 = select i1 %tmp763, i32 %tmp765, i32 %tmp766 - %tmp768 = add i32 %tmp767, %tmp760 - %tmp769 = add nuw nsw i64 %tmp744, 3 - %tmp770 = and i64 %tmp769, 1 - %tmp771 = icmp eq i64 %tmp770, 0 - %tmp772 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp12, i64 0, i64 %tmp769 - %tmp773 = load i32, i32* %tmp772, align 4 - %tmp774 = sub i32 0, %tmp773 - %tmp775 = select i1 %tmp771, i32 %tmp773, i32 %tmp774 - %tmp776 = add i32 %tmp775, %tmp768 - %tmp777 = add nuw nsw i64 %tmp744, 4 - %tmp778 = and i64 %tmp777, 1 - %tmp779 = icmp eq i64 %tmp778, 0 - %tmp780 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp12, i64 0, i64 %tmp777 - %tmp781 = load i32, i32* %tmp780, align 4 - %tmp782 = sub i32 0, %tmp781 - %tmp783 = select i1 %tmp779, i32 %tmp781, i32 %tmp782 - %tmp784 = add i32 %tmp783, %tmp776 - %tmp785 = add nuw nsw i64 %tmp744, 5 - %tmp786 = icmp eq i64 %tmp785, 100 - br i1 %tmp786, label %bb787, label %bb743 - -bb787: ; preds = %bb787, %bb743 - %tmp788 = phi i64 [ %tmp829, %bb787 ], [ 0, %bb743 ] - %tmp789 = phi i32 [ %tmp828, %bb787 ], [ 0, %bb743 ] - %tmp790 = and i64 %tmp788, 1 - %tmp791 = icmp eq i64 %tmp790, 0 - %tmp792 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp13, i64 0, i64 %tmp788 - %tmp793 = load i32, i32* %tmp792, align 4 - %tmp794 = sub i32 0, %tmp793 - %tmp795 = select i1 %tmp791, i32 %tmp793, i32 %tmp794 - %tmp796 = add i32 %tmp795, %tmp789 - %tmp797 = add nuw nsw i64 %tmp788, 1 - %tmp798 = and i64 %tmp797, 1 - %tmp799 = icmp eq i64 %tmp798, 0 - %tmp800 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp13, i64 0, i64 %tmp797 - %tmp801 = load i32, i32* %tmp800, align 4 - %tmp802 = sub i32 0, %tmp801 - %tmp803 = select i1 %tmp799, i32 %tmp801, i32 %tmp802 - %tmp804 = add i32 %tmp803, %tmp796 - %tmp805 = add nuw nsw i64 %tmp788, 2 - %tmp806 = and i64 %tmp805, 1 - %tmp807 = icmp eq i64 %tmp806, 0 - %tmp808 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp13, i64 0, i64 %tmp805 - %tmp809 = load i32, i32* %tmp808, align 4 - %tmp810 = sub i32 0, %tmp809 - %tmp811 = select i1 %tmp807, i32 %tmp809, i32 %tmp810 - %tmp812 = add i32 %tmp811, %tmp804 - %tmp813 = add nuw nsw i64 %tmp788, 3 - %tmp814 = and i64 %tmp813, 1 - %tmp815 = icmp eq i64 %tmp814, 0 - %tmp816 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp13, i64 0, i64 %tmp813 - %tmp817 = load i32, i32* %tmp816, align 4 - %tmp818 = sub i32 0, %tmp817 - %tmp819 = select i1 %tmp815, i32 %tmp817, i32 %tmp818 - %tmp820 = add i32 %tmp819, %tmp812 - %tmp821 = add nuw nsw i64 %tmp788, 4 - %tmp822 = and i64 %tmp821, 1 - %tmp823 = icmp eq i64 %tmp822, 0 - %tmp824 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp13, i64 0, i64 %tmp821 - %tmp825 = load i32, i32* %tmp824, align 4 - %tmp826 = sub i32 0, %tmp825 - %tmp827 = select i1 %tmp823, i32 %tmp825, i32 %tmp826 - %tmp828 = add i32 %tmp827, %tmp820 - %tmp829 = add nuw nsw i64 %tmp788, 5 - %tmp830 = icmp eq i64 %tmp829, 100 - br i1 %tmp830, label %bb831, label %bb787 - -bb831: ; preds = %bb831, %bb787 - %tmp832 = phi i64 [ %tmp873, %bb831 ], [ 0, %bb787 ] - %tmp833 = phi i32 [ %tmp872, %bb831 ], [ 0, %bb787 ] - %tmp834 = and i64 %tmp832, 1 - %tmp835 = icmp eq i64 %tmp834, 0 - %tmp836 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp14, i64 0, i64 0, i64 %tmp832 - %tmp837 = load i32, i32* %tmp836, align 4 - %tmp838 = sub i32 0, %tmp837 - %tmp839 = select i1 %tmp835, i32 %tmp837, i32 %tmp838 - %tmp840 = add i32 %tmp839, %tmp833 - %tmp841 = add nuw nsw i64 %tmp832, 1 - %tmp842 = and i64 %tmp841, 1 - %tmp843 = icmp eq i64 %tmp842, 0 - %tmp844 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp14, i64 0, i64 0, i64 %tmp841 - %tmp845 = load i32, i32* %tmp844, align 4 - %tmp846 = sub i32 0, %tmp845 - %tmp847 = select i1 %tmp843, i32 %tmp845, i32 %tmp846 - %tmp848 = add i32 %tmp847, %tmp840 - %tmp849 = add nuw nsw i64 %tmp832, 2 - %tmp850 = and i64 %tmp849, 1 - %tmp851 = icmp eq i64 %tmp850, 0 - %tmp852 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp14, i64 0, i64 0, i64 %tmp849 - %tmp853 = load i32, i32* %tmp852, align 4 - %tmp854 = sub i32 0, %tmp853 - %tmp855 = select i1 %tmp851, i32 %tmp853, i32 %tmp854 - %tmp856 = add i32 %tmp855, %tmp848 - %tmp857 = add nuw nsw i64 %tmp832, 3 - %tmp858 = and i64 %tmp857, 1 - %tmp859 = icmp eq i64 %tmp858, 0 - %tmp860 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp14, i64 0, i64 0, i64 %tmp857 - %tmp861 = load i32, i32* %tmp860, align 4 - %tmp862 = sub i32 0, %tmp861 - %tmp863 = select i1 %tmp859, i32 %tmp861, i32 %tmp862 - %tmp864 = add i32 %tmp863, %tmp856 - %tmp865 = add nuw nsw i64 %tmp832, 4 - %tmp866 = and i64 %tmp865, 1 - %tmp867 = icmp eq i64 %tmp866, 0 - %tmp868 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp14, i64 0, i64 0, i64 %tmp865 - %tmp869 = load i32, i32* %tmp868, align 4 - %tmp870 = sub i32 0, %tmp869 - %tmp871 = select i1 %tmp867, i32 %tmp869, i32 %tmp870 - %tmp872 = add i32 %tmp871, %tmp864 - %tmp873 = add nuw nsw i64 %tmp832, 5 - %tmp874 = icmp eq i64 %tmp873, 10000 - br i1 %tmp874, label %bb875, label %bb831 - -bb875: ; preds = %bb875, %bb831 - %tmp876 = phi i64 [ %tmp917, %bb875 ], [ 0, %bb831 ] - %tmp877 = phi i32 [ %tmp916, %bb875 ], [ 0, %bb831 ] - %tmp878 = and i64 %tmp876, 1 - %tmp879 = icmp eq i64 %tmp878, 0 - %tmp880 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp15, i64 0, i64 %tmp876 - %tmp881 = load i32, i32* %tmp880, align 4 - %tmp882 = sub i32 0, %tmp881 - %tmp883 = select i1 %tmp879, i32 %tmp881, i32 %tmp882 - %tmp884 = add i32 %tmp883, %tmp877 - %tmp885 = add nuw nsw i64 %tmp876, 1 - %tmp886 = and i64 %tmp885, 1 - %tmp887 = icmp eq i64 %tmp886, 0 - %tmp888 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp15, i64 0, i64 %tmp885 - %tmp889 = load i32, i32* %tmp888, align 4 - %tmp890 = sub i32 0, %tmp889 - %tmp891 = select i1 %tmp887, i32 %tmp889, i32 %tmp890 - %tmp892 = add i32 %tmp891, %tmp884 - %tmp893 = add nuw nsw i64 %tmp876, 2 - %tmp894 = and i64 %tmp893, 1 - %tmp895 = icmp eq i64 %tmp894, 0 - %tmp896 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp15, i64 0, i64 %tmp893 - %tmp897 = load i32, i32* %tmp896, align 4 - %tmp898 = sub i32 0, %tmp897 - %tmp899 = select i1 %tmp895, i32 %tmp897, i32 %tmp898 - %tmp900 = add i32 %tmp899, %tmp892 - %tmp901 = add nuw nsw i64 %tmp876, 3 - %tmp902 = and i64 %tmp901, 1 - %tmp903 = icmp eq i64 %tmp902, 0 - %tmp904 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp15, i64 0, i64 %tmp901 - %tmp905 = load i32, i32* %tmp904, align 4 - %tmp906 = sub i32 0, %tmp905 - %tmp907 = select i1 %tmp903, i32 %tmp905, i32 %tmp906 - %tmp908 = add i32 %tmp907, %tmp900 - %tmp909 = add nuw nsw i64 %tmp876, 4 - %tmp910 = and i64 %tmp909, 1 - %tmp911 = icmp eq i64 %tmp910, 0 - %tmp912 = getelementptr inbounds [100 x i32], [100 x i32]* %tmp15, i64 0, i64 %tmp909 - %tmp913 = load i32, i32* %tmp912, align 4 - %tmp914 = sub i32 0, %tmp913 - %tmp915 = select i1 %tmp911, i32 %tmp913, i32 %tmp914 - %tmp916 = add i32 %tmp915, %tmp908 - %tmp917 = add nuw nsw i64 %tmp876, 5 - %tmp918 = icmp eq i64 %tmp917, 100 - br i1 %tmp918, label %bb919, label %bb875 - -bb919: ; preds = %bb919, %bb875 - %tmp920 = phi i64 [ %tmp961, %bb919 ], [ 0, %bb875 ] - %tmp921 = phi i32 [ %tmp960, %bb919 ], [ 0, %bb875 ] - %tmp922 = and i64 %tmp920, 1 - %tmp923 = icmp eq i64 %tmp922, 0 - %tmp924 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp16, i64 0, i64 0, i64 %tmp920 - %tmp925 = load i32, i32* %tmp924, align 4 - %tmp926 = sub i32 0, %tmp925 - %tmp927 = select i1 %tmp923, i32 %tmp925, i32 %tmp926 - %tmp928 = add i32 %tmp927, %tmp921 - %tmp929 = add nuw nsw i64 %tmp920, 1 - %tmp930 = and i64 %tmp929, 1 - %tmp931 = icmp eq i64 %tmp930, 0 - %tmp932 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp16, i64 0, i64 0, i64 %tmp929 - %tmp933 = load i32, i32* %tmp932, align 4 - %tmp934 = sub i32 0, %tmp933 - %tmp935 = select i1 %tmp931, i32 %tmp933, i32 %tmp934 - %tmp936 = add i32 %tmp935, %tmp928 - %tmp937 = add nuw nsw i64 %tmp920, 2 - %tmp938 = and i64 %tmp937, 1 - %tmp939 = icmp eq i64 %tmp938, 0 - %tmp940 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp16, i64 0, i64 0, i64 %tmp937 - %tmp941 = load i32, i32* %tmp940, align 4 - %tmp942 = sub i32 0, %tmp941 - %tmp943 = select i1 %tmp939, i32 %tmp941, i32 %tmp942 - %tmp944 = add i32 %tmp943, %tmp936 - %tmp945 = add nuw nsw i64 %tmp920, 3 - %tmp946 = and i64 %tmp945, 1 - %tmp947 = icmp eq i64 %tmp946, 0 - %tmp948 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp16, i64 0, i64 0, i64 %tmp945 - %tmp949 = load i32, i32* %tmp948, align 4 - %tmp950 = sub i32 0, %tmp949 - %tmp951 = select i1 %tmp947, i32 %tmp949, i32 %tmp950 - %tmp952 = add i32 %tmp951, %tmp944 - %tmp953 = add nuw nsw i64 %tmp920, 4 - %tmp954 = and i64 %tmp953, 1 - %tmp955 = icmp eq i64 %tmp954, 0 - %tmp956 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp16, i64 0, i64 0, i64 %tmp953 - %tmp957 = load i32, i32* %tmp956, align 4 - %tmp958 = sub i32 0, %tmp957 - %tmp959 = select i1 %tmp955, i32 %tmp957, i32 %tmp958 - %tmp960 = add i32 %tmp959, %tmp952 - %tmp961 = add nuw nsw i64 %tmp920, 5 - %tmp962 = icmp eq i64 %tmp961, 10000 - br i1 %tmp962, label %bb963, label %bb919 - -bb963: ; preds = %bb963, %bb919 - %tmp964 = phi i64 [ %tmp1005, %bb963 ], [ 0, %bb919 ] - %tmp965 = phi i32 [ %tmp1004, %bb963 ], [ 0, %bb919 ] - %tmp966 = and i64 %tmp964, 1 - %tmp967 = icmp eq i64 %tmp966, 0 - %tmp968 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp17, i64 0, i64 0, i64 %tmp964 - %tmp969 = load i32, i32* %tmp968, align 4 - %tmp970 = sub i32 0, %tmp969 - %tmp971 = select i1 %tmp967, i32 %tmp969, i32 %tmp970 - %tmp972 = add i32 %tmp971, %tmp965 - %tmp973 = add nuw nsw i64 %tmp964, 1 - %tmp974 = and i64 %tmp973, 1 - %tmp975 = icmp eq i64 %tmp974, 0 - %tmp976 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp17, i64 0, i64 0, i64 %tmp973 - %tmp977 = load i32, i32* %tmp976, align 4 - %tmp978 = sub i32 0, %tmp977 - %tmp979 = select i1 %tmp975, i32 %tmp977, i32 %tmp978 - %tmp980 = add i32 %tmp979, %tmp972 - %tmp981 = add nuw nsw i64 %tmp964, 2 - %tmp982 = and i64 %tmp981, 1 - %tmp983 = icmp eq i64 %tmp982, 0 - %tmp984 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp17, i64 0, i64 0, i64 %tmp981 - %tmp985 = load i32, i32* %tmp984, align 4 - %tmp986 = sub i32 0, %tmp985 - %tmp987 = select i1 %tmp983, i32 %tmp985, i32 %tmp986 - %tmp988 = add i32 %tmp987, %tmp980 - %tmp989 = add nuw nsw i64 %tmp964, 3 - %tmp990 = and i64 %tmp989, 1 - %tmp991 = icmp eq i64 %tmp990, 0 - %tmp992 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp17, i64 0, i64 0, i64 %tmp989 - %tmp993 = load i32, i32* %tmp992, align 4 - %tmp994 = sub i32 0, %tmp993 - %tmp995 = select i1 %tmp991, i32 %tmp993, i32 %tmp994 - %tmp996 = add i32 %tmp995, %tmp988 - %tmp997 = add nuw nsw i64 %tmp964, 4 - %tmp998 = and i64 %tmp997, 1 - %tmp999 = icmp eq i64 %tmp998, 0 - %tmp1000 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp17, i64 0, i64 0, i64 %tmp997 - %tmp1001 = load i32, i32* %tmp1000, align 4 - %tmp1002 = sub i32 0, %tmp1001 - %tmp1003 = select i1 %tmp999, i32 %tmp1001, i32 %tmp1002 - %tmp1004 = add i32 %tmp1003, %tmp996 - %tmp1005 = add nuw nsw i64 %tmp964, 5 - %tmp1006 = icmp eq i64 %tmp1005, 10000 - br i1 %tmp1006, label %bb1007, label %bb963 - -bb1007: ; preds = %bb1007, %bb963 - %tmp1008 = phi i64 [ %tmp1049, %bb1007 ], [ 0, %bb963 ] - %tmp1009 = phi i32 [ %tmp1048, %bb1007 ], [ 0, %bb963 ] - %tmp1010 = and i64 %tmp1008, 1 - %tmp1011 = icmp eq i64 %tmp1010, 0 - %tmp1012 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp18, i64 0, i64 0, i64 %tmp1008 - %tmp1013 = load i32, i32* %tmp1012, align 4 - %tmp1014 = sub i32 0, %tmp1013 - %tmp1015 = select i1 %tmp1011, i32 %tmp1013, i32 %tmp1014 - %tmp1016 = add i32 %tmp1015, %tmp1009 - %tmp1017 = add nuw nsw i64 %tmp1008, 1 - %tmp1018 = and i64 %tmp1017, 1 - %tmp1019 = icmp eq i64 %tmp1018, 0 - %tmp1020 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp18, i64 0, i64 0, i64 %tmp1017 - %tmp1021 = load i32, i32* %tmp1020, align 4 - %tmp1022 = sub i32 0, %tmp1021 - %tmp1023 = select i1 %tmp1019, i32 %tmp1021, i32 %tmp1022 - %tmp1024 = add i32 %tmp1023, %tmp1016 - %tmp1025 = add nuw nsw i64 %tmp1008, 2 - %tmp1026 = and i64 %tmp1025, 1 - %tmp1027 = icmp eq i64 %tmp1026, 0 - %tmp1028 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp18, i64 0, i64 0, i64 %tmp1025 - %tmp1029 = load i32, i32* %tmp1028, align 4 - %tmp1030 = sub i32 0, %tmp1029 - %tmp1031 = select i1 %tmp1027, i32 %tmp1029, i32 %tmp1030 - %tmp1032 = add i32 %tmp1031, %tmp1024 - %tmp1033 = add nuw nsw i64 %tmp1008, 3 - %tmp1034 = and i64 %tmp1033, 1 - %tmp1035 = icmp eq i64 %tmp1034, 0 - %tmp1036 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp18, i64 0, i64 0, i64 %tmp1033 - %tmp1037 = load i32, i32* %tmp1036, align 4 - %tmp1038 = sub i32 0, %tmp1037 - %tmp1039 = select i1 %tmp1035, i32 %tmp1037, i32 %tmp1038 - %tmp1040 = add i32 %tmp1039, %tmp1032 - %tmp1041 = add nuw nsw i64 %tmp1008, 4 - %tmp1042 = and i64 %tmp1041, 1 - %tmp1043 = icmp eq i64 %tmp1042, 0 - %tmp1044 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %tmp18, i64 0, i64 0, i64 %tmp1041 - %tmp1045 = load i32, i32* %tmp1044, align 4 - %tmp1046 = sub i32 0, %tmp1045 - %tmp1047 = select i1 %tmp1043, i32 %tmp1045, i32 %tmp1046 - %tmp1048 = add i32 %tmp1047, %tmp1040 - %tmp1049 = add nuw nsw i64 %tmp1008, 5 - %tmp1050 = icmp eq i64 %tmp1049, 10000 - br i1 %tmp1050, label %bb1051, label %bb1007 - -bb1051: ; preds = %bb1007 - %tmp1052 = add i32 %tmp382, %tmp385 - %tmp1053 = add i32 %tmp1052, %tmp520 - %tmp1054 = add i32 %tmp1053, %tmp564 - %tmp1055 = sub i32 %tmp1054, %tmp608 - %tmp1056 = add i32 %tmp1055, %tmp652 - %tmp1057 = sub i32 %tmp1056, %tmp696 - %tmp1058 = add i32 %tmp1057, %tmp740 - %tmp1059 = sub i32 %tmp1058, %tmp784 - %tmp1060 = add i32 %tmp1059, %tmp828 - %tmp1061 = sub i32 %tmp1060, %tmp872 - %tmp1062 = add i32 %tmp1061, %tmp916 - %tmp1063 = sub i32 %tmp1062, %tmp960 - %tmp1064 = add i32 %tmp1063, %tmp1004 - %tmp1065 = sub i32 %tmp1064, %tmp1048 - call void @llvm.lifetime.end.p0i8(i64 40000, i8* nonnull %tmp31) #4 - call void @llvm.lifetime.end.p0i8(i64 40000, i8* nonnull %tmp30) #4 - call void @llvm.lifetime.end.p0i8(i64 40000, i8* nonnull %tmp29) #4 - call void @llvm.lifetime.end.p0i8(i64 400, i8* nonnull %tmp28) #4 - call void @llvm.lifetime.end.p0i8(i64 40000, i8* nonnull %tmp27) #4 - call void @llvm.lifetime.end.p0i8(i64 400, i8* nonnull %tmp26) #4 - call void @llvm.lifetime.end.p0i8(i64 400, i8* nonnull %tmp25) #4 - call void @llvm.lifetime.end.p0i8(i64 40000, i8* nonnull %tmp24) #4 - call void @llvm.lifetime.end.p0i8(i64 400, i8* nonnull %tmp23) #4 - call void @llvm.lifetime.end.p0i8(i64 40000, i8* nonnull %tmp22) #4 - call void @llvm.lifetime.end.p0i8(i64 400, i8* nonnull %tmp21) #4 - call void @llvm.lifetime.end.p0i8(i64 400, i8* nonnull %tmp20) #4 - call void @llvm.lifetime.end.p0i8(i64 400, i8* nonnull %tmp19) #4 - ret i32 %tmp1065 -} - -; Function Attrs: argmemonly nounwind -declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1) #1 - -; Function Attrs: argmemonly nounwind -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1) #1 diff --git a/llvm/test/Transforms/LoopStrengthReduce/lsr-overflow.ll b/llvm/test/Transforms/LoopStrengthReduce/lsr-overflow.ll deleted file mode 100644 index 0bfc62e6d77..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/lsr-overflow.ll +++ /dev/null @@ -1,39 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -lsr-complexity-limit=50 -loop-reduce -S %s | FileCheck %s - -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" - -define void @overflow1(i64 %a) { -; CHECK-LABEL: @overflow1( -; CHECK-NEXT: bb: -; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[A:%.*]], -1 -; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[A]], -9223372036854775808 -; CHECK-NEXT: br label [[BB1:%.*]] -; CHECK: bb1: -; CHECK-NEXT: [[LSR_IV1:%.*]] = phi i64 [ [[LSR_IV_NEXT2:%.*]], [[BB1]] ], [ [[TMP1]], [[BB:%.*]] ] -; CHECK-NEXT: [[LSR_IV:%.*]] = phi i64 [ [[LSR_IV_NEXT:%.*]], [[BB1]] ], [ [[TMP0]], [[BB]] ] -; CHECK-NEXT: [[TMP4:%.*]] = icmp ne i64 [[LSR_IV1]], 0 -; CHECK-NEXT: [[TMP5:%.*]] = and i1 [[TMP4]], true -; CHECK-NEXT: [[LSR_IV_NEXT]] = add i64 [[LSR_IV]], 1 -; CHECK-NEXT: [[LSR_IV_NEXT2]] = add i64 [[LSR_IV1]], 1 -; CHECK-NEXT: br i1 [[TMP5]], label [[BB1]], label [[BB7:%.*]] -; CHECK: bb7: -; CHECK-NEXT: [[TMP9:%.*]] = and i64 [[LSR_IV_NEXT]], 1 -; CHECK-NEXT: [[TMP10:%.*]] = icmp eq i64 [[TMP9]], 0 -; CHECK-NEXT: unreachable -; -bb: - br label %bb1 - -bb1: ; preds = %bb1, %bb - %tmp = phi i64 [ %a, %bb ], [ %tmp6, %bb1 ] - %tmp4 = icmp ne i64 %tmp, -9223372036854775808 - %tmp5 = and i1 %tmp4, 1 - %tmp6 = add i64 %tmp, 1 - br i1 %tmp5, label %bb1, label %bb7 - -bb7: ; preds = %bb1 - %tmp9 = and i64 %tmp, 1 - %tmp10 = icmp eq i64 %tmp9, 0 - unreachable -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/missing-phi-operand-update.ll b/llvm/test/Transforms/LoopStrengthReduce/missing-phi-operand-update.ll deleted file mode 100644 index 3b96509e6b4..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/missing-phi-operand-update.ll +++ /dev/null @@ -1,101 +0,0 @@ -; PR41445: This test checks the case when LSR split critical edge -; and phi node has other pending fixup operands - -; RUN: opt -S -loop-reduce < %s | FileCheck %s - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -; We have %indvars.iv.lcssa phi node where 4 input operands -; need to be rewritten: %tmp1, %tmp2, %tmp3, %tmp4. -; When we try to rewrite %tmp1, we first split the critical edge. -; All the other PHI inputs besides %tmp1 go to a new phi node. -; This test checks that LSR is still able to rewrite %tmp2, %tmp3, %tmp4. -define i32 @foo(i32* %A, i32 %t) { -entry: - br label %loop.32 - -loop.exit: ; preds = %then.8.1, %then.8, %ifmerge.42, %ifmerge.38, %ifmerge.34, %then.34 - %indvars.iv.lcssa = phi i64 [ 48, %then.8 ], [ 49, %then.8.1 ], [ %tmp4, %ifmerge.42 ], [ %tmp3, %ifmerge.38 ], [ %tmp2, %ifmerge.34 ], [ %tmp1, %then.34 ] - %tmp = trunc i64 %indvars.iv.lcssa to i32 - br label %for.end - -for.end: ; preds = %then.8.1, %ifmerge.8, %loop.exit - %i.0.lcssa = phi i32 [ %tmp, %loop.exit ], [ 50, %then.8.1 ], [ 50, %ifmerge.8 ] - ret i32 %i.0.lcssa - -; shl instruction will be dead eliminated when all it's uses will be rewritten. -; CHECK-LABEL: loop.32: -; CHECK-NOT: shl -loop.32: ; preds = %ifmerge.46, %entry - %i1.i64.0 = phi i64 [ 0, %entry ], [ %nextivloop.32, %ifmerge.46 ] - %tmp1 = shl i64 %i1.i64.0, 2 - %tmp2 = or i64 %tmp1, 1 - %arrayIdx = getelementptr inbounds i32, i32* %A, i64 %tmp2 - %gepload = load i32, i32* %arrayIdx, align 4 - %cmp.34 = icmp sgt i32 %gepload, %t - br i1 %cmp.34, label %then.34, label %ifmerge.34 - -; CHECK-LABEL: then.34: -then.34: ; preds = %loop.32 - %arrayIdx17 = getelementptr inbounds i32, i32* %A, i64 %tmp1 - %gepload18 = load i32, i32* %arrayIdx17, align 4 - %cmp.35 = icmp slt i32 %gepload18, %t - br i1 %cmp.35, label %loop.exit, label %ifmerge.34 - -ifmerge.34: ; preds = %then.34, %loop.32 - %tmp3 = or i64 %tmp1, 2 - %arrayIdx19 = getelementptr inbounds i32, i32* %A, i64 %tmp3 - %gepload20 = load i32, i32* %arrayIdx19, align 4 - %cmp.38 = icmp sgt i32 %gepload20, %t - %cmp.39 = icmp slt i32 %gepload, %t - %or.cond = and i1 %cmp.38, %cmp.39 - br i1 %or.cond, label %loop.exit, label %ifmerge.38 - -ifmerge.38: ; preds = %ifmerge.34 - %tmp4 = or i64 %tmp1, 3 - %arrayIdx23 = getelementptr inbounds i32, i32* %A, i64 %tmp4 - %gepload24 = load i32, i32* %arrayIdx23, align 4 - %cmp.42 = icmp sgt i32 %gepload24, %t - %cmp.43 = icmp slt i32 %gepload20, %t - %or.cond55 = and i1 %cmp.42, %cmp.43 - br i1 %or.cond55, label %loop.exit, label %ifmerge.42 - -ifmerge.42: ; preds = %ifmerge.38 - %tmp5 = add i64 %tmp1, 4 - %arrayIdx27 = getelementptr inbounds i32, i32* %A, i64 %tmp5 - %gepload28 = load i32, i32* %arrayIdx27, align 4 - %cmp.46 = icmp sgt i32 %gepload28, %t - %cmp.47 = icmp slt i32 %gepload24, %t - %or.cond56 = and i1 %cmp.46, %cmp.47 - br i1 %or.cond56, label %loop.exit, label %ifmerge.46 - -ifmerge.46: ; preds = %ifmerge.42 - %nextivloop.32 = add nuw nsw i64 %i1.i64.0, 1 - %condloop.32 = icmp ult i64 %nextivloop.32, 12 - br i1 %condloop.32, label %loop.32, label %loop.25 - -loop.25: ; preds = %ifmerge.46 - %arrayIdx31 = getelementptr inbounds i32, i32* %A, i64 49 - %gepload32 = load i32, i32* %arrayIdx31, align 4 - %cmp.8 = icmp sgt i32 %gepload32, %t - br i1 %cmp.8, label %then.8, label %ifmerge.8 - -then.8: ; preds = %loop.25 - %arrayIdx33 = getelementptr inbounds i32, i32* %A, i64 48 - %gepload34 = load i32, i32* %arrayIdx33, align 4 - %cmp.15 = icmp slt i32 %gepload34, %t - br i1 %cmp.15, label %loop.exit, label %ifmerge.8 - -ifmerge.8: ; preds = %then.8, %loop.25 - %arrayIdx31.1 = getelementptr inbounds i32, i32* %A, i64 50 - %gepload32.1 = load i32, i32* %arrayIdx31.1, align 4 - %cmp.8.1 = icmp sgt i32 %gepload32.1, %t - br i1 %cmp.8.1, label %then.8.1, label %for.end - -then.8.1: ; preds = %ifmerge.8 - %arrayIdx33.1 = getelementptr inbounds i32, i32* %A, i64 49 - %gepload34.1 = load i32, i32* %arrayIdx33.1, align 4 - %cmp.15.1 = icmp slt i32 %gepload34.1, %t - br i1 %cmp.15.1, label %loop.exit, label %for.end -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/negative-scale.ll b/llvm/test/Transforms/LoopStrengthReduce/negative-scale.ll deleted file mode 100644 index fdde1b6bf9d..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/negative-scale.ll +++ /dev/null @@ -1,28 +0,0 @@ -; RUN: opt < %s -loop-reduce -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" - -declare void @foo(i8) - -define void @not_addressing_mode(i8* %input, i64 %n) { -; CHECK-LABEL: @not_addressing_mode( -entry: - br label %loop - -loop: -; CHECK: loop: -; CHECK: %lsr.iv = phi i8* [ {{%[^,]+}}, %loop ], [ %input, %entry ] - %i = phi i64 [ 0, %entry ], [ %i.next, %loop ] - %i.next = add i64 %i, 1 - %j = mul i64 %i, -2 - ; (%input - 2 * %j) is not foldable. Worth another indvar. - %p = getelementptr i8, i8* %input, i64 %j - %v = load i8, i8* %p -; CHECK: %v = load i8, i8* %lsr.iv - call void @foo(i8 %v) - %exitcond = icmp slt i64 %i.next, %n - br i1 %exitcond, label %exit, label %loop - -exit: - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/nested-reduce.ll b/llvm/test/Transforms/LoopStrengthReduce/nested-reduce.ll deleted file mode 100644 index c05b19d8fdd..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/nested-reduce.ll +++ /dev/null @@ -1,52 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | not grep mul - -; Provide legal integer types. -target datalayout = "n8:16:32:64" - -; Make sure we don't get a multiply by 6 in this loop. - -define i32 @foo(i32 %A, i32 %B, i32 %C, i32 %D) { -entry: - %tmp.5 = icmp sgt i32 %C, 0 ; <i1> [#uses=1] - %tmp.25 = and i32 %A, 1 ; <i32> [#uses=1] - br label %loopentry.1 -loopentry.1: ; preds = %loopexit.1, %entry - %indvar20 = phi i32 [ 0, %entry ], [ %indvar.next21, %loopexit.1 ] ; <i32> [#uses=2] - %k.1 = phi i32 [ 0, %entry ], [ %k.1.3, %loopexit.1 ] ; <i32> [#uses=2] - br i1 %tmp.5, label %no_exit.1.preheader, label %loopexit.1 -no_exit.1.preheader: ; preds = %loopentry.1 - %i.0.0 = bitcast i32 %indvar20 to i32 ; <i32> [#uses=1] - %tmp.9 = mul i32 %i.0.0, 6 ; <i32> [#uses=1] - br label %no_exit.1.outer -no_exit.1.outer: ; preds = %cond_true, %no_exit.1.preheader - %k.1.2.ph = phi i32 [ %k.1, %no_exit.1.preheader ], [ %k.09, %cond_true ] ; <i32> [#uses=2] - %j.1.2.ph = phi i32 [ 0, %no_exit.1.preheader ], [ %inc.1, %cond_true ] ; <i32> [#uses=1] - br label %no_exit.1 -no_exit.1: ; preds = %cond_continue, %no_exit.1.outer - %indvar.ui = phi i32 [ 0, %no_exit.1.outer ], [ %indvar.next, %cond_continue ] ; <i32> [#uses=2] - %indvar = bitcast i32 %indvar.ui to i32 ; <i32> [#uses=1] - %j.1.2 = add i32 %indvar, %j.1.2.ph ; <i32> [#uses=2] - %tmp.11 = add i32 %j.1.2, %tmp.9 ; <i32> [#uses=1] - %tmp.12 = trunc i32 %tmp.11 to i8 ; <i8> [#uses=1] - %shift.upgrd.1 = zext i8 %tmp.12 to i32 ; <i32> [#uses=1] - %tmp.13 = shl i32 %D, %shift.upgrd.1 ; <i32> [#uses=2] - %tmp.15 = icmp eq i32 %tmp.13, %B ; <i1> [#uses=1] - %inc.1 = add i32 %j.1.2, 1 ; <i32> [#uses=3] - br i1 %tmp.15, label %cond_true, label %cond_continue -cond_true: ; preds = %no_exit.1 - %tmp.26 = and i32 %tmp.25, %tmp.13 ; <i32> [#uses=1] - %k.09 = add i32 %tmp.26, %k.1.2.ph ; <i32> [#uses=2] - %tmp.517 = icmp slt i32 %inc.1, %C ; <i1> [#uses=1] - br i1 %tmp.517, label %no_exit.1.outer, label %loopexit.1 -cond_continue: ; preds = %no_exit.1 - %tmp.519 = icmp slt i32 %inc.1, %C ; <i1> [#uses=1] - %indvar.next = add i32 %indvar.ui, 1 ; <i32> [#uses=1] - br i1 %tmp.519, label %no_exit.1, label %loopexit.1 -loopexit.1: ; preds = %cond_continue, %cond_true, %loopentry.1 - %k.1.3 = phi i32 [ %k.1, %loopentry.1 ], [ %k.09, %cond_true ], [ %k.1.2.ph, %cond_continue ] ; <i32> [#uses=2] - %indvar.next21 = add i32 %indvar20, 1 ; <i32> [#uses=2] - %exitcond = icmp eq i32 %indvar.next21, 4 ; <i1> [#uses=1] - br i1 %exitcond, label %loopexit.0, label %loopentry.1 -loopexit.0: ; preds = %loopexit.1 - ret i32 %k.1.3 -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/nonintegral.ll b/llvm/test/Transforms/LoopStrengthReduce/nonintegral.ll deleted file mode 100644 index 5648e3aa74a..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/nonintegral.ll +++ /dev/null @@ -1,45 +0,0 @@ -; RUN: opt -S -loop-reduce < %s | FileCheck %s - -; Address Space 10 is non-integral. The optimizer is not allowed to use -; ptrtoint/inttoptr instructions. Make sure that this doesn't happen -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:10:11:12" -target triple = "x86_64-unknown-linux-gnu" - -define void @japi1__unsafe_getindex_65028(i64 addrspace(10)* %arg) { -; CHECK-NOT: inttoptr -; CHECK-NOT: ptrtoint -; How exactly SCEV chooses to materialize isn't all that important, as -; long as it doesn't try to round-trip through integers. As of this writing, -; it emits a byte-wise gep, which is fine. -; CHECK: getelementptr i64, i64 addrspace(10)* {{.*}}, i64 {{.*}} -top: - br label %L86 - -L86: ; preds = %L86, %top - %i.0 = phi i64 [ 0, %top ], [ %tmp, %L86 ] - %tmp = add i64 %i.0, 1 - br i1 undef, label %L86, label %if29 - -if29: ; preds = %L86 - %tmp1 = shl i64 %tmp, 1 - %tmp2 = add i64 %tmp1, -2 - br label %if31 - -if31: ; preds = %if38, %if29 - %"#temp#1.sroa.0.022" = phi i64 [ 0, %if29 ], [ %tmp3, %if38 ] - br label %L119 - -L119: ; preds = %L119, %if31 - %i5.0 = phi i64 [ %"#temp#1.sroa.0.022", %if31 ], [ %tmp3, %L119 ] - %tmp3 = add i64 %i5.0, 1 - br i1 undef, label %L119, label %if38 - -if38: ; preds = %L119 - %tmp4 = add i64 %tmp2, %i5.0 - %tmp5 = getelementptr i64, i64 addrspace(10)* %arg, i64 %tmp4 - %tmp6 = load i64, i64 addrspace(10)* %tmp5 - br i1 undef, label %done, label %if31 - -done: ; preds = %if38 - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/nonlinear-postinc.ll b/llvm/test/Transforms/LoopStrengthReduce/nonlinear-postinc.ll deleted file mode 100644 index 1e63770553d..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/nonlinear-postinc.ll +++ /dev/null @@ -1,44 +0,0 @@ -; RUN: opt < %s -loop-reduce -; PR6453 - -target datalayout = "e-p:64:64:64" - -define void @_ZNK15PolynomialSpaceILi3EE13compute_indexEjRA3_j() nounwind { -entry: - br label %bb6 - -bb6: - %t4 = phi i32 [ 0, %entry ], [ %t3, %bb5 ] - %t16 = sub i32 undef, %t4 - %t25 = sub i32 undef, %t4 - %t26 = add i32 undef, %t25 - br label %bb4 - -bb4: - %t2 = phi i32 [ %t1, %bb3 ], [ 0, %bb6 ] - %t17 = mul i32 %t2, %t16 - %t18 = zext i32 %t2 to i33 - %t19 = add i32 %t2, -1 - %t20 = zext i32 %t19 to i33 - %t21 = mul i33 %t18, %t20 - %t22 = lshr i33 %t21, 1 - %t23 = trunc i33 %t22 to i32 - %t24 = sub i32 %t17, %t23 - %t27 = add i32 %t24, %t26 - br i1 false, label %bb1, label %bb5 - -bb1: - %t = icmp ugt i32 %t27, undef - br i1 %t, label %bb2, label %bb3 - -bb3: - %t1 = add i32 %t2, 1 - br label %bb4 - -bb5: - %t3 = add i32 %t4, 1 - br label %bb6 - -bb2: - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/ops_after_indvar.ll b/llvm/test/Transforms/LoopStrengthReduce/ops_after_indvar.ll deleted file mode 100644 index ad2caeb274f..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/ops_after_indvar.ll +++ /dev/null @@ -1,26 +0,0 @@ -; Check that this test makes INDVAR and related stuff dead, because P[indvar] -; gets reduced, making INDVAR dead. - -; RUN: opt < %s -loop-reduce -S | not grep INDVAR - -target datalayout = "e-p:32:32:32-n32" - -declare i1 @pred() - -declare i32 @getidx() - -define void @test([10000 x i32]* %P) { -; <label>:0 - br label %Loop -Loop: ; preds = %Loop, %0 - %INDVAR = phi i32 [ 0, %0 ], [ %INDVAR2, %Loop ] ; <i32> [#uses=2] - %idx = call i32 @getidx( ) ; <i32> [#uses=1] - %STRRED = getelementptr [10000 x i32], [10000 x i32]* %P, i32 %INDVAR, i32 %idx ; <i32*> [#uses=1] - store i32 0, i32* %STRRED - %INDVAR2 = add i32 %INDVAR, 1 ; <i32> [#uses=1] - %cond = call i1 @pred( ) ; <i1> [#uses=1] - br i1 %cond, label %Loop, label %Out -Out: ; preds = %Loop - ret void -} - diff --git a/llvm/test/Transforms/LoopStrengthReduce/phi_node_update_multiple_preds.ll b/llvm/test/Transforms/LoopStrengthReduce/phi_node_update_multiple_preds.ll deleted file mode 100644 index 6943ab9f29a..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/phi_node_update_multiple_preds.ll +++ /dev/null @@ -1,28 +0,0 @@ -; RUN: opt < %s -loop-reduce -disable-output -; LSR should not crash on this. - -define fastcc void @loadloop() { -entry: - switch i8 0, label %shortcirc_next [ - i8 32, label %loopexit.2 - i8 59, label %loopexit.2 - ] -shortcirc_next: ; preds = %no_exit.2, %entry - %indvar37 = phi i32 [ 0, %entry ], [ %indvar.next38, %no_exit.2 ] ; <i32> [#uses=3] - %gep.upgrd.1 = zext i32 %indvar37 to i64 ; <i64> [#uses=1] - %wp.2.4 = getelementptr i8, i8* null, i64 %gep.upgrd.1 ; <i8*> [#uses=1] - br i1 false, label %loopexit.2, label %no_exit.2 -no_exit.2: ; preds = %shortcirc_next - %wp.2.4.rec = bitcast i32 %indvar37 to i32 ; <i32> [#uses=1] - %inc.1.rec = add i32 %wp.2.4.rec, 1 ; <i32> [#uses=1] - %inc.1 = getelementptr i8, i8* null, i32 %inc.1.rec ; <i8*> [#uses=2] - %indvar.next38 = add i32 %indvar37, 1 ; <i32> [#uses=1] - switch i8 0, label %shortcirc_next [ - i8 32, label %loopexit.2 - i8 59, label %loopexit.2 - ] -loopexit.2: ; preds = %no_exit.2, %no_exit.2, %shortcirc_next, %entry, %entry - %wp.2.7 = phi i8* [ null, %entry ], [ null, %entry ], [ %wp.2.4, %shortcirc_next ], [ %inc.1, %no_exit.2 ], [ %inc.1, %no_exit.2 ] ; <i8*> [#uses=0] - ret void -} - diff --git a/llvm/test/Transforms/LoopStrengthReduce/post-inc-icmpzero.ll b/llvm/test/Transforms/LoopStrengthReduce/post-inc-icmpzero.ll deleted file mode 100644 index 6d670c84c48..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/post-inc-icmpzero.ll +++ /dev/null @@ -1,92 +0,0 @@ -; RUN: opt -loop-reduce -S < %s | FileCheck %s -; PR9939 - -; LSR should properly handle the post-inc offset when folding the -; non-IV operand of an icmp into the IV. - -; CHECK: [[r1:%[a-z0-9\.]+]] = sub i64 %sub.ptr.lhs.cast, %sub.ptr.rhs.cast -; CHECK: [[r2:%[a-z0-9\.]+]] = lshr exact i64 [[r1]], 1 -; CHECK: [[r3:%[a-z0-9\.]+]] = bitcast i64 [[r2]] to i64 -; CHECK: for.body.lr.ph: -; CHECK: [[r4:%[a-z0-9]+]] = shl i64 [[r3]], 1 -; CHECK: br label %for.body -; CHECK: for.body: -; CHECK: %lsr.iv2 = phi i64 [ %lsr.iv.next, %for.body ], [ [[r4]], %for.body.lr.ph ] -; CHECK: %lsr.iv.next = add i64 %lsr.iv2, -2 -; CHECK: %lsr.iv.next3 = inttoptr i64 %lsr.iv.next to i16* -; CHECK: %cmp27 = icmp eq i16* %lsr.iv.next3, null - -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.Vector2 = type { i16*, [64 x i16], i32 } - -@.str = private unnamed_addr constant [37 x i8] c"0123456789abcdefghijklmnopqrstuvwxyz\00" - -define void @_Z15IntegerToStringjjR7Vector2(i32 %i, i32 %radix, %struct.Vector2* nocapture %result) nounwind noinline { -entry: - %buffer = alloca [33 x i16], align 16 - %add.ptr = getelementptr inbounds [33 x i16], [33 x i16]* %buffer, i64 0, i64 33 - %sub.ptr.lhs.cast = ptrtoint i16* %add.ptr to i64 - %sub.ptr.rhs.cast = ptrtoint i16* %add.ptr to i64 - br label %do.body - -do.body: ; preds = %do.body, %entry - %0 = phi i64 [ %indvar.next44, %do.body ], [ 0, %entry ] - %i.addr.0 = phi i32 [ %div, %do.body ], [ %i, %entry ] - %tmp51 = sub i64 32, %0 - %incdec.ptr = getelementptr [33 x i16], [33 x i16]* %buffer, i64 0, i64 %tmp51 - %rem = urem i32 %i.addr.0, 10 - %div = udiv i32 %i.addr.0, 10 - %idxprom = zext i32 %rem to i64 - %arrayidx = getelementptr inbounds [37 x i8], [37 x i8]* @.str, i64 0, i64 %idxprom - %tmp5 = load i8, i8* %arrayidx, align 1 - %conv = sext i8 %tmp5 to i16 - store i16 %conv, i16* %incdec.ptr, align 2 - %1 = icmp ugt i32 %i.addr.0, 9 - %indvar.next44 = add i64 %0, 1 - br i1 %1, label %do.body, label %do.end - -do.end: ; preds = %do.body - %xap.0 = inttoptr i64 %0 to i1* - %cap.0 = ptrtoint i1* %xap.0 to i64 - %sub.ptr.sub = sub i64 %sub.ptr.lhs.cast, %sub.ptr.rhs.cast - %sub.ptr.div39 = lshr exact i64 %sub.ptr.sub, 1 - %conv11 = trunc i64 %sub.ptr.div39 to i32 - %mLength = getelementptr inbounds %struct.Vector2, %struct.Vector2* %result, i64 0, i32 2 - %idx.ext21 = bitcast i64 %sub.ptr.div39 to i64 - %incdec.ptr.sum = add i64 %idx.ext21, -1 - %cp.0.sum = sub i64 %incdec.ptr.sum, %0 - %add.ptr22 = getelementptr [33 x i16], [33 x i16]* %buffer, i64 1, i64 %cp.0.sum - %cmp2740 = icmp eq i64 %idx.ext21, 0 - br i1 %cmp2740, label %for.end, label %for.body.lr.ph - -for.body.lr.ph: ; preds = %do.end - %tmp16 = load i32, i32* %mLength, align 4 - %mBegin = getelementptr inbounds %struct.Vector2, %struct.Vector2* %result, i64 0, i32 0 - %tmp14 = load i16*, i16** %mBegin, align 8 - %tmp48 = zext i32 %tmp16 to i64 - br label %for.body - -for.body: ; preds = %for.body, %for.body.lr.ph - %indvar = phi i64 [ 0, %for.body.lr.ph ], [ %indvar.next, %for.body ] - %tmp46 = add i64 %tmp51, %indvar - %p.042 = getelementptr [33 x i16], [33 x i16]* %buffer, i64 0, i64 %tmp46 - %tmp47 = sub i64 %indvar, %0 - %incdec.ptr32 = getelementptr [33 x i16], [33 x i16]* %buffer, i64 1, i64 %tmp47 - %tmp49 = add i64 %tmp48, %indvar - %dst.041 = getelementptr i16, i16* %tmp14, i64 %tmp49 - %tmp29 = load i16, i16* %p.042, align 2 - store i16 %tmp29, i16* %dst.041, align 2 - %cmp27 = icmp eq i16* %incdec.ptr32, %add.ptr22 - %indvar.next = add i64 %indvar, 1 - br i1 %cmp27, label %for.end.loopexit, label %for.body - -for.end.loopexit: ; preds = %for.body - br label %for.end - -for.end: ; preds = %for.end.loopexit, %do.end - %tmp38 = load i32, i32* %mLength, align 4 - %add = add i32 %tmp38, %conv11 - store i32 %add, i32* %mLength, align 4 - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/post-inc-optsize.ll b/llvm/test/Transforms/LoopStrengthReduce/post-inc-optsize.ll deleted file mode 100644 index 7df9cdf30f3..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/post-inc-optsize.ll +++ /dev/null @@ -1,43 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | FileCheck %s - -target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" -target triple = "thumbv7m-arm-none-eabi" - -; Check that the IV updates (incdec.ptr{,1,2}) are kept in the latch block -; and not moved to the header/exiting block. Inserting them in the header -; doubles register pressure and adds moves. - -; CHECK-LABEL: @f -; CHECK: while.cond: -; CHECK: icmp sgt i32 %n.addr.0, 0 -; CHECK: while.body: -; CHECK: incdec.ptr = -; CHECK: incdec.ptr1 = -; CHECK: incdec.ptr2 = -; CHECK: dec = -define void @f(float* nocapture readonly %a, float* nocapture readonly %b, float* nocapture %c, i32 %n) { -entry: - br label %while.cond - -while.cond: ; preds = %while.body, %entry - %a.addr.0 = phi float* [ %a, %entry ], [ %incdec.ptr, %while.body ] - %b.addr.0 = phi float* [ %b, %entry ], [ %incdec.ptr1, %while.body ] - %c.addr.0 = phi float* [ %c, %entry ], [ %incdec.ptr2, %while.body ] - %n.addr.0 = phi i32 [ %n, %entry ], [ %dec, %while.body ] - %cmp = icmp sgt i32 %n.addr.0, 0 - br i1 %cmp, label %while.body, label %while.end - -while.body: ; preds = %while.cond - %incdec.ptr = getelementptr inbounds float, float* %a.addr.0, i32 1 - %tmp = load float, float* %a.addr.0, align 4 - %incdec.ptr1 = getelementptr inbounds float, float* %b.addr.0, i32 1 - %tmp1 = load float, float* %b.addr.0, align 4 - %add = fadd float %tmp, %tmp1 - %incdec.ptr2 = getelementptr inbounds float, float* %c.addr.0, i32 1 - store float %add, float* %c.addr.0, align 4 - %dec = add nsw i32 %n.addr.0, -1 - br label %while.cond - -while.end: ; preds = %while.cond - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/pr12018.ll b/llvm/test/Transforms/LoopStrengthReduce/pr12018.ll deleted file mode 100644 index cabb0a2e2e6..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/pr12018.ll +++ /dev/null @@ -1,39 +0,0 @@ -; RUN: opt < %s -loop-reduce - -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-S128" - -%struct.nsTArray = type { i8 } -%struct.nsTArrayHeader = type { i32 } - -define void @_Z6foobarR8nsTArray(%struct.nsTArray* %aValues, i32 %foo, %struct.nsTArrayHeader* %bar) nounwind { -entry: - br label %for.body - -for.body: ; preds = %_ZN8nsTArray9ElementAtEi.exit, %entry - %i.06 = phi i32 [ %add, %_ZN8nsTArray9ElementAtEi.exit ], [ 0, %entry ] - %call.i = call %struct.nsTArrayHeader* @_ZN8nsTArray4Hdr2Ev() nounwind - %add.ptr.i = getelementptr inbounds %struct.nsTArrayHeader, %struct.nsTArrayHeader* %call.i, i32 1 - %tmp = bitcast %struct.nsTArrayHeader* %add.ptr.i to %struct.nsTArray* - %arrayidx = getelementptr inbounds %struct.nsTArray, %struct.nsTArray* %tmp, i32 %i.06 - %add = add nsw i32 %i.06, 1 - call void @llvm.dbg.value(metadata %struct.nsTArray* %aValues, metadata !0, metadata !DIExpression()) nounwind, !dbg !DILocation(scope: !1) - br label %_ZN8nsTArray9ElementAtEi.exit - -_ZN8nsTArray9ElementAtEi.exit: ; preds = %for.body - %arrayidx.i = getelementptr inbounds %struct.nsTArray, %struct.nsTArray* %tmp, i32 %add - call void @_ZN11nsTArray15ComputeDistanceERKS_Rd(%struct.nsTArray* %arrayidx, %struct.nsTArray* %arrayidx.i) nounwind - %cmp = icmp slt i32 %add, %foo - br i1 %cmp, label %for.body, label %for.end - -for.end: ; preds = %_ZN8nsTArray9ElementAtEi.exit - ret void -} - -declare void @_ZN11nsTArray15ComputeDistanceERKS_Rd(%struct.nsTArray*, %struct.nsTArray*) - -declare %struct.nsTArrayHeader* @_ZN8nsTArray4Hdr2Ev() - -declare void @llvm.dbg.value(metadata, metadata, metadata) nounwind readnone - -!0 = !DILocalVariable(scope: !1) -!1 = distinct !DISubprogram() diff --git a/llvm/test/Transforms/LoopStrengthReduce/pr12048.ll b/llvm/test/Transforms/LoopStrengthReduce/pr12048.ll deleted file mode 100644 index 212004b24f8..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/pr12048.ll +++ /dev/null @@ -1,38 +0,0 @@ -; RUN: opt < %s -loop-reduce - -define void @resolve_name() nounwind uwtable ssp { - br label %while.cond40.preheader -while.cond132.while.cond.loopexit_crit_edge: - br label %while.cond40.preheader -while.cond40.preheader: - br label %while.cond40 -while.cond40: - %indvars.iv194 = phi i8* [ null, %while.cond40.preheader ], [ %scevgep, %while.body51 ] - %tmp.1 = phi i8* [ undef, %while.cond40.preheader ], [ %incdec.ptr, %while.body51 ] - switch i8 undef, label %while.body51 [ - i8 0, label %if.then59 - ] -while.body51: ; preds = %land.end50 - %incdec.ptr = getelementptr inbounds i8, i8* %tmp.1, i64 1 - %scevgep = getelementptr i8, i8* %indvars.iv194, i64 1 - br label %while.cond40 -if.then59: ; preds = %while.end - br i1 undef, label %if.then64, label %if.end113 -if.then64: ; preds = %if.then59 - %incdec.ptr88.tmp.2 = select i1 undef, i8* undef, i8* undef - br label %if.end113 -if.end113: ; preds = %if.then64, %if.then59 - %tmp.4 = phi i8* [ %incdec.ptr88.tmp.2, %if.then64 ], [ undef, %if.then59 ] - %tmp.4195 = ptrtoint i8* %tmp.4 to i64 - br label %while.cond132.preheader -while.cond132.preheader: ; preds = %if.end113 - %cmp133173 = icmp eq i8* %tmp.1, %tmp.4 - br i1 %cmp133173, label %while.cond40.preheader, label %while.body139.lr.ph -while.body139.lr.ph: ; preds = %while.cond132.preheader - %scevgep198 = getelementptr i8, i8* %indvars.iv194, i64 0 - %scevgep198199 = ptrtoint i8* %scevgep198 to i64 - br label %while.body139 -while.body139: ; preds = %while.body139, %while.body139.lr.ph - %start_of_var.0177 = phi i8* [ %tmp.1, %while.body139.lr.ph ], [ null, %while.body139 ] - br i1 undef, label %while.cond132.while.cond.loopexit_crit_edge, label %while.body139 -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/pr12691.ll b/llvm/test/Transforms/LoopStrengthReduce/pr12691.ll deleted file mode 100644 index e33e40503a3..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/pr12691.ll +++ /dev/null @@ -1,37 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | FileCheck %s - -; Provide legal integer types. -target datalayout = "n8:16:32:64" - -@d = common global i32 0, align 4 - -define void @fn2(i32 %x) nounwind uwtable { -entry: - br label %for.cond - -for.cond: - %g.0 = phi i32 [ 0, %entry ], [ %dec, %for.cond ] - %tobool = icmp eq i32 %x, 0 - %dec = add nsw i32 %g.0, -1 - br i1 %tobool, label %for.cond, label %for.end - -for.end: -; CHECK: %tmp1 = load i32, i32* @d, align 4 -; CHECK-NEXT: %tmp2 = load i32, i32* @d, align 4 -; CHECK-NEXT: %0 = sub i32 %tmp1, %tmp2 - - %tmp1 = load i32, i32* @d, align 4 - %add = add nsw i32 %tmp1, %g.0 - %tmp2 = load i32, i32* @d, align 4 - %tobool26 = icmp eq i32 %x, 0 - br i1 %tobool26, label %for.end5, label %for.body.lr.ph - -for.body.lr.ph: - %tobool3 = icmp ne i32 %tmp2, %add - br label %for.end5 - -for.end5: - ret void -} - - diff --git a/llvm/test/Transforms/LoopStrengthReduce/pr18165.ll b/llvm/test/Transforms/LoopStrengthReduce/pr18165.ll deleted file mode 100644 index 11c9c4ec403..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/pr18165.ll +++ /dev/null @@ -1,88 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | FileCheck %s -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx10.9.0" - -; LSR shouldn't reuse IV if the resultant offset is not valid for the operand type. -; CHECK-NOT: trunc i32 %.ph to i8 - -%struct.anon = type { i32, i32, i32 } - -@c = global i32 1, align 4 -@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 -@b = common global i32 0, align 4 -@a = common global %struct.anon zeroinitializer, align 4 -@e = common global %struct.anon zeroinitializer, align 4 -@d = common global i32 0, align 4 -@f = common global i32 0, align 4 -@g = common global i32 0, align 4 -@h = common global i32 0, align 4 - -; Function Attrs: nounwind optsize ssp uwtable -define i32 @main() #0 { -entry: - %0 = load i32, i32* getelementptr inbounds (%struct.anon, %struct.anon* @a, i64 0, i32 0), align 4, !tbaa !1 - %tobool7.i = icmp eq i32 %0, 0 - %.promoted.i = load i32, i32* getelementptr inbounds (%struct.anon, %struct.anon* @a, i64 0, i32 2), align 4, !tbaa !6 - %f.promoted.i = load i32, i32* @f, align 4, !tbaa !7 - br label %for.body6.i.outer - -for.body6.i.outer: ; preds = %entry, %lor.end.i - %.ph = phi i32 [ %add.i, %lor.end.i ], [ 0, %entry ] - %or1512.i.ph = phi i32 [ %or15.i, %lor.end.i ], [ %f.promoted.i, %entry ] - %or1410.i.ph = phi i32 [ %or14.i, %lor.end.i ], [ %.promoted.i, %entry ] - %p.addr.16.i.ph = phi i8 [ %inc10.i, %lor.end.i ], [ -128, %entry ] - br i1 %tobool7.i, label %if.end9.i, label %lbl.loopexit.i - -lbl.loopexit.i: ; preds = %for.body6.i.outer, %lbl.loopexit.i - br label %lbl.loopexit.i - -if.end9.i: ; preds = %for.body6.i.outer - %inc10.i = add i8 %p.addr.16.i.ph, 1 - %tobool12.i = icmp eq i8 %p.addr.16.i.ph, 0 - br i1 %tobool12.i, label %lor.rhs.i, label %lor.end.i - -lor.rhs.i: ; preds = %if.end9.i - %1 = load i32, i32* @b, align 4, !tbaa !7 - %dec.i = add nsw i32 %1, -1 - store i32 %dec.i, i32* @b, align 4, !tbaa !7 - %tobool13.i = icmp ne i32 %1, 0 - br label %lor.end.i - -lor.end.i: ; preds = %lor.rhs.i, %if.end9.i - %2 = phi i1 [ true, %if.end9.i ], [ %tobool13.i, %lor.rhs.i ] - %lor.ext.i = zext i1 %2 to i32 - %or14.i = or i32 %lor.ext.i, %or1410.i.ph - %or15.i = or i32 %or14.i, %or1512.i.ph - %add.i = add nsw i32 %.ph, 2 - %cmp.i = icmp slt i32 %add.i, 21 - br i1 %cmp.i, label %for.body6.i.outer, label %fn1.exit - -fn1.exit: ; preds = %lor.end.i - store i32 0, i32* @g, align 4, !tbaa !7 - store i32 %or14.i, i32* getelementptr inbounds (%struct.anon, %struct.anon* @a, i64 0, i32 2), align 4, !tbaa !6 - store i32 %or15.i, i32* @f, align 4, !tbaa !7 - store i32 %add.i, i32* getelementptr inbounds (%struct.anon, %struct.anon* @e, i64 0, i32 1), align 4, !tbaa !8 - store i32 0, i32* @h, align 4, !tbaa !7 - %3 = load i32, i32* @b, align 4, !tbaa !7 - %call1 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3) #2 - ret i32 0 -} - -; Function Attrs: nounwind optsize -declare i32 @printf(i8* nocapture readonly, ...) #1 - -attributes #0 = { nounwind optsize ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { nounwind optsize "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #2 = { nounwind optsize } - -!llvm.ident = !{!0} - -!0 = !{!"clang version 3.5 "} -!1 = !{!2, !3, i64 0} -!2 = !{!"", !3, i64 0, !3, i64 4, !3, i64 8} -!3 = !{!"int", !4, i64 0} -!4 = !{!"omnipotent char", !5, i64 0} -!5 = !{!"Simple C/C++ TBAA"} -!6 = !{!2, !3, i64 8} -!7 = !{!3, !3, i64 0} -!8 = !{!2, !3, i64 4} diff --git a/llvm/test/Transforms/LoopStrengthReduce/pr2537.ll b/llvm/test/Transforms/LoopStrengthReduce/pr2537.ll deleted file mode 100644 index 46ad70e736d..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/pr2537.ll +++ /dev/null @@ -1,21 +0,0 @@ -; RUN: opt < %s -loop-reduce -disable-output -; PR 2537 - -define void @a() { -entry: - br label %dobody - -dobody: ; preds = %dobody, %entry - %y.0 = phi i128 [ 0, %entry ], [ %add, %dobody ] - %x.0 = phi i128 [ 0, %entry ], [ %add2, %dobody ] - %add = add i128 %y.0, shl (i128 1, i128 64) - %add2 = add i128 %x.0, shl (i128 1, i128 48) - call void @b( i128 %add ) - %cmp = icmp ult i128 %add2, shl (i128 1, i128 64) - br i1 %cmp, label %dobody, label %afterdo - -afterdo: ; preds = %dobody - ret void -} - -declare void @b(i128 %add) diff --git a/llvm/test/Transforms/LoopStrengthReduce/pr25541.ll b/llvm/test/Transforms/LoopStrengthReduce/pr25541.ll deleted file mode 100644 index 011998b9089..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/pr25541.ll +++ /dev/null @@ -1,48 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | FileCheck %s -target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-pc-windows-msvc" - -define void @f() personality i32 (...)* @__CxxFrameHandler3 { -entry: - br label %for.cond.i - -for.cond.i: ; preds = %for.inc.i, %entry - %_First.addr.0.i = phi i32* [ null, %entry ], [ %incdec.ptr.i, %for.inc.i ] - invoke void @g() - to label %for.inc.i unwind label %catch.dispatch.i - -catch.dispatch.i: ; preds = %for.cond.i - %cs = catchswitch within none [label %for.cond.1.preheader.i] unwind to caller - -for.cond.1.preheader.i: ; preds = %catch.dispatch.i - %0 = catchpad within %cs [i8* null, i32 64, i8* null] - %cmp.i = icmp eq i32* %_First.addr.0.i, null - br label %for.cond.1.i - -for.cond.1.i: ; preds = %for.body.i, %for.cond.1.preheader.i - br i1 %cmp.i, label %for.end.i, label %for.body.i - -for.body.i: ; preds = %for.cond.1.i - call void @g() - br label %for.cond.1.i - -for.inc.i: ; preds = %for.cond.i - %incdec.ptr.i = getelementptr inbounds i32, i32* %_First.addr.0.i, i64 1 - br label %for.cond.i - -for.end.i: ; preds = %for.cond.1.i - catchret from %0 to label %leave - -leave: ; preds = %for.end.i - ret void -} - -; CHECK-LABEL: define void @f( -; CHECK: %[[PHI:.*]] = phi i64 [ %[[IV_NEXT:.*]], {{.*}} ], [ 0, {{.*}} ] -; CHECK: %[[ITOP:.*]] = inttoptr i64 %[[PHI]] to i32* -; CHECK: %[[CMP:.*]] = icmp eq i32* %[[ITOP]], null -; CHECK: %[[IV_NEXT]] = add i64 %[[PHI]], -4 - -declare void @g() - -declare i32 @__CxxFrameHandler3(...) diff --git a/llvm/test/Transforms/LoopStrengthReduce/pr2570.ll b/llvm/test/Transforms/LoopStrengthReduce/pr2570.ll deleted file mode 100644 index 671ffde671f..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/pr2570.ll +++ /dev/null @@ -1,287 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | grep "phi\>" | count 8 -; PR2570 - -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-pc-linux-gnu" -@g_14 = internal global i32 1 ; <i32*> [#uses=1] -@g_39 = internal global i16 -5 ; <i16*> [#uses=2] -@g_43 = internal global i32 -6 ; <i32*> [#uses=3] -@g_33 = internal global i32 -1269044541 ; <i32*> [#uses=1] -@g_137 = internal global i32 8 ; <i32*> [#uses=1] -@g_82 = internal global i32 -5 ; <i32*> [#uses=3] -@g_91 = internal global i32 1 ; <i32*> [#uses=1] -@g_197 = internal global i32 1 ; <i32*> [#uses=4] -@g_207 = internal global i32 1 ; <i32*> [#uses=2] -@g_222 = internal global i16 4165 ; <i16*> [#uses=1] -@g_247 = internal global i8 -21 ; <i8*> [#uses=2] -@g_260 = internal global i32 1 ; <i32*> [#uses=2] -@g_221 = internal global i16 -17503 ; <i16*> [#uses=3] -@g_267 = internal global i16 1 ; <i16*> [#uses=1] -@llvm.used = appending global [1 x i8*] [ i8* bitcast (i32 (i32, i32, i16, i32, i8, i32)* @func_44 to i8*) ], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0] - -define i32 @func_44(i32 %p_45, i32 %p_46, i16 zeroext %p_48, i32 %p_49, i8 zeroext %p_50, i32 %p_52) nounwind { -entry: - tail call i32 @func_116( i8 zeroext 2 ) nounwind ; <i32>:0 [#uses=0] - tail call i32 @func_63( i16 signext 2 ) nounwind ; <i32>:1 [#uses=1] - load i16, i16* @g_39, align 2 ; <i16>:2 [#uses=1] - tail call i32 @func_63( i16 signext %2 ) nounwind ; <i32>:3 [#uses=1] - trunc i32 %3 to i16 ; <i16>:4 [#uses=1] - and i16 %4, 1 ; <i16>:5 [#uses=1] - trunc i32 %p_52 to i8 ; <i8>:6 [#uses=1] - trunc i32 %1 to i16 ; <i16>:7 [#uses=1] - tail call i32 @func_74( i16 zeroext %5, i8 zeroext %6, i16 zeroext %7, i16 zeroext 0 ) nounwind ; <i32>:8 [#uses=0] - tail call i32 @func_124( i32 544824386 ) nounwind ; <i32>:9 [#uses=0] - zext i8 %p_50 to i32 ; <i32>:10 [#uses=1] - load i32, i32* @g_43, align 4 ; <i32>:11 [#uses=1] - icmp sle i32 %10, %11 ; <i1>:12 [#uses=1] - zext i1 %12 to i32 ; <i32>:13 [#uses=2] - load i8, i8* @g_247, align 1 ; <i8>:14 [#uses=1] - trunc i32 %p_45 to i16 ; <i16>:15 [#uses=1] - zext i8 %14 to i16 ; <i16>:16 [#uses=1] - tail call i32 @func_74( i16 zeroext %15, i8 zeroext 0, i16 zeroext %16, i16 zeroext 23618 ) nounwind ; <i32>:17 [#uses=4] - icmp slt i32 %17, 0 ; <i1>:18 [#uses=1] - br i1 %18, label %bb162, label %bb152 - -bb152: ; preds = %entry - lshr i32 2147483647, %13 ; <i32>:19 [#uses=1] - icmp slt i32 %19, %17 ; <i1>:20 [#uses=1] - select i1 %20, i32 0, i32 %13 ; <i32>:21 [#uses=1] - %.348 = shl i32 %17, %21 ; <i32> [#uses=1] - br label %bb162 - -bb162: ; preds = %bb152, %entry - %.0346 = phi i32 [ %.348, %bb152 ], [ %17, %entry ] ; <i32> [#uses=1] - tail call i32 @func_124( i32 1 ) nounwind ; <i32>:22 [#uses=1] - mul i32 %22, %.0346 ; <i32>:23 [#uses=1] - icmp slt i32 %p_45, 0 ; <i1>:24 [#uses=1] - icmp ugt i32 %p_45, 31 ; <i1>:25 [#uses=1] - %or.cond = or i1 %24, %25 ; <i1> [#uses=1] - br i1 %or.cond, label %bb172, label %bb168 - -bb168: ; preds = %bb162 - lshr i32 2147483647, %p_45 ; <i32>:26 [#uses=1] - shl i32 1392859848, %p_45 ; <i32>:27 [#uses=1] - icmp slt i32 %26, 1392859848 ; <i1>:28 [#uses=1] - %.op355 = add i32 %27, 38978 ; <i32> [#uses=1] - %phitmp = select i1 %28, i32 1392898826, i32 %.op355 ; <i32> [#uses=1] - br label %bb172 - -bb172: ; preds = %bb168, %bb162 - %.0343 = phi i32 [ %phitmp, %bb168 ], [ 1392898826, %bb162 ] ; <i32> [#uses=2] - tail call i32 @func_84( i32 1, i16 zeroext 0, i16 zeroext 8 ) nounwind ; <i32>:29 [#uses=0] - icmp eq i32 %.0343, 0 ; <i1>:30 [#uses=1] - %.0341 = select i1 %30, i32 1, i32 %.0343 ; <i32> [#uses=1] - urem i32 %23, %.0341 ; <i32>:31 [#uses=1] - load i32, i32* @g_137, align 4 ; <i32>:32 [#uses=4] - icmp slt i32 %32, 0 ; <i1>:33 [#uses=1] - br i1 %33, label %bb202, label %bb198 - -bb198: ; preds = %bb172 - %not. = icmp slt i32 %32, 1073741824 ; <i1> [#uses=1] - zext i1 %not. to i32 ; <i32>:34 [#uses=1] - %.351 = shl i32 %32, %34 ; <i32> [#uses=1] - br label %bb202 - -bb202: ; preds = %bb198, %bb172 - %.0335 = phi i32 [ %.351, %bb198 ], [ %32, %bb172 ] ; <i32> [#uses=1] - icmp ne i32 %31, %.0335 ; <i1>:35 [#uses=1] - zext i1 %35 to i32 ; <i32>:36 [#uses=1] - tail call i32 @func_128( i32 %36 ) nounwind ; <i32>:37 [#uses=0] - icmp eq i32 %p_45, 293685862 ; <i1>:38 [#uses=1] - br i1 %38, label %bb205, label %bb311 - -bb205: ; preds = %bb202 - icmp sgt i32 %p_46, 214 ; <i1>:39 [#uses=1] - zext i1 %39 to i32 ; <i32>:40 [#uses=2] - tail call i32 @func_128( i32 %40 ) nounwind ; <i32>:41 [#uses=0] - icmp sgt i32 %p_46, 65532 ; <i1>:42 [#uses=1] - zext i1 %42 to i16 ; <i16>:43 [#uses=1] - tail call i32 @func_74( i16 zeroext 23618, i8 zeroext -29, i16 zeroext %43, i16 zeroext 1 ) nounwind ; <i32>:44 [#uses=2] - tail call i32 @func_103( i16 zeroext -869 ) nounwind ; <i32>:45 [#uses=0] - udiv i32 %44, 34162 ; <i32>:46 [#uses=1] - icmp ult i32 %44, 34162 ; <i1>:47 [#uses=1] - %.0331 = select i1 %47, i32 1, i32 %46 ; <i32> [#uses=1] - urem i32 293685862, %.0331 ; <i32>:48 [#uses=1] - tail call i32 @func_112( i32 %p_52, i16 zeroext 1 ) nounwind ; <i32>:49 [#uses=0] - icmp eq i32 %p_52, 0 ; <i1>:50 [#uses=2] - br i1 %50, label %bb222, label %bb215 - -bb215: ; preds = %bb205 - zext i16 %p_48 to i32 ; <i32>:51 [#uses=1] - icmp eq i16 %p_48, 0 ; <i1>:52 [#uses=1] - %.0329 = select i1 %52, i32 1, i32 %51 ; <i32> [#uses=1] - udiv i32 -1, %.0329 ; <i32>:53 [#uses=1] - icmp eq i32 %53, 0 ; <i1>:54 [#uses=1] - br i1 %54, label %bb222, label %bb223 - -bb222: ; preds = %bb215, %bb205 - br label %bb223 - -bb223: ; preds = %bb222, %bb215 - %iftmp.437.0 = phi i32 [ 0, %bb222 ], [ 1, %bb215 ] ; <i32> [#uses=1] - load i32, i32* @g_91, align 4 ; <i32>:55 [#uses=3] - tail call i32 @func_103( i16 zeroext 4 ) nounwind ; <i32>:56 [#uses=0] - tail call i32 @func_112( i32 0, i16 zeroext -31374 ) nounwind ; <i32>:57 [#uses=0] - load i32, i32* @g_197, align 4 ; <i32>:58 [#uses=1] - tail call i32 @func_124( i32 28156 ) nounwind ; <i32>:59 [#uses=1] - load i32, i32* @g_260, align 4 ; <i32>:60 [#uses=1] - load i32, i32* @g_43, align 4 ; <i32>:61 [#uses=1] - xor i32 %61, %60 ; <i32>:62 [#uses=1] - mul i32 %62, %59 ; <i32>:63 [#uses=1] - trunc i32 %63 to i8 ; <i8>:64 [#uses=1] - trunc i32 %58 to i16 ; <i16>:65 [#uses=1] - tail call i32 @func_74( i16 zeroext 0, i8 zeroext %64, i16 zeroext %65, i16 zeroext 0 ) nounwind ; <i32>:66 [#uses=2] - icmp slt i32 %66, 0 ; <i1>:67 [#uses=1] - icmp slt i32 %55, 0 ; <i1>:68 [#uses=1] - icmp ugt i32 %55, 31 ; <i1>:69 [#uses=1] - or i1 %68, %69 ; <i1>:70 [#uses=1] - %or.cond352 = or i1 %70, %67 ; <i1> [#uses=1] - select i1 %or.cond352, i32 0, i32 %55 ; <i32>:71 [#uses=1] - %.353 = ashr i32 %66, %71 ; <i32> [#uses=2] - load i16, i16* @g_221, align 2 ; <i16>:72 [#uses=1] - zext i16 %72 to i32 ; <i32>:73 [#uses=1] - icmp ugt i32 %.353, 31 ; <i1>:74 [#uses=1] - select i1 %74, i32 0, i32 %.353 ; <i32>:75 [#uses=1] - %.0323 = lshr i32 %73, %75 ; <i32> [#uses=1] - add i32 %.0323, %iftmp.437.0 ; <i32>:76 [#uses=1] - and i32 %48, 255 ; <i32>:77 [#uses=2] - add i32 %77, 2042556439 ; <i32>:78 [#uses=1] - load i32, i32* @g_207, align 4 ; <i32>:79 [#uses=2] - icmp ugt i32 %79, 31 ; <i1>:80 [#uses=1] - select i1 %80, i32 0, i32 %79 ; <i32>:81 [#uses=1] - %.0320 = lshr i32 %77, %81 ; <i32> [#uses=1] - icmp ne i32 %78, %.0320 ; <i1>:82 [#uses=1] - zext i1 %82 to i8 ; <i8>:83 [#uses=1] - tail call i32 @func_25( i8 zeroext %83 ) nounwind ; <i32>:84 [#uses=1] - xor i32 %84, 1 ; <i32>:85 [#uses=1] - load i32, i32* @g_197, align 4 ; <i32>:86 [#uses=1] - add i32 %86, 1 ; <i32>:87 [#uses=1] - add i32 %87, %85 ; <i32>:88 [#uses=1] - icmp ugt i32 %76, %88 ; <i1>:89 [#uses=1] - br i1 %89, label %bb241, label %bb311 - -bb241: ; preds = %bb223 - store i16 -9, i16* @g_221, align 2 - udiv i32 %p_52, 1538244727 ; <i32>:90 [#uses=1] - load i32, i32* @g_207, align 4 ; <i32>:91 [#uses=1] - sub i32 %91, %90 ; <i32>:92 [#uses=1] - load i32, i32* @g_14, align 4 ; <i32>:93 [#uses=1] - trunc i32 %93 to i16 ; <i16>:94 [#uses=1] - trunc i32 %p_46 to i16 ; <i16>:95 [#uses=2] - sub i16 %94, %95 ; <i16>:96 [#uses=1] - load i32, i32* @g_197, align 4 ; <i32>:97 [#uses=1] - trunc i32 %97 to i16 ; <i16>:98 [#uses=1] - tail call i32 @func_55( i32 -346178830, i16 zeroext %98, i16 zeroext %95 ) nounwind ; <i32>:99 [#uses=0] - zext i16 %p_48 to i32 ; <i32>:100 [#uses=1] - load i8, i8* @g_247, align 1 ; <i8>:101 [#uses=1] - zext i8 %101 to i32 ; <i32>:102 [#uses=1] - sub i32 %100, %102 ; <i32>:103 [#uses=1] - tail call i32 @func_55( i32 %103, i16 zeroext -2972, i16 zeroext %96 ) nounwind ; <i32>:104 [#uses=0] - xor i32 %92, 2968 ; <i32>:105 [#uses=1] - load i32, i32* @g_197, align 4 ; <i32>:106 [#uses=1] - icmp ugt i32 %105, %106 ; <i1>:107 [#uses=1] - zext i1 %107 to i32 ; <i32>:108 [#uses=1] - store i32 %108, i32* @g_33, align 4 - br label %bb248 - -bb248: ; preds = %bb284, %bb241 - %p_49_addr.1.reg2mem.0 = phi i32 [ 0, %bb241 ], [ %134, %bb284 ] ; <i32> [#uses=2] - %p_48_addr.2.reg2mem.0 = phi i16 [ %p_48, %bb241 ], [ %p_48_addr.1, %bb284 ] ; <i16> [#uses=1] - %p_46_addr.1.reg2mem.0 = phi i32 [ %p_46, %bb241 ], [ %133, %bb284 ] ; <i32> [#uses=1] - %p_45_addr.1.reg2mem.0 = phi i32 [ %p_45, %bb241 ], [ %p_45_addr.0, %bb284 ] ; <i32> [#uses=2] - tail call i32 @func_63( i16 signext 1 ) nounwind ; <i32>:109 [#uses=1] - icmp eq i32 %109, 0 ; <i1>:110 [#uses=1] - br i1 %110, label %bb272.thread, label %bb255.thread - -bb272.thread: ; preds = %bb248 - store i32 1, i32* @g_82 - load i16, i16* @g_267, align 2 ; <i16>:111 [#uses=1] - icmp eq i16 %111, 0 ; <i1>:112 [#uses=1] - br i1 %112, label %bb311.loopexit.split, label %bb268 - -bb255.thread: ; preds = %bb248 - load i32, i32* @g_260, align 4 ; <i32>:113 [#uses=1] - sub i32 %113, %p_52 ; <i32>:114 [#uses=1] - and i32 %114, -20753 ; <i32>:115 [#uses=1] - icmp ne i32 %115, 0 ; <i1>:116 [#uses=1] - zext i1 %116 to i16 ; <i16>:117 [#uses=1] - store i16 %117, i16* @g_221, align 2 - br label %bb284 - -bb268: ; preds = %bb268, %bb272.thread - %indvar = phi i32 [ 0, %bb272.thread ], [ %g_82.tmp.0, %bb268 ] ; <i32> [#uses=2] - %p_46_addr.0.reg2mem.0 = phi i32 [ %p_46_addr.1.reg2mem.0, %bb272.thread ], [ %119, %bb268 ] ; <i32> [#uses=1] - %g_82.tmp.0 = add i32 %indvar, 1 ; <i32> [#uses=2] - trunc i32 %p_46_addr.0.reg2mem.0 to i16 ; <i16>:118 [#uses=1] - and i32 %g_82.tmp.0, 28156 ; <i32>:119 [#uses=1] - add i32 %indvar, 2 ; <i32>:120 [#uses=4] - icmp sgt i32 %120, -1 ; <i1>:121 [#uses=1] - br i1 %121, label %bb268, label %bb274.split - -bb274.split: ; preds = %bb268 - store i32 %120, i32* @g_82 - br i1 %50, label %bb279, label %bb276 - -bb276: ; preds = %bb274.split - store i16 0, i16* @g_222, align 2 - br label %bb284 - -bb279: ; preds = %bb274.split - icmp eq i32 %120, 0 ; <i1>:122 [#uses=1] - %.0317 = select i1 %122, i32 1, i32 %120 ; <i32> [#uses=1] - udiv i32 -8, %.0317 ; <i32>:123 [#uses=1] - trunc i32 %123 to i16 ; <i16>:124 [#uses=1] - br label %bb284 - -bb284: ; preds = %bb279, %bb276, %bb255.thread - %p_49_addr.0 = phi i32 [ %p_49_addr.1.reg2mem.0, %bb279 ], [ %p_49_addr.1.reg2mem.0, %bb276 ], [ 0, %bb255.thread ] ; <i32> [#uses=1] - %p_48_addr.1 = phi i16 [ %124, %bb279 ], [ %118, %bb276 ], [ %p_48_addr.2.reg2mem.0, %bb255.thread ] ; <i16> [#uses=1] - %p_45_addr.0 = phi i32 [ %p_45_addr.1.reg2mem.0, %bb279 ], [ %p_45_addr.1.reg2mem.0, %bb276 ], [ 8, %bb255.thread ] ; <i32> [#uses=3] - load i32, i32* @g_43, align 4 ; <i32>:125 [#uses=1] - trunc i32 %125 to i8 ; <i8>:126 [#uses=1] - tail call i32 @func_116( i8 zeroext %126 ) nounwind ; <i32>:127 [#uses=0] - lshr i32 65255, %p_45_addr.0 ; <i32>:128 [#uses=1] - icmp ugt i32 %p_45_addr.0, 31 ; <i1>:129 [#uses=1] - %.op = lshr i32 %128, 31 ; <i32> [#uses=1] - %.op.op = xor i32 %.op, 1 ; <i32> [#uses=1] - %.354..lobit.not = select i1 %129, i32 1, i32 %.op.op ; <i32> [#uses=1] - load i16, i16* @g_39, align 2 ; <i16>:130 [#uses=1] - zext i16 %130 to i32 ; <i32>:131 [#uses=1] - icmp slt i32 %.354..lobit.not, %131 ; <i1>:132 [#uses=1] - zext i1 %132 to i32 ; <i32>:133 [#uses=1] - add i32 %p_49_addr.0, 1 ; <i32>:134 [#uses=2] - icmp sgt i32 %134, -1 ; <i1>:135 [#uses=1] - br i1 %135, label %bb248, label %bb307 - -bb307: ; preds = %bb284 - tail call i32 @func_103( i16 zeroext 0 ) nounwind ; <i32>:136 [#uses=0] - ret i32 %40 - -bb311.loopexit.split: ; preds = %bb272.thread - store i32 1, i32* @g_82 - ret i32 1 - -bb311: ; preds = %bb223, %bb202 - %.0 = phi i32 [ 1, %bb202 ], [ 0, %bb223 ] ; <i32> [#uses=1] - ret i32 %.0 -} - -declare i32 @func_25(i8 zeroext ) nounwind - -declare i32 @func_55(i32, i16 zeroext , i16 zeroext ) nounwind - -declare i32 @func_63(i16 signext ) nounwind - -declare i32 @func_74(i16 zeroext , i8 zeroext , i16 zeroext , i16 zeroext ) nounwind - -declare i32 @func_84(i32, i16 zeroext , i16 zeroext ) nounwind - -declare i32 @func_103(i16 zeroext ) nounwind - -declare i32 @func_124(i32) nounwind - -declare i32 @func_128(i32) nounwind - -declare i32 @func_116(i8 zeroext ) nounwind - -declare i32 @func_112(i32, i16 zeroext ) nounwind diff --git a/llvm/test/Transforms/LoopStrengthReduce/pr27056.ll b/llvm/test/Transforms/LoopStrengthReduce/pr27056.ll deleted file mode 100644 index 57dc8cd45fe..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/pr27056.ll +++ /dev/null @@ -1,51 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | FileCheck %s -target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-pc-windows-msvc18.0.0" - -%struct.L = type { i8, i8* } - -declare i32 @__CxxFrameHandler3(...) - -@GV1 = external global %struct.L* -@GV2 = external global %struct.L - -define void @b_copy_ctor() personality i32 (...)* @__CxxFrameHandler3 { -entry: - %0 = load %struct.L*, %struct.L** @GV1, align 8 - br label %for.cond - -for.cond: ; preds = %call.i.noexc, %entry - %d.0 = phi %struct.L* [ %0, %entry ], [ %incdec.ptr, %call.i.noexc ] - invoke void @a_copy_ctor() - to label %call.i.noexc unwind label %catch.dispatch - -call.i.noexc: ; preds = %for.cond - %incdec.ptr = getelementptr inbounds %struct.L, %struct.L* %d.0, i64 1 - br label %for.cond - -catch.dispatch: ; preds = %for.cond - %1 = catchswitch within none [label %catch] unwind to caller - -catch: ; preds = %catch.dispatch - %2 = catchpad within %1 [i8* null, i32 64, i8* null] - %cmp16 = icmp eq %struct.L* %0, %d.0 - br i1 %cmp16, label %for.end, label %for.body - -for.body: ; preds = %for.body, %catch - %cmp = icmp eq %struct.L* @GV2, %d.0 - br i1 %cmp, label %for.end, label %for.body - -for.end: ; preds = %for.body, %catch - catchret from %2 to label %try.cont - -try.cont: ; preds = %for.end - ret void -} - -; CHECK-LABEL: define void @b_copy_ctor( -; CHECK: catchpad -; CHECK-NEXT: icmp eq %struct.L -; CHECK-NEXT: %4 = sub i64 0, %1 -; CHECK-NEXT: getelementptr {{.*}} getelementptr inbounds (%struct.L, %struct.L* @GV2, i32 0, i32 0), i64 %4 - -declare void @a_copy_ctor() diff --git a/llvm/test/Transforms/LoopStrengthReduce/pr3086.ll b/llvm/test/Transforms/LoopStrengthReduce/pr3086.ll deleted file mode 100644 index 187c14f900a..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/pr3086.ll +++ /dev/null @@ -1,29 +0,0 @@ -; RUN: opt < %s -loop-reduce -; RUN: opt < %s -analyze -scalar-evolution -; PR 3086 - - %struct.Cls = type { i32, i8, [2 x %struct.Cls*], [2 x %struct.Lit*] } - %struct.Lit = type { i8 } - -define fastcc i64 @collect_clauses() nounwind { -entry: - br label %bb11 - -bb5: ; preds = %bb9 - %0 = load %struct.Lit*, %struct.Lit** %storemerge, align 8 ; <%struct.Lit*> [#uses=0] - %indvar.next8 = add i64 %storemerge.rec, 1 ; <i64> [#uses=1] - br label %bb9 - -bb9: ; preds = %bb22, %bb5 - %storemerge.rec = phi i64 [ %indvar.next8, %bb5 ], [ 0, %bb22 ] ; <i64> [#uses=2] - %storemerge = getelementptr %struct.Lit*, %struct.Lit** null, i64 %storemerge.rec ; <%struct.Lit**> [#uses=2] - %1 = icmp ugt %struct.Lit** null, %storemerge ; <i1> [#uses=1] - br i1 %1, label %bb5, label %bb22 - -bb11: ; preds = %bb22, %entry - %2 = load %struct.Cls*, %struct.Cls** null, align 8 ; <%struct.Cls*> [#uses=0] - br label %bb22 - -bb22: ; preds = %bb11, %bb9 - br i1 false, label %bb11, label %bb9 -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/pr31627.ll b/llvm/test/Transforms/LoopStrengthReduce/pr31627.ll deleted file mode 100644 index 4bd4fc273d7..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/pr31627.ll +++ /dev/null @@ -1,58 +0,0 @@ -; RUN: opt -S -loop-reduce < %s | FileCheck %s -target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-pc-windows-msvc19.0.24215" - -define void @fn3() personality i32 (...)* @__CxxFrameHandler3 { -entry: - %call = invoke i32 @fn2() - to label %for.cond.preheader unwind label %catch.dispatch2 - -for.cond.preheader: ; preds = %entry - br label %for.cond - -for.cond: ; preds = %for.cond.preheader, %for.cond - %b.0 = phi i32 [ %inc, %for.cond ], [ %call, %for.cond.preheader ] - %inc = add nsw i32 %b.0, 1 - invoke void @fn1(i32 %inc) - to label %for.cond unwind label %catch.dispatch - -; CHECK: %[[add:.*]] = add i32 %call, 1 -; CHECK: br label %for.cond - -; CHECK: for.cond: ; preds = %for.cond, %for.cond.preheader -; CHECK: %[[lsr_iv:.*]] = phi i32 [ %lsr.iv.next, %for.cond ], [ %[[add]], %for.cond.preheader ] -; CHECK: %[[lsr_iv_next:.*]] = add i32 %lsr.iv, 1 -; CHECK: invoke void @fn1(i32 %[[lsr_iv]]) - - -catch.dispatch: ; preds = %for.cond - %0 = catchswitch within none [label %catch] unwind label %catch.dispatch2 - -catch: ; preds = %catch.dispatch - %1 = catchpad within %0 [i8* null, i32 64, i8* null] - invoke void @_CxxThrowException(i8* null, i8* null) #2 [ "funclet"(token %1) ] - to label %unreachable unwind label %catch.dispatch2 - -catch.dispatch2: ; preds = %catch.dispatch, %catch, %entry - %a.0 = phi i32 [ undef, %entry ], [ %call, %catch ], [ %call, %catch.dispatch ] - %2 = catchswitch within none [label %catch3] unwind to caller - -catch3: ; preds = %catch.dispatch2 - %3 = catchpad within %2 [i8* null, i32 64, i8* null] - call void @fn1(i32 %a.0) [ "funclet"(token %3) ] - catchret from %3 to label %try.cont4 - -try.cont4: ; preds = %catch3 - ret void - -unreachable: ; preds = %catch - unreachable -} - -declare i32 @fn2() - -declare i32 @__CxxFrameHandler3(...) - -declare void @fn1(i32) - -declare void @_CxxThrowException(i8*, i8*) diff --git a/llvm/test/Transforms/LoopStrengthReduce/pr3399.ll b/llvm/test/Transforms/LoopStrengthReduce/pr3399.ll deleted file mode 100644 index 1037768f95c..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/pr3399.ll +++ /dev/null @@ -1,32 +0,0 @@ -; RUN: opt < %s -loop-reduce | llvm-dis -; PR3399 - -@g_53 = external global i32 ; <i32*> [#uses=1] - -define i32 @foo() nounwind { -bb5.thread: - br label %bb - -bb: ; preds = %bb5, %bb5.thread - %indvar = phi i32 [ 0, %bb5.thread ], [ %indvar.next, %bb5 ] ; <i32> [#uses=2] - br i1 false, label %bb5, label %bb1 - -bb1: ; preds = %bb - %l_2.0.reg2mem.0 = sub i32 0, %indvar ; <i32> [#uses=1] - %0 = load volatile i32, i32* @g_53, align 4 ; <i32> [#uses=1] - %1 = trunc i32 %l_2.0.reg2mem.0 to i16 ; <i16> [#uses=1] - %2 = trunc i32 %0 to i16 ; <i16> [#uses=1] - %3 = mul i16 %2, %1 ; <i16> [#uses=1] - %4 = icmp eq i16 %3, 0 ; <i1> [#uses=1] - br i1 %4, label %bb7, label %bb2 - -bb2: ; preds = %bb2, %bb1 - br label %bb2 - -bb5: ; preds = %bb - %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1] - br label %bb - -bb7: ; preds = %bb1 - ret i32 1 -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/pr3571.ll b/llvm/test/Transforms/LoopStrengthReduce/pr3571.ll deleted file mode 100644 index 1615a818771..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/pr3571.ll +++ /dev/null @@ -1,27 +0,0 @@ -; RUN: opt < %s -loop-reduce | llvm-dis -; PR3571 - -target triple = "i386-pc-mingw32" -define void @_ZNK18qdesigner_internal10TreeWidget12drawBranchesEP8QPainterRK5QRectRK11QModelIndex() nounwind { -entry: - br label %_ZNK11QModelIndex7isValidEv.exit.i - -bb.i: ; preds = %_ZNK11QModelIndex7isValidEv.exit.i - %indvar.next = add i32 %result.0.i, 1 ; <i32> [#uses=1] - br label %_ZNK11QModelIndex7isValidEv.exit.i - -_ZNK11QModelIndex7isValidEv.exit.i: ; preds = %bb.i, %entry - %result.0.i = phi i32 [ 0, %entry ], [ %indvar.next, %bb.i ] ; <i32> [#uses=2] - %0 = load i32*, i32** null, align 4 ; <%struct.QAbstractItemDelegate*> [#uses=0] - br i1 false, label %_ZN18qdesigner_internalL5levelEP18QAbstractItemModelRK11QModelIndex.exit, label %bb.i - -_ZN18qdesigner_internalL5levelEP18QAbstractItemModelRK11QModelIndex.exit: ; preds = %_ZNK11QModelIndex7isValidEv.exit.i - %1 = call i32 @_ZNK9QTreeView11indentationEv(i32* null) nounwind ; <i32> [#uses=1] - %2 = mul i32 %1, %result.0.i ; <i32> [#uses=1] - %3 = add i32 %2, -2 ; <i32> [#uses=1] - %4 = add i32 %3, 0 ; <i32> [#uses=1] - store i32 %4, i32* null, align 8 - unreachable -} - -declare i32 @_ZNK9QTreeView11indentationEv(i32*) diff --git a/llvm/test/Transforms/LoopStrengthReduce/preserve-gep-loop-variant.ll b/llvm/test/Transforms/LoopStrengthReduce/preserve-gep-loop-variant.ll deleted file mode 100644 index 2b9920c566b..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/preserve-gep-loop-variant.ll +++ /dev/null @@ -1,42 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | FileCheck %s -; CHECK-NOT: {{inttoptr|ptrtoint}} -; CHECK: scevgep -; CHECK-NOT: {{inttoptr|ptrtoint}} -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-n32:64" - -; Indvars shouldn't need inttoptr/ptrtoint to expand an address here. - -define void @foo(i8* %p) nounwind { -entry: - br i1 true, label %bb.nph, label %for.end - -for.cond: - %phitmp = icmp slt i64 %inc, 20 - br i1 %phitmp, label %for.body, label %for.cond.for.end_crit_edge - -for.cond.for.end_crit_edge: - br label %for.end - -bb.nph: - br label %for.body - -for.body: - %storemerge1 = phi i64 [ %inc, %for.cond ], [ 0, %bb.nph ] - %call = tail call i64 @bar() nounwind - %call2 = tail call i64 @car() nounwind - %conv = trunc i64 %call2 to i8 - %conv3 = sext i8 %conv to i64 - %add = add nsw i64 %call, %storemerge1 - %add4 = add nsw i64 %add, %conv3 - %arrayidx = getelementptr inbounds i8, i8* %p, i64 %add4 - store i8 0, i8* %arrayidx - %inc = add nsw i64 %storemerge1, 1 - br label %for.cond - -for.end: - ret void -} - -declare i64 @bar() - -declare i64 @car() diff --git a/llvm/test/Transforms/LoopStrengthReduce/related_indvars.ll b/llvm/test/Transforms/LoopStrengthReduce/related_indvars.ll deleted file mode 100644 index fbe8ffde354..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/related_indvars.ll +++ /dev/null @@ -1,27 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | grep phi | count 1 - -; This should only result in one PHI node! - -; void foo(double *D, double *E, double F) { -; while (D != E) -; *D++ = F; -; } - -define void @foo(double* %D, double* %E, double %F) nounwind { -entry: - %tmp.24 = icmp eq double* %D, %E ; <i1> [#uses=1] - br i1 %tmp.24, label %return, label %no_exit -no_exit: ; preds = %no_exit, %entry - %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %no_exit ] ; <i32> [#uses=2] - %D_addr.0.0.rec = bitcast i32 %indvar to i32 ; <i32> [#uses=2] - %D_addr.0.0 = getelementptr double, double* %D, i32 %D_addr.0.0.rec ; <double*> [#uses=1] - %inc.rec = add i32 %D_addr.0.0.rec, 1 ; <i32> [#uses=1] - %inc = getelementptr double, double* %D, i32 %inc.rec ; <double*> [#uses=1] - store double %F, double* %D_addr.0.0 - %tmp.2 = icmp eq double* %inc, %E ; <i1> [#uses=1] - %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1] - br i1 %tmp.2, label %return, label %no_exit -return: ; preds = %no_exit, %entry - ret void -} - diff --git a/llvm/test/Transforms/LoopStrengthReduce/remove_indvar.ll b/llvm/test/Transforms/LoopStrengthReduce/remove_indvar.ll deleted file mode 100644 index 3b92c25389b..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/remove_indvar.ll +++ /dev/null @@ -1,24 +0,0 @@ -; Check that this test makes INDVAR and related stuff dead. -; RUN: opt < %s -loop-reduce -S | not grep INDVAR - -; Provide legal integer types. -target datalayout = "n8:16:32:64" - -declare i1 @pred() - -define void @test(i32* %P) { -; <label>:0 - br label %Loop -Loop: ; preds = %Loop, %0 - %i = phi i32 [ 0, %0 ], [ %i.next, %Loop ] - %INDVAR = phi i32 [ 0, %0 ], [ %INDVAR2, %Loop ] ; <i32> [#uses=2] - %STRRED = getelementptr i32, i32* %P, i32 %INDVAR ; <i32*> [#uses=1] - store i32 0, i32* %STRRED - %INDVAR2 = add i32 %INDVAR, 1 ; <i32> [#uses=1] - %i.next = add i32 %i, 1 - %cond = call i1 @pred( ) ; <i1> [#uses=1] - br i1 %cond, label %Loop, label %Out -Out: ; preds = %Loop - ret void -} - diff --git a/llvm/test/Transforms/LoopStrengthReduce/scaling_factor_cost_crash.ll b/llvm/test/Transforms/LoopStrengthReduce/scaling_factor_cost_crash.ll deleted file mode 100644 index 27212d7b97b..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/scaling_factor_cost_crash.ll +++ /dev/null @@ -1,68 +0,0 @@ -; RUN: opt -loop-reduce %s -S -o - | FileCheck %s -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:128:128-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S32" -target triple = "i686-pc-win32" - -; <rdar://problem/14199725> Assertion failed: (CurScaleCost >= 0 && "Legal addressing mode has an illegal cost!") -; CHECK-LABEL: @scalingFactorCrash( -define void @scalingFactorCrash() { - br i1 undef, label %1, label %24 - -; <label>:1 ; preds = %0 - br i1 undef, label %2, label %24 - -; <label>:2 ; preds = %1 - br i1 undef, label %3, label %24 - -; <label>:3 ; preds = %2 - br i1 undef, label %4, label %24 - -; <label>:4 ; preds = %3 - br i1 undef, label %24, label %6 - -; <label>:5 ; preds = %6 - br i1 undef, label %24, label %7 - -; <label>:6 ; preds = %6, %4 - br i1 undef, label %6, label %5 - -; <label>:7 ; preds = %9, %5 - br label %8 - -; <label>:8 ; preds = %8, %7 - br i1 undef, label %9, label %8 - -; <label>:9 ; preds = %8 - br i1 undef, label %7, label %10 - -; <label>:10 ; preds = %9 - br i1 undef, label %24, label %11 - -; <label>:11 ; preds = %10 - br i1 undef, label %15, label %13 - -; <label>:12 ; preds = %14 - br label %15 - -; <label>:13 ; preds = %11 - br label %14 - -; <label>:14 ; preds = %14, %13 - br i1 undef, label %14, label %12 - -; <label>:15 ; preds = %12, %11 - br i1 undef, label %16, label %24 - -; <label>:16 ; preds = %16, %15 - %17 = phi i32 [ %21, %16 ], [ undef, %15 ] - %18 = sub i32 %17, 1623127498 - %19 = getelementptr inbounds i32, i32* undef, i32 %18 - store i32 undef, i32* %19, align 4 - %20 = add i32 %17, 1623127499 - %21 = add i32 %20, -1623127498 - %22 = add i32 %21, -542963121 - %23 = icmp ult i32 %22, undef - br i1 undef, label %16, label %24 - -; <label>:24 ; preds = %16, %15, %10, %5, %4, %3, %2, %1, %0 - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/scev-after-loopinstsimplify.ll b/llvm/test/Transforms/LoopStrengthReduce/scev-after-loopinstsimplify.ll deleted file mode 100644 index a0dcaadd81b..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/scev-after-loopinstsimplify.ll +++ /dev/null @@ -1,43 +0,0 @@ -; RUN: opt %s -indvars -loop-instsimplify -loop-reduce -; We are only checking that there is no crash! - -; https://bugs.llvm.org/show_bug.cgi?id=37936 - -; The problem is as follows: -; 1. indvars marks %dec as NUW. -; 2. loop-instsimplify runs instsimplify, which constant-folds %dec to -1 -; 3. loop-reduce tries to do some further modification, but crashes -; with an type assertion in cast, because %dec is no longer an Instruction, -; even though the SCEV data indicated it was. - -; If the runline is split into two, i.e. -indvars -loop-instsimplify first, that -; stored into a file, and then -loop-reduce is run on that, there is no crash. -; So it looks like the problem is due to -loop-instsimplify not discarding SCEV. - -target datalayout = "n16" - -@a = external global i16, align 1 - -define void @f1() { -entry: - br label %for.cond - -for.cond: ; preds = %land.end, %entry - %c.0 = phi i16 [ 0, %entry ], [ %dec, %land.end ] - br i1 undef, label %for.body, label %for.cond.cleanup - -for.cond.cleanup: ; preds = %for.cond - ret void - -for.body: ; preds = %for.cond - %0 = load i16, i16* @a, align 1 - %cmp = icmp sgt i16 %0, %c.0 - br i1 %cmp, label %land.rhs, label %land.end - -land.rhs: ; preds = %for.body - unreachable - -land.end: ; preds = %for.body - %dec = add nsw i16 %c.0, -1 - br label %for.cond -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/scev-insertpt-bug.ll b/llvm/test/Transforms/LoopStrengthReduce/scev-insertpt-bug.ll deleted file mode 100644 index 81a6b07fe95..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/scev-insertpt-bug.ll +++ /dev/null @@ -1,47 +0,0 @@ -; RUN: opt < %s -loop-reduce -S - -; Test that SCEV insertpoint's don't get corrupted and cause an -; invalid instruction to be inserted in a block other than its parent. -; See http://reviews.llvm.org/D20703 for context. -define void @test() { -entry: - %bf.load = load i32, i32* null, align 4 - %bf.clear = lshr i32 %bf.load, 1 - %div = and i32 %bf.clear, 134217727 - %sub = add nsw i32 %div, -1 - %0 = zext i32 %sub to i64 - br label %while.cond - -while.cond: ; preds = %cond.end, %entry - %indvars.iv = phi i64 [ %indvars.iv.next, %cond.end ], [ 0, %entry ] - %cmp = icmp eq i64 %indvars.iv, %0 - br i1 %cmp, label %cleanup16, label %while.body - -while.body: ; preds = %while.cond - %1 = trunc i64 %indvars.iv to i32 - %mul = shl i32 %1, 1 - %add = add nuw i32 %mul, 2 - %cmp3 = icmp ult i32 %add, 0 - br i1 %cmp3, label %if.end, label %if.then - -if.then: ; preds = %while.body - unreachable - -if.end: ; preds = %while.body - br i1 false, label %cond.end, label %cond.true - -cond.true: ; preds = %if.end - br label %cond.end - -cond.end: ; preds = %cond.true, %if.end - %add7 = add i32 %1, 1 - %cmp12 = icmp ugt i32 %add7, %sub - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 - br i1 %cmp12, label %if.then13, label %while.cond - -if.then13: ; preds = %cond.end - unreachable - -cleanup16: ; preds = %while.cond - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/sext-ind-var.ll b/llvm/test/Transforms/LoopStrengthReduce/sext-ind-var.ll deleted file mode 100644 index 21e72b29831..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/sext-ind-var.ll +++ /dev/null @@ -1,139 +0,0 @@ -; RUN: opt -loop-reduce -S < %s | FileCheck %s - -target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64" -target triple = "nvptx64-unknown-unknown" - -; LSR used not to be able to generate a float* induction variable in -; these cases due to scalar evolution not propagating nsw from an -; instruction to the SCEV, preventing distributing sext into the -; corresponding addrec. - -; Test this pattern: -; -; for (int i = 0; i < numIterations; ++i) -; sum += ptr[i + offset]; -; -define float @testadd(float* %input, i32 %offset, i32 %numIterations) { -; CHECK-LABEL: @testadd -; CHECK: sext i32 %offset to i64 -; CHECK: loop: -; CHECK-DAG: phi float* -; CHECK-DAG: phi i32 -; CHECK-NOT: sext - -entry: - br label %loop - -loop: - %i = phi i32 [ %nexti, %loop ], [ 0, %entry ] - %sum = phi float [ %nextsum, %loop ], [ 0.000000e+00, %entry ] - %index32 = add nuw nsw i32 %i, %offset - %index64 = sext i32 %index32 to i64 - %ptr = getelementptr inbounds float, float* %input, i64 %index64 - %addend = load float, float* %ptr, align 4 - %nextsum = fadd float %sum, %addend - %nexti = add nuw nsw i32 %i, 1 - %exitcond = icmp eq i32 %nexti, %numIterations - br i1 %exitcond, label %exit, label %loop - -exit: - ret float %nextsum -} - -; Test this pattern: -; -; for (int i = 0; i < numIterations; ++i) -; sum += ptr[i - offset]; -; -define float @testsub(float* %input, i32 %offset, i32 %numIterations) { -; CHECK-LABEL: @testsub -; CHECK: sext i32 %offset to i64 -; CHECK: loop: -; CHECK-DAG: phi float* -; CHECK-DAG: phi i32 -; CHECK-NOT: sext - -entry: - br label %loop - -loop: - %i = phi i32 [ %nexti, %loop ], [ 0, %entry ] - %sum = phi float [ %nextsum, %loop ], [ 0.000000e+00, %entry ] - %index32 = sub nuw nsw i32 %i, %offset - %index64 = sext i32 %index32 to i64 - %ptr = getelementptr inbounds float, float* %input, i64 %index64 - %addend = load float, float* %ptr, align 4 - %nextsum = fadd float %sum, %addend - %nexti = add nuw nsw i32 %i, 1 - %exitcond = icmp eq i32 %nexti, %numIterations - br i1 %exitcond, label %exit, label %loop - -exit: - ret float %nextsum -} - -; Test this pattern: -; -; for (int i = 0; i < numIterations; ++i) -; sum += ptr[i * stride]; -; -define float @testmul(float* %input, i32 %stride, i32 %numIterations) { -; CHECK-LABEL: @testmul -; CHECK: sext i32 %stride to i64 -; CHECK: loop: -; CHECK-DAG: phi float* -; CHECK-DAG: phi i32 -; CHECK-NOT: sext - -entry: - br label %loop - -loop: - %i = phi i32 [ %nexti, %loop ], [ 0, %entry ] - %sum = phi float [ %nextsum, %loop ], [ 0.000000e+00, %entry ] - %index32 = mul nuw nsw i32 %i, %stride - %index64 = sext i32 %index32 to i64 - %ptr = getelementptr inbounds float, float* %input, i64 %index64 - %addend = load float, float* %ptr, align 4 - %nextsum = fadd float %sum, %addend - %nexti = add nuw nsw i32 %i, 1 - %exitcond = icmp eq i32 %nexti, %numIterations - br i1 %exitcond, label %exit, label %loop - -exit: - ret float %nextsum -} - -; Test this pattern: -; -; for (int i = 0; i < numIterations; ++i) -; sum += ptr[3 * (i << 7)]; -; -; The multiplication by 3 is to make the address calculation expensive -; enough to force the introduction of a pointer induction variable. -define float @testshl(float* %input, i32 %numIterations) { -; CHECK-LABEL: @testshl -; CHECK: loop: -; CHECK-DAG: phi float* -; CHECK-DAG: phi i32 -; CHECK-NOT: sext - -entry: - br label %loop - -loop: - %i = phi i32 [ %nexti, %loop ], [ 0, %entry ] - %sum = phi float [ %nextsum, %loop ], [ 0.000000e+00, %entry ] - %index32 = shl nuw nsw i32 %i, 7 - %index32mul = mul nuw nsw i32 %index32, 3 - %index64 = sext i32 %index32mul to i64 - %ptr = getelementptr inbounds float, float* %input, i64 %index64 - %addend = load float, float* %ptr, align 4 - %nextsum = fadd float %sum, %addend - %nexti = add nuw nsw i32 %i, 1 - %exitcond = icmp eq i32 %nexti, %numIterations - br i1 %exitcond, label %exit, label %loop - -exit: - ret float %nextsum -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/share_code_in_preheader.ll b/llvm/test/Transforms/LoopStrengthReduce/share_code_in_preheader.ll deleted file mode 100644 index 1035ce19ff1..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/share_code_in_preheader.ll +++ /dev/null @@ -1,27 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | grep mul | count 1 -; LSR should not make two copies of the Q*L expression in the preheader! - -define i8 @test(i8* %A, i8* %B, i32 %L, i32 %Q, i32 %N.s) { -entry: - %tmp.6 = mul i32 %Q, %L ; <i32> [#uses=1] - %N = bitcast i32 %N.s to i32 ; <i32> [#uses=1] - br label %no_exit -no_exit: ; preds = %no_exit, %entry - %indvar.ui = phi i32 [ 0, %entry ], [ %indvar.next, %no_exit ] ; <i32> [#uses=2] - %Sum.0.0 = phi i8 [ 0, %entry ], [ %tmp.21, %no_exit ] ; <i8> [#uses=1] - %indvar = bitcast i32 %indvar.ui to i32 ; <i32> [#uses=1] - %N_addr.0.0 = sub i32 %N.s, %indvar ; <i32> [#uses=1] - %tmp.8 = add i32 %N_addr.0.0, %tmp.6 ; <i32> [#uses=2] - %tmp.9 = getelementptr i8, i8* %A, i32 %tmp.8 ; <i8*> [#uses=1] - %tmp.10 = load i8, i8* %tmp.9 ; <i8> [#uses=1] - %tmp.17 = getelementptr i8, i8* %B, i32 %tmp.8 ; <i8*> [#uses=1] - %tmp.18 = load i8, i8* %tmp.17 ; <i8> [#uses=1] - %tmp.19 = sub i8 %tmp.10, %tmp.18 ; <i8> [#uses=1] - %tmp.21 = add i8 %tmp.19, %Sum.0.0 ; <i8> [#uses=2] - %indvar.next = add i32 %indvar.ui, 1 ; <i32> [#uses=2] - %exitcond = icmp eq i32 %indvar.next, %N ; <i1> [#uses=1] - br i1 %exitcond, label %loopexit, label %no_exit -loopexit: ; preds = %no_exit - ret i8 %tmp.21 -} - diff --git a/llvm/test/Transforms/LoopStrengthReduce/share_ivs.ll b/llvm/test/Transforms/LoopStrengthReduce/share_ivs.ll deleted file mode 100644 index 0459bc849bf..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/share_ivs.ll +++ /dev/null @@ -1,24 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | grep phi | count 1 - -; This testcase should have ONE stride 18 indvar, the other use should have a -; loop invariant value (B) added to it inside of the loop, instead of having -; a whole indvar based on B for it. - -declare i1 @cond(i32) - -define void @test(i32 %B) { -; <label>:0 - br label %Loop -Loop: ; preds = %Loop, %0 - %IV = phi i32 [ 0, %0 ], [ %IVn, %Loop ] ; <i32> [#uses=3] - %C = mul i32 %IV, 18 ; <i32> [#uses=1] - %D = mul i32 %IV, 18 ; <i32> [#uses=1] - %E = add i32 %D, %B ; <i32> [#uses=1] - %cnd = call i1 @cond( i32 %E ) ; <i1> [#uses=1] - call i1 @cond( i32 %C ) ; <i1>:1 [#uses=0] - %IVn = add i32 %IV, 1 ; <i32> [#uses=1] - br i1 %cnd, label %Loop, label %Out -Out: ; preds = %Loop - ret void -} - diff --git a/llvm/test/Transforms/LoopStrengthReduce/shl.ll b/llvm/test/Transforms/LoopStrengthReduce/shl.ll deleted file mode 100644 index bb9cb39f437..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/shl.ll +++ /dev/null @@ -1,38 +0,0 @@ -; RUN: opt < %s -loop-reduce -gvn -S | FileCheck %s - -target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64" - -define void @_Z3fooPfll(float* nocapture readonly %input, i64 %n, i64 %s) { -; CHECK-LABEL: @_Z3fooPfll( -entry: - %mul = shl nsw i64 %s, 2 -; CHECK: %mul = shl i64 %s, 2 - tail call void @_Z3bazl(i64 %mul) #2 -; CHECK-NEXT: call void @_Z3bazl(i64 %mul) - %cmp.5 = icmp sgt i64 %n, 0 - br i1 %cmp.5, label %for.body.preheader, label %for.cond.cleanup - -for.body.preheader: ; preds = %entry - br label %for.body - -for.cond.cleanup.loopexit: ; preds = %for.body - br label %for.cond.cleanup - -for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry - ret void - -for.body: ; preds = %for.body.preheader, %for.body - %i.06 = phi i64 [ %add, %for.body ], [ 0, %for.body.preheader ] - %arrayidx = getelementptr inbounds float, float* %input, i64 %i.06 -; LoopStrengthReduce should reuse %mul as the stride. -; CHECK: getelementptr i1, i1* {{[^,]+}}, i64 %mul - %0 = load float, float* %arrayidx, align 4 - tail call void @_Z3barf(float %0) #2 - %add = add nsw i64 %i.06, %s - %cmp = icmp slt i64 %add, %n - br i1 %cmp, label %for.body, label %for.cond.cleanup.loopexit -} - -declare void @_Z3bazl(i64) - -declare void @_Z3barf(float) diff --git a/llvm/test/Transforms/LoopStrengthReduce/two-combinations-bug.ll b/llvm/test/Transforms/LoopStrengthReduce/two-combinations-bug.ll deleted file mode 100644 index ab6dd488319..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/two-combinations-bug.ll +++ /dev/null @@ -1,55 +0,0 @@ -; RUN: opt < %s -loop-reduce -lsr-recursive-setupcost=0 -S | FileCheck %s - -; This test is adapted from the n-body test of the LLVM test-suite: A bug in -; r345114 caused LSR to generate incorrect code. The test verifies that the -; induction variable generated for the inner loop depends on the induction -; variable of the outer loop. - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -%struct.planet.0.3.6.11.12.15.16.17.24.25.26.33.44 = type { double, double, double, double, double, double, double } - -; Function Attrs: nounwind uwtable -define dso_local void @advance(i32 %nbodies, %struct.planet.0.3.6.11.12.15.16.17.24.25.26.33.44* nocapture %bodies) local_unnamed_addr #0 { -; CHECK-LABEL: @advance( -; CHECK: for.cond.loopexit: -; CHECK: [[LSR_IV_NEXT:%.*]] = add i64 [[LSR_IV:%.*]], -1 -; CHECK: br label %for.body -; CHECK: for.body: -; CHECK: [[LSR_IV]] = phi i64 [ [[LSR_IV_NEXT]] -; CHECK: br label %for.body3 -; CHECK: for.body3: -; CHECK: [[LSR_IV1:%.*]] = phi i64 [ [[LSR_IV_NEXT2:%.*]], %for.body3 ], [ [[LSR_IV]], %for.body ] -; CHECK: [[LSR_IV_NEXT2]] = add i64 [[LSR_IV1]], -1 -; CHECK: [[EXITCOND:%.*]] = icmp eq i64 [[LSR_IV_NEXT2]], 0 -; CHECK: br i1 [[EXITCOND]], label %for.cond.loopexit, label %for.body3 -; -entry: - %wide.trip.count = zext i32 %nbodies to i64 - br label %for.body - -for.cond.loopexit: ; preds = %for.body3 - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 - br label %for.body - -for.body: ; preds = %for.cond.loopexit, %entry - %indvars.iv = phi i64 [ 1, %entry ], [ %indvars.iv.next, %for.cond.loopexit ] - br label %for.body3 - -for.body3: ; preds = %for.body3, %for.body - %indvars.iv98 = phi i64 [ %indvars.iv, %for.body ], [ %indvars.iv.next99, %for.body3 ] - %z9 = getelementptr inbounds %struct.planet.0.3.6.11.12.15.16.17.24.25.26.33.44, %struct.planet.0.3.6.11.12.15.16.17.24.25.26.33.44* %bodies, i64 %indvars.iv98, i32 2 - %tmp = load double, double* %z9, align 8, !tbaa !0 - %indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1 - %exitcond = icmp eq i64 %indvars.iv.next99, %wide.trip.count - br i1 %exitcond, label %for.cond.loopexit, label %for.body3 -} - -attributes #0 = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } - -!0 = !{!1, !2, i64 16} -!1 = !{!"planet", !2, i64 0, !2, i64 8, !2, i64 16, !2, i64 24, !2, i64 32, !2, i64 40, !2, i64 48} -!2 = !{!"double", !3, i64 0} -!3 = !{!"omnipotent char", !4, i64 0} -!4 = !{!"Simple C/C++ TBAA"} diff --git a/llvm/test/Transforms/LoopStrengthReduce/uglygep-address-space.ll b/llvm/test/Transforms/LoopStrengthReduce/uglygep-address-space.ll deleted file mode 100644 index a81e314bad8..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/uglygep-address-space.ll +++ /dev/null @@ -1,56 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | FileCheck %s - -; LSR shouldn't consider %t8 to be an interesting user of %t6, and it -; should be able to form pretty GEPs. - -target datalayout = "e-p:64:64:64-p1:16:16:16-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" - -; Copy of uglygep with a different address space -; This tests expandAddToGEP uses the right smaller integer type for -; another address space -define void @Z4() nounwind { -; CHECK: define void @Z4 -bb: - br label %bb3 - -bb1: ; preds = %bb3 - br i1 undef, label %bb10, label %bb2 - -bb2: ; preds = %bb1 - %t = add i16 %t4, 1 ; <i16> [#uses=1] - br label %bb3 - -bb3: ; preds = %bb2, %bb - %t4 = phi i16 [ %t, %bb2 ], [ 0, %bb ] ; <i16> [#uses=3] - br label %bb1 - -; CHECK: bb10: -; CHECK-NEXT: %t7 = icmp eq i16 %t4, 0 -; Host %t2 computation outside the loop. -; CHECK-NEXT: [[SCEVGEP:%[^ ]+]] = getelementptr i8, i8 addrspace(1)* undef, i16 %t4 -; CHECK-NEXT: br label %bb14 -bb10: ; preds = %bb9 - %t7 = icmp eq i16 %t4, 0 ; <i1> [#uses=1] - %t3 = add i16 %t4, 16 ; <i16> [#uses=1] - br label %bb14 - -; CHECK: bb14: -; CHECK-NEXT: store i8 undef, i8 addrspace(1)* [[SCEVGEP]] -; CHECK-NEXT: %t6 = load float addrspace(1)*, float addrspace(1)* addrspace(1)* undef -; Fold %t3's add within the address. -; CHECK-NEXT: [[SCEVGEP1:%[^ ]+]] = getelementptr float, float addrspace(1)* %t6, i16 4 -; CHECK-NEXT: [[SCEVGEP2:%[^ ]+]] = bitcast float addrspace(1)* [[SCEVGEP1]] to i8 addrspace(1)* -; Use the induction variable (%t4) to access the right element -; CHECK-NEXT: [[ADDRESS:%[^ ]+]] = getelementptr i8, i8 addrspace(1)* [[SCEVGEP2]], i16 %t4 -; CHECK-NEXT: store i8 undef, i8 addrspace(1)* [[ADDRESS]] -; CHECK-NEXT: br label %bb14 -bb14: ; preds = %bb14, %bb10 - %t2 = getelementptr inbounds i8, i8 addrspace(1)* undef, i16 %t4 ; <i8*> [#uses=1] - store i8 undef, i8 addrspace(1)* %t2 - %t6 = load float addrspace(1)*, float addrspace(1)* addrspace(1)* undef - %t8 = bitcast float addrspace(1)* %t6 to i8 addrspace(1)* ; <i8*> [#uses=1] - %t9 = getelementptr inbounds i8, i8 addrspace(1)* %t8, i16 %t3 ; <i8*> [#uses=1] - store i8 undef, i8 addrspace(1)* %t9 - br label %bb14 -} - diff --git a/llvm/test/Transforms/LoopStrengthReduce/uglygep.ll b/llvm/test/Transforms/LoopStrengthReduce/uglygep.ll deleted file mode 100644 index 430127b3cd5..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/uglygep.ll +++ /dev/null @@ -1,122 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | FileCheck %s - -; LSR shouldn't consider %t8 to be an interesting user of %t6, and it -; should be able to form pretty GEPs. - -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 void @Z4() nounwind { -; CHECK-LABEL: define void @Z4( -bb: - br label %bb3 - -bb1: ; preds = %bb3 - br i1 undef, label %bb10, label %bb2 - -bb2: ; preds = %bb1 - %t = add i64 %t4, 1 ; <i64> [#uses=1] - br label %bb3 - -bb3: ; preds = %bb2, %bb - %t4 = phi i64 [ %t, %bb2 ], [ 0, %bb ] ; <i64> [#uses=3] - br label %bb1 - -; CHECK: bb10: -; CHECK-NEXT: %t7 = icmp eq i64 %t4, 0 -; Host %t2 computation outside the loop. -; CHECK-NEXT: [[SCEVGEP:%[^ ]+]] = getelementptr i8, i8* undef, i64 %t4 -; CHECK-NEXT: br label %bb14 -bb10: ; preds = %bb9 - %t7 = icmp eq i64 %t4, 0 ; <i1> [#uses=1] - %t3 = add i64 %t4, 16 ; <i64> [#uses=1] - br label %bb14 - -; CHECK: bb14: -; CHECK-NEXT: store i8 undef, i8* [[SCEVGEP]] -; CHECK-NEXT: %t6 = load float*, float** undef -; Fold %t3's add within the address. -; CHECK-NEXT: [[SCEVGEP1:%[^ ]+]] = getelementptr float, float* %t6, i64 4 -; CHECK-NEXT: [[SCEVGEP2:%[^ ]+]] = bitcast float* [[SCEVGEP1]] to i8* -; Use the induction variable (%t4) to access the right element -; CHECK-NEXT: [[ADDRESS:%[^ ]+]] = getelementptr i8, i8* [[SCEVGEP2]], i64 %t4 -; CHECK-NEXT: store i8 undef, i8* [[ADDRESS]] -; CHECK-NEXT: br label %bb14 -bb14: ; preds = %bb14, %bb10 - %t2 = getelementptr inbounds i8, i8* undef, i64 %t4 ; <i8*> [#uses=1] - store i8 undef, i8* %t2 - %t6 = load float*, float** undef - %t8 = bitcast float* %t6 to i8* ; <i8*> [#uses=1] - %t9 = getelementptr inbounds i8, i8* %t8, i64 %t3 ; <i8*> [#uses=1] - store i8 undef, i8* %t9 - br label %bb14 -} - -define fastcc void @TransformLine() nounwind { -; CHECK-LABEL: @TransformLine( -bb: - br label %loop0 - -; CHECK: loop0: -; Induction variable is initialized to -2. -; CHECK-NEXT: [[PHIIV:%[^ ]+]] = phi i32 [ [[IVNEXT:%[^ ]+]], %loop0 ], [ -2, %bb ] -; CHECK-NEXT: [[IVNEXT]] = add nuw nsw i32 [[PHIIV]], 1 -; CHECK-NEXT: br i1 false, label %loop0, label %bb0 -loop0: ; preds = %loop0, %bb - %i0 = phi i32 [ %i0.next, %loop0 ], [ 0, %bb ] ; <i32> [#uses=2] - %i0.next = add i32 %i0, 1 ; <i32> [#uses=1] - br i1 false, label %loop0, label %bb0 - -bb0: ; preds = %loop0 - br label %loop1 - -; CHECK: loop1: -; CHECK-NEXT: %i1 = phi i32 [ 0, %bb0 ], [ %i1.next, %bb5 ] -; IVNEXT covers the uses of %i0 and %t0. -; Therefore, %t0 has been removed. -; The critical edge has been split. -; CHECK-NEXT: br i1 false, label %bb2, label %[[LOOP1BB6:.+]] -loop1: ; preds = %bb5, %bb0 - %i1 = phi i32 [ 0, %bb0 ], [ %i1.next, %bb5 ] ; <i32> [#uses=4] - %t0 = add i32 %i0, %i1 ; <i32> [#uses=1] - br i1 false, label %bb2, label %bb6 - -; CHECK: bb2: -; Critical edge split. -; CHECK-NEXT: br i1 true, label %[[BB2BB6:[^,]+]], label %bb5 -bb2: ; preds = %loop1 - br i1 true, label %bb6, label %bb5 - -; CHECK: bb5: -; CHECK-NEXT: %i1.next = add i32 %i1, 1 -; CHECK-NEXT: br i1 true, label %[[BB5BB6:[^,]+]], label %loop1 -bb5: ; preds = %bb2 - %i1.next = add i32 %i1, 1 ; <i32> [#uses=1] - br i1 true, label %bb6, label %loop1 - -; bb5 to bb6 split basic block. -; CHECK: [[BB5BB6]]: -; CHECK-NEXT: [[INITIALVAL:%[^ ]+]] = add i32 [[IVNEXT]], %i1.next -; CHECK-NEXT: br label %[[SPLITTOBB6:.+]] - -; bb2 to bb6 split basic block. -; CHECK: [[BB2BB6]]: -; CHECK-NEXT: br label %[[SPLITTOBB6]] - -; Split basic blocks to bb6. -; CHECK: [[SPLITTOBB6]]: -; CHECK-NEXT: [[INITP8:%[^ ]+]] = phi i32 [ [[INITIALVAL]], %[[BB5BB6]] ], [ undef, %[[BB2BB6]] ] -; CHECK-NEXT: [[INITP9:%[^ ]+]] = phi i32 [ undef, %[[BB5BB6]] ], [ %i1, %[[BB2BB6]] ] -; CHECK-NEXT: br label %bb6 - -; CHECK: [[LOOP1BB6]]: -; CHECK-NEXT: br label %bb6 - -; CHECK: bb6: -; CHECK-NEXT: %p8 = phi i32 [ undef, %[[LOOP1BB6]] ], [ [[INITP8]], %[[SPLITTOBB6]] ] -; CHECK-NEXT: %p9 = phi i32 [ %i1, %[[LOOP1BB6]] ], [ [[INITP9]], %[[SPLITTOBB6]] ] -; CHECK-NEXT: unreachable -bb6: ; preds = %bb5, %bb2, %loop1 - %p8 = phi i32 [ %t0, %bb5 ], [ undef, %loop1 ], [ undef, %bb2 ] ; <i32> [#uses=0] - %p9 = phi i32 [ undef, %bb5 ], [ %i1, %loop1 ], [ %i1, %bb2 ] ; <i32> [#uses=0] - unreachable -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/use_postinc_value_outside_loop.ll b/llvm/test/Transforms/LoopStrengthReduce/use_postinc_value_outside_loop.ll deleted file mode 100644 index a673768d770..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/use_postinc_value_outside_loop.ll +++ /dev/null @@ -1,29 +0,0 @@ -; RUN: opt < %s -loop-reduce -S | \ -; RUN: grep "add i32 %indvar630.ui, 1" -; -; Make sure that the use of the IV outside of the loop (the store) uses the -; post incremented value of the IV, not the preincremented value. This -; prevents the loop from having to keep the post and pre-incremented value -; around for the duration of the loop, adding a copy and an extra register -; to the loop. - -declare i1 @pred(i32) - -define void @test([700 x i32]* %nbeaux_.0__558, i32* %i_.16574) { -then.0: - br label %no_exit.2 -no_exit.2: ; preds = %no_exit.2, %then.0 - %indvar630.ui = phi i32 [ 0, %then.0 ], [ %indvar.next631, %no_exit.2 ] ; <i32> [#uses=3] - %indvar630 = bitcast i32 %indvar630.ui to i32 ; <i32> [#uses=2] - %gep.upgrd.1 = zext i32 %indvar630.ui to i64 ; <i64> [#uses=1] - %tmp.38 = getelementptr [700 x i32], [700 x i32]* %nbeaux_.0__558, i32 0, i64 %gep.upgrd.1 ; <i32*> [#uses=1] - store i32 0, i32* %tmp.38 - %inc.2 = add i32 %indvar630, 2 ; <i32> [#uses=1] - %tmp.34 = call i1 @pred( i32 %indvar630 ) ; <i1> [#uses=1] - %indvar.next631 = add i32 %indvar630.ui, 1 ; <i32> [#uses=1] - br i1 %tmp.34, label %no_exit.2, label %loopexit.2.loopexit -loopexit.2.loopexit: ; preds = %no_exit.2 - store i32 %inc.2, i32* %i_.16574 - ret void -} - diff --git a/llvm/test/Transforms/LoopStrengthReduce/var_stride_used_by_compare.ll b/llvm/test/Transforms/LoopStrengthReduce/var_stride_used_by_compare.ll deleted file mode 100644 index 2dd14a0e598..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/var_stride_used_by_compare.ll +++ /dev/null @@ -1,41 +0,0 @@ -; Base should not be i*3, it should be i*2. -; RUN: opt < %s -loop-reduce -S | \ -; RUN: not grep "mul.*%i, 3" - -; Indvar should not start at zero: -; RUN: opt < %s -loop-reduce -S | \ -; RUN: not grep "phi i32 .* 0" -; END. - -; mul uint %i, 3 - -target datalayout = "e-p:32:32-n32" -target triple = "i686-apple-darwin8" -@flags2 = external global [8193 x i8], align 32 ; <[8193 x i8]*> [#uses=1] - -define void @foo(i32 %k, i32 %i.s) { -entry: - %i = bitcast i32 %i.s to i32 ; <i32> [#uses=2] - %k_addr.012 = shl i32 %i.s, 1 ; <i32> [#uses=1] - %tmp14 = icmp sgt i32 %k_addr.012, 8192 ; <i1> [#uses=1] - br i1 %tmp14, label %return, label %bb.preheader -bb.preheader: ; preds = %entry - %tmp. = shl i32 %i, 1 ; <i32> [#uses=1] - br label %bb -bb: ; preds = %bb, %bb.preheader - %indvar = phi i32 [ %indvar.next, %bb ], [ 0, %bb.preheader ] ; <i32> [#uses=2] - %tmp.15 = mul i32 %indvar, %i ; <i32> [#uses=1] - %tmp.16 = add i32 %tmp.15, %tmp. ; <i32> [#uses=2] - %k_addr.0.0 = bitcast i32 %tmp.16 to i32 ; <i32> [#uses=1] - %gep.upgrd.1 = zext i32 %tmp.16 to i64 ; <i64> [#uses=1] - %tmp = getelementptr [8193 x i8], [8193 x i8]* @flags2, i32 0, i64 %gep.upgrd.1 ; <i8*> [#uses=1] - store i8 0, i8* %tmp - %k_addr.0 = add i32 %k_addr.0.0, %i.s ; <i32> [#uses=1] - %tmp.upgrd.2 = icmp sgt i32 %k_addr.0, 8192 ; <i1> [#uses=1] - %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1] - br i1 %tmp.upgrd.2, label %return.loopexit, label %bb -return.loopexit: ; preds = %bb - br label %return -return: ; preds = %return.loopexit, %entry - ret void -} diff --git a/llvm/test/Transforms/LoopStrengthReduce/variable_stride.ll b/llvm/test/Transforms/LoopStrengthReduce/variable_stride.ll deleted file mode 100644 index f82b2fc29ac..00000000000 --- a/llvm/test/Transforms/LoopStrengthReduce/variable_stride.ll +++ /dev/null @@ -1,21 +0,0 @@ -; Check that variable strides are reduced to adds instead of multiplies. -; RUN: opt < %s -loop-reduce -S | not grep mul - -; Provide legal integer types. -target datalayout = "n8:16:32:64" - -declare i1 @pred(i32) - -define void @test([10000 x i32]* %P, i32 %STRIDE) { -; <label>:0 - br label %Loop -Loop: ; preds = %Loop, %0 - %INDVAR = phi i32 [ 0, %0 ], [ %INDVAR2, %Loop ] ; <i32> [#uses=2] - %Idx = mul i32 %INDVAR, %STRIDE ; <i32> [#uses=1] - %cond = call i1 @pred( i32 %Idx ) ; <i1> [#uses=1] - %INDVAR2 = add i32 %INDVAR, 1 ; <i32> [#uses=1] - br i1 %cond, label %Loop, label %Out -Out: ; preds = %Loop - ret void -} - |