summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/LoopUnroll
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/Transforms/LoopUnroll')
-rw-r--r--llvm/test/Transforms/LoopUnroll/2004-05-13-DontUnrollTooMuch.ll14
-rw-r--r--llvm/test/Transforms/LoopUnroll/2005-03-06-BadLoopInfoUpdate.ll22
-rw-r--r--llvm/test/Transforms/LoopUnroll/2006-08-24-MultiBlockLoop.ll16
-rw-r--r--llvm/test/Transforms/LoopUnroll/2007-04-16-PhiUpdate.ll17
-rw-r--r--llvm/test/Transforms/LoopUnroll/2007-05-05-UnrollMiscomp.ll36
-rw-r--r--llvm/test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll18
-rw-r--r--llvm/test/Transforms/LoopUnroll/2007-11-05-Crash.ll295
-rw-r--r--llvm/test/Transforms/LoopUnroll/2011-08-08-PhiUpdate.ll103
-rw-r--r--llvm/test/Transforms/LoopUnroll/2011-08-09-IVSimplify.ll41
-rw-r--r--llvm/test/Transforms/LoopUnroll/2011-08-09-PhiUpdate.ll62
-rw-r--r--llvm/test/Transforms/LoopUnroll/2011-10-01-NoopTrunc.ll36
-rw-r--r--llvm/test/Transforms/LoopUnroll/2012-04-09-unroll-indirectbr.ll40
-rw-r--r--llvm/test/Transforms/LoopUnroll/AArch64/falkor-prefetch.ll169
-rw-r--r--llvm/test/Transforms/LoopUnroll/AArch64/full-unroll-trip-count-upper-bound.ll43
-rw-r--r--llvm/test/Transforms/LoopUnroll/AArch64/lit.local.cfg3
-rw-r--r--llvm/test/Transforms/LoopUnroll/AArch64/partial.ll76
-rw-r--r--llvm/test/Transforms/LoopUnroll/AArch64/runtime-loop.ll39
-rw-r--r--llvm/test/Transforms/LoopUnroll/AMDGPU/lit.local.cfg3
-rw-r--r--llvm/test/Transforms/LoopUnroll/AMDGPU/unroll-barrier.ll33
-rw-r--r--llvm/test/Transforms/LoopUnroll/AMDGPU/unroll-cost-call.ll77
-rw-r--r--llvm/test/Transforms/LoopUnroll/AMDGPU/unroll-for-private.ll154
-rw-r--r--llvm/test/Transforms/LoopUnroll/ARM/lit.local.cfg3
-rw-r--r--llvm/test/Transforms/LoopUnroll/ARM/loop-unrolling.ll247
-rw-r--r--llvm/test/Transforms/LoopUnroll/ARM/multi-blocks.ll316
-rw-r--r--llvm/test/Transforms/LoopUnroll/Hexagon/lit.local.cfg3
-rw-r--r--llvm/test/Transforms/LoopUnroll/Hexagon/peel-small-loop.ll37
-rw-r--r--llvm/test/Transforms/LoopUnroll/PowerPC/a2-high-cost-trip-count-computation.ll27
-rw-r--r--llvm/test/Transforms/LoopUnroll/PowerPC/a2-unrolling.ll34
-rw-r--r--llvm/test/Transforms/LoopUnroll/PowerPC/lit.local.cfg3
-rw-r--r--llvm/test/Transforms/LoopUnroll/PowerPC/p7-unrolling.ll50
-rw-r--r--llvm/test/Transforms/LoopUnroll/PowerPC/p8-unrolling-legalize-vectors.ll74
-rw-r--r--llvm/test/Transforms/LoopUnroll/X86/lit.local.cfg3
-rw-r--r--llvm/test/Transforms/LoopUnroll/X86/mmx.ll24
-rw-r--r--llvm/test/Transforms/LoopUnroll/X86/partial.ll130
-rw-r--r--llvm/test/Transforms/LoopUnroll/X86/store_cost.ll104
-rw-r--r--llvm/test/Transforms/LoopUnroll/basic.ll48
-rw-r--r--llvm/test/Transforms/LoopUnroll/complete_unroll_profitability_with_assume.ll119
-rw-r--r--llvm/test/Transforms/LoopUnroll/convergent.ll179
-rw-r--r--llvm/test/Transforms/LoopUnroll/debug-info.ll75
-rw-r--r--llvm/test/Transforms/LoopUnroll/disable-loop-unrolling_forced.ll30
-rw-r--r--llvm/test/Transforms/LoopUnroll/disable_nonforced.ll29
-rw-r--r--llvm/test/Transforms/LoopUnroll/disable_nonforced_count.ll30
-rw-r--r--llvm/test/Transforms/LoopUnroll/disable_nonforced_enable.ll30
-rw-r--r--llvm/test/Transforms/LoopUnroll/disable_nonforced_full.ll32
-rw-r--r--llvm/test/Transforms/LoopUnroll/ephemeral.ll44
-rw-r--r--llvm/test/Transforms/LoopUnroll/epilog_const_phi.ll65
-rw-r--r--llvm/test/Transforms/LoopUnroll/followup.ll63
-rw-r--r--llvm/test/Transforms/LoopUnroll/full-unroll-bad-cost.ll59
-rw-r--r--llvm/test/Transforms/LoopUnroll/full-unroll-crashers.ll225
-rw-r--r--llvm/test/Transforms/LoopUnroll/full-unroll-heuristics-2.ll90
-rw-r--r--llvm/test/Transforms/LoopUnroll/full-unroll-heuristics-cmp.ll79
-rw-r--r--llvm/test/Transforms/LoopUnroll/full-unroll-heuristics-dce.ll39
-rw-r--r--llvm/test/Transforms/LoopUnroll/full-unroll-heuristics-geps.ll29
-rw-r--r--llvm/test/Transforms/LoopUnroll/full-unroll-heuristics-phi-prop.ll24
-rw-r--r--llvm/test/Transforms/LoopUnroll/full-unroll-heuristics.ll69
-rw-r--r--llvm/test/Transforms/LoopUnroll/full-unroll-keep-first-exit.ll208
-rw-r--r--llvm/test/Transforms/LoopUnroll/high-cost-trip-count-computation.ll61
-rw-r--r--llvm/test/Transforms/LoopUnroll/ignore-annotation-intrinsic-cost.ll133
-rw-r--r--llvm/test/Transforms/LoopUnroll/invalidate_right_loop.ll51
-rw-r--r--llvm/test/Transforms/LoopUnroll/loop-remarks-with-hotness.ll28
-rw-r--r--llvm/test/Transforms/LoopUnroll/loop-remarks.ll48
-rw-r--r--llvm/test/Transforms/LoopUnroll/not-rotated.ll26
-rw-r--r--llvm/test/Transforms/LoopUnroll/partial-unroll-const-bounds.ll37
-rw-r--r--llvm/test/Transforms/LoopUnroll/peel-loop-conditions.ll645
-rw-r--r--llvm/test/Transforms/LoopUnroll/peel-loop-irreducible.ll36
-rw-r--r--llvm/test/Transforms/LoopUnroll/peel-loop-negative.ll28
-rw-r--r--llvm/test/Transforms/LoopUnroll/peel-loop-not-forced.ll199
-rw-r--r--llvm/test/Transforms/LoopUnroll/peel-loop-pgo.ll110
-rw-r--r--llvm/test/Transforms/LoopUnroll/peel-loop-scev-invalidate.ll42
-rw-r--r--llvm/test/Transforms/LoopUnroll/peel-loop.ll115
-rw-r--r--llvm/test/Transforms/LoopUnroll/peel-loop2.ll61
-rw-r--r--llvm/test/Transforms/LoopUnroll/pr10813.ll29
-rw-r--r--llvm/test/Transforms/LoopUnroll/pr11361.ll42
-rw-r--r--llvm/test/Transforms/LoopUnroll/pr14167.ll44
-rw-r--r--llvm/test/Transforms/LoopUnroll/pr18861.ll86
-rw-r--r--llvm/test/Transforms/LoopUnroll/pr27157.ll53
-rw-r--r--llvm/test/Transforms/LoopUnroll/pr28132.ll77
-rw-r--r--llvm/test/Transforms/LoopUnroll/pr31718.ll55
-rw-r--r--llvm/test/Transforms/LoopUnroll/pr33437.ll43
-rw-r--r--llvm/test/Transforms/LoopUnroll/rebuild_lcssa.ll190
-rw-r--r--llvm/test/Transforms/LoopUnroll/revisit.ll156
-rw-r--r--llvm/test/Transforms/LoopUnroll/runtime-epilog-debuginfo.ll128
-rw-r--r--llvm/test/Transforms/LoopUnroll/runtime-li.ll36
-rw-r--r--llvm/test/Transforms/LoopUnroll/runtime-loop-multiexit-dom-verify.ll275
-rw-r--r--llvm/test/Transforms/LoopUnroll/runtime-loop-multiple-exits.ll646
-rw-r--r--llvm/test/Transforms/LoopUnroll/runtime-loop-non-exiting-latch.ll27
-rw-r--r--llvm/test/Transforms/LoopUnroll/runtime-loop.ll285
-rw-r--r--llvm/test/Transforms/LoopUnroll/runtime-loop1.ll77
-rw-r--r--llvm/test/Transforms/LoopUnroll/runtime-loop2.ll39
-rw-r--r--llvm/test/Transforms/LoopUnroll/runtime-loop3.ll46
-rw-r--r--llvm/test/Transforms/LoopUnroll/runtime-loop4.ll52
-rw-r--r--llvm/test/Transforms/LoopUnroll/runtime-loop5.ll49
-rw-r--r--llvm/test/Transforms/LoopUnroll/runtime-multiexit-heuristic.ll94
-rw-r--r--llvm/test/Transforms/LoopUnroll/runtime-unroll-remainder.ll74
-rw-r--r--llvm/test/Transforms/LoopUnroll/scevunroll.ll207
-rw-r--r--llvm/test/Transforms/LoopUnroll/shifted-tripcount.ll28
-rw-r--r--llvm/test/Transforms/LoopUnroll/tripcount-overflow.ll49
-rw-r--r--llvm/test/Transforms/LoopUnroll/unloop.ll473
-rw-r--r--llvm/test/Transforms/LoopUnroll/unroll-cleanup.ll85
-rw-r--r--llvm/test/Transforms/LoopUnroll/unroll-cleanuppad.ll40
-rw-r--r--llvm/test/Transforms/LoopUnroll/unroll-count.ll25
-rw-r--r--llvm/test/Transforms/LoopUnroll/unroll-heuristics-pgo.ll59
-rw-r--r--llvm/test/Transforms/LoopUnroll/unroll-loop-invalidation.ll107
-rw-r--r--llvm/test/Transforms/LoopUnroll/unroll-maxcount.ll31
-rw-r--r--llvm/test/Transforms/LoopUnroll/unroll-opt-attribute.ll176
-rw-r--r--llvm/test/Transforms/LoopUnroll/unroll-pragmas-disabled.ll149
-rw-r--r--llvm/test/Transforms/LoopUnroll/unroll-pragmas.ll372
-rw-r--r--llvm/test/Transforms/LoopUnroll/update-loop-info-in-subloops.ll36
108 files changed, 0 insertions, 9978 deletions
diff --git a/llvm/test/Transforms/LoopUnroll/2004-05-13-DontUnrollTooMuch.ll b/llvm/test/Transforms/LoopUnroll/2004-05-13-DontUnrollTooMuch.ll
deleted file mode 100644
index 3141bf1900c..00000000000
--- a/llvm/test/Transforms/LoopUnroll/2004-05-13-DontUnrollTooMuch.ll
+++ /dev/null
@@ -1,14 +0,0 @@
-; RUN: opt < %s -loop-unroll -disable-output
-
-define i32 @main() {
-entry:
- br label %no_exit
-no_exit: ; preds = %no_exit, %entry
- %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %no_exit ] ; <i32> [#uses=1]
- %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=2]
- %exitcond = icmp ne i32 %indvar.next, -2147483648 ; <i1> [#uses=1]
- br i1 %exitcond, label %no_exit, label %loopexit
-loopexit: ; preds = %no_exit
- ret i32 0
-}
-
diff --git a/llvm/test/Transforms/LoopUnroll/2005-03-06-BadLoopInfoUpdate.ll b/llvm/test/Transforms/LoopUnroll/2005-03-06-BadLoopInfoUpdate.ll
deleted file mode 100644
index 374f46d10cb..00000000000
--- a/llvm/test/Transforms/LoopUnroll/2005-03-06-BadLoopInfoUpdate.ll
+++ /dev/null
@@ -1,22 +0,0 @@
-; RUN: opt < %s -loop-unroll -loop-simplify -disable-output
-
-define void @print_board() {
-entry:
- br label %no_exit.1
-no_exit.1: ; preds = %cond_false.2, %entry
- br label %no_exit.2
-no_exit.2: ; preds = %no_exit.2, %no_exit.1
- %indvar1 = phi i32 [ 0, %no_exit.1 ], [ %indvar.next2, %no_exit.2 ] ; <i32> [#uses=1]
- %indvar.next2 = add i32 %indvar1, 1 ; <i32> [#uses=2]
- %exitcond3 = icmp ne i32 %indvar.next2, 7 ; <i1> [#uses=1]
- br i1 %exitcond3, label %no_exit.2, label %loopexit.2
-loopexit.2: ; preds = %no_exit.2
- br i1 false, label %cond_true.2, label %cond_false.2
-cond_true.2: ; preds = %loopexit.2
- ret void
-cond_false.2: ; preds = %loopexit.2
- br i1 false, label %no_exit.1, label %loopexit.1
-loopexit.1: ; preds = %cond_false.2
- ret void
-}
-
diff --git a/llvm/test/Transforms/LoopUnroll/2006-08-24-MultiBlockLoop.ll b/llvm/test/Transforms/LoopUnroll/2006-08-24-MultiBlockLoop.ll
deleted file mode 100644
index 8219a0c2305..00000000000
--- a/llvm/test/Transforms/LoopUnroll/2006-08-24-MultiBlockLoop.ll
+++ /dev/null
@@ -1,16 +0,0 @@
-; RUN: opt < %s -loop-unroll -S | grep bb72.2
-
-define void @vorbis_encode_noisebias_setup() {
-entry:
- br label %cond_true.outer
-cond_true.outer: ; preds = %bb72, %entry
- %indvar1.ph = phi i32 [ 0, %entry ], [ %indvar.next2, %bb72 ] ; <i32> [#uses=1]
- br label %bb72
-bb72: ; preds = %cond_true.outer
- %indvar.next2 = add i32 %indvar1.ph, 1 ; <i32> [#uses=2]
- %exitcond3 = icmp eq i32 %indvar.next2, 3 ; <i1> [#uses=1]
- br i1 %exitcond3, label %cond_true138, label %cond_true.outer
-cond_true138: ; preds = %bb72
- ret void
-}
-
diff --git a/llvm/test/Transforms/LoopUnroll/2007-04-16-PhiUpdate.ll b/llvm/test/Transforms/LoopUnroll/2007-04-16-PhiUpdate.ll
deleted file mode 100644
index 40c9ce0e50b..00000000000
--- a/llvm/test/Transforms/LoopUnroll/2007-04-16-PhiUpdate.ll
+++ /dev/null
@@ -1,17 +0,0 @@
-; PR 1334
-; RUN: opt < %s -loop-unroll -disable-output
-
-define void @sal__math_float_manipulator_7__math__joint_array_dcv_ops__Omultiply__3([6 x float]* %agg.result) {
-entry:
- %tmp282911 = zext i8 0 to i32 ; <i32> [#uses=1]
- br label %cond_next
-cond_next: ; preds = %cond_next, %entry
- %indvar = phi i8 [ 0, %entry ], [ %indvar.next, %cond_next ] ; <i8> [#uses=1]
- %indvar.next = add i8 %indvar, 1 ; <i8> [#uses=2]
- %exitcond = icmp eq i8 %indvar.next, 7 ; <i1> [#uses=1]
- br i1 %exitcond, label %bb27, label %cond_next
-bb27: ; preds = %cond_next
- %tmp282911.lcssa = phi i32 [ %tmp282911, %cond_next ] ; <i32> [#uses=0]
- ret void
-}
-
diff --git a/llvm/test/Transforms/LoopUnroll/2007-05-05-UnrollMiscomp.ll b/llvm/test/Transforms/LoopUnroll/2007-05-05-UnrollMiscomp.ll
deleted file mode 100644
index 95e9dde04e6..00000000000
--- a/llvm/test/Transforms/LoopUnroll/2007-05-05-UnrollMiscomp.ll
+++ /dev/null
@@ -1,36 +0,0 @@
-; RUN: opt < %s -loop-unroll -S | not grep undef
-; PR1385
-
-target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
-target triple = "i686-apple-darwin8"
- %struct.__mpz_struct = type { i32, i32, i32* }
-
-
-define void @Foo(%struct.__mpz_struct* %base) {
-entry:
- %want = alloca [1 x %struct.__mpz_struct], align 16 ; <[1 x %struct.__mpz_struct]*> [#uses=4]
- %want1 = getelementptr [1 x %struct.__mpz_struct], [1 x %struct.__mpz_struct]* %want, i32 0, i32 0 ; <%struct.__mpz_struct*> [#uses=1]
- call void @__gmpz_init( %struct.__mpz_struct* %want1 )
- %want27 = getelementptr [1 x %struct.__mpz_struct], [1 x %struct.__mpz_struct]* %want, i32 0, i32 0 ; <%struct.__mpz_struct*> [#uses=1]
- %want3 = getelementptr [1 x %struct.__mpz_struct], [1 x %struct.__mpz_struct]* %want, i32 0, i32 0 ; <%struct.__mpz_struct*> [#uses=1]
- %want2 = getelementptr [1 x %struct.__mpz_struct], [1 x %struct.__mpz_struct]* %want, i32 0, i32 0 ; <%struct.__mpz_struct*> [#uses=2]
- br label %bb
-
-bb: ; preds = %bb, %entry
- %i.01.0 = phi i32 [ 0, %entry ], [ %indvar.next, %bb ] ; <i32> [#uses=1]
- %want23.0 = phi %struct.__mpz_struct* [ %want27, %entry ], [ %want2, %bb ] ; <%struct.__mpz_struct*> [#uses=1]
- call void @__gmpz_mul( %struct.__mpz_struct* %want23.0, %struct.__mpz_struct* %want3, %struct.__mpz_struct* %base )
- %indvar.next = add i32 %i.01.0, 1 ; <i32> [#uses=2]
- %exitcond = icmp ne i32 %indvar.next, 2 ; <i1> [#uses=1]
- br i1 %exitcond, label %bb, label %bb10
-
-bb10: ; preds = %bb
- %want2.lcssa = phi %struct.__mpz_struct* [ %want2, %bb ] ; <%struct.__mpz_struct*> [#uses=1]
- call void @__gmpz_clear( %struct.__mpz_struct* %want2.lcssa )
- ret void
-}
-
-declare void @__gmpz_init(%struct.__mpz_struct*)
-declare void @__gmpz_mul(%struct.__mpz_struct*, %struct.__mpz_struct*, %struct.__mpz_struct*)
-declare void @__gmpz_clear(%struct.__mpz_struct*)
-
diff --git a/llvm/test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll b/llvm/test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll
deleted file mode 100644
index 68842a41957..00000000000
--- a/llvm/test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll
+++ /dev/null
@@ -1,18 +0,0 @@
-; RUN: opt < %s -loop-unroll -unroll-count=3 -S | grep bb72.2
-
-define void @foo(i32 %trips) {
-entry:
- br label %cond_true.outer
-
-cond_true.outer:
- %indvar1.ph = phi i32 [ 0, %entry ], [ %indvar.next2, %bb72 ]
- br label %bb72
-
-bb72:
- %indvar.next2 = add i32 %indvar1.ph, 1
- %exitcond3 = icmp eq i32 %indvar.next2, %trips
- br i1 %exitcond3, label %cond_true138, label %cond_true.outer
-
-cond_true138:
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/2007-11-05-Crash.ll b/llvm/test/Transforms/LoopUnroll/2007-11-05-Crash.ll
deleted file mode 100644
index 1711f119997..00000000000
--- a/llvm/test/Transforms/LoopUnroll/2007-11-05-Crash.ll
+++ /dev/null
@@ -1,295 +0,0 @@
-; RUN: opt < %s -disable-output -loop-unroll
-; PR1770
-; PR1947
-
- %struct.cl_engine = type { i32, i16, i32, i8**, i8**, i8*, i8*, i8*, i8*, i8*, i8*, i8* }
- %struct.cl_limits = type { i32, i32, i32, i32, i16, i64 }
- %struct.cli_ac_alt = type { i8, i8*, i16, i16, %struct.cli_ac_alt* }
- %struct.cli_ac_node = type { i8, i8, %struct.cli_ac_patt*, %struct.cli_ac_node**, %struct.cli_ac_node* }
- %struct.cli_ac_patt = type { i16*, i16*, i16, i16, i8, i32, i32, i8*, i8*, i32, i16, i16, i16, i16, %struct.cli_ac_alt**, i8, i16, %struct.cli_ac_patt*, %struct.cli_ac_patt* }
- %struct.cli_bm_patt = type { i8*, i32, i8*, i8*, i8, %struct.cli_bm_patt* }
- %struct.cli_ctx = type { i8**, i64*, %struct.cli_matcher*, %struct.cl_engine*, %struct.cl_limits*, i32, i32, i32, i32, %struct.cli_dconf* }
- %struct.cli_dconf = type { i32, i32, i32, i32, i32, i32, i32 }
- %struct.cli_matcher = type { i16, i8, i32*, %struct.cli_bm_patt**, i32*, i32, i8, i8, %struct.cli_ac_node*, %struct.cli_ac_node**, %struct.cli_ac_patt**, i32, i32, i32 }
-
-declare i8* @calloc(i64, i64)
-
-define fastcc i32 @cli_scanpe(i32 %desc, %struct.cli_ctx* %ctx) {
-entry:
- br i1 false, label %cond_next17, label %cond_true14
-
-cond_true14: ; preds = %entry
- ret i32 0
-
-cond_next17: ; preds = %entry
- br i1 false, label %LeafBlock, label %LeafBlock1250
-
-LeafBlock1250: ; preds = %cond_next17
- ret i32 0
-
-LeafBlock: ; preds = %cond_next17
- br i1 false, label %cond_next33, label %cond_true30
-
-cond_true30: ; preds = %LeafBlock
- ret i32 0
-
-cond_next33: ; preds = %LeafBlock
- br i1 false, label %cond_next90, label %cond_true42
-
-cond_true42: ; preds = %cond_next33
- ret i32 0
-
-cond_next90: ; preds = %cond_next33
- br i1 false, label %cond_next100, label %cond_true97
-
-cond_true97: ; preds = %cond_next90
- ret i32 0
-
-cond_next100: ; preds = %cond_next90
- br i1 false, label %cond_next109, label %cond_true106
-
-cond_true106: ; preds = %cond_next100
- ret i32 0
-
-cond_next109: ; preds = %cond_next100
- br i1 false, label %cond_false, label %cond_true118
-
-cond_true118: ; preds = %cond_next109
- ret i32 0
-
-cond_false: ; preds = %cond_next109
- br i1 false, label %NodeBlock1482, label %cond_true126
-
-cond_true126: ; preds = %cond_false
- ret i32 0
-
-NodeBlock1482: ; preds = %cond_false
- br i1 false, label %cond_next285, label %NodeBlock1480
-
-NodeBlock1480: ; preds = %NodeBlock1482
- ret i32 0
-
-cond_next285: ; preds = %NodeBlock1482
- br i1 false, label %cond_next320, label %cond_true294
-
-cond_true294: ; preds = %cond_next285
- ret i32 0
-
-cond_next320: ; preds = %cond_next285
- br i1 false, label %LeafBlock1491, label %LeafBlock1493
-
-LeafBlock1493: ; preds = %cond_next320
- ret i32 0
-
-LeafBlock1491: ; preds = %cond_next320
- br i1 false, label %cond_true400, label %cond_true378
-
-cond_true378: ; preds = %LeafBlock1491
- ret i32 1
-
-cond_true400: ; preds = %LeafBlock1491
- br i1 false, label %cond_next413, label %cond_true406
-
-cond_true406: ; preds = %cond_true400
- ret i32 0
-
-cond_next413: ; preds = %cond_true400
- br i1 false, label %cond_next429, label %cond_true424
-
-cond_true424: ; preds = %cond_next413
- ret i32 0
-
-cond_next429: ; preds = %cond_next413
- br i1 false, label %NodeBlock1557, label %NodeBlock1579
-
-NodeBlock1579: ; preds = %cond_next429
- ret i32 0
-
-NodeBlock1557: ; preds = %cond_next429
- br i1 false, label %LeafBlock1543, label %NodeBlock1555
-
-NodeBlock1555: ; preds = %NodeBlock1557
- ret i32 0
-
-LeafBlock1543: ; preds = %NodeBlock1557
- br i1 false, label %cond_next870, label %cond_next663
-
-cond_next663: ; preds = %LeafBlock1543
- ret i32 0
-
-cond_next870: ; preds = %LeafBlock1543
- br i1 false, label %cond_true1012, label %cond_true916
-
-cond_true916: ; preds = %cond_next870
- ret i32 0
-
-cond_true1012: ; preds = %cond_next870
- br i1 false, label %cond_next3849, label %cond_true2105
-
-cond_true2105: ; preds = %cond_true1012
- ret i32 0
-
-cond_next3849: ; preds = %cond_true1012
- br i1 false, label %cond_next4378, label %bb6559
-
-bb3862: ; preds = %cond_next4385
- br i1 false, label %cond_false3904, label %cond_true3876
-
-cond_true3876: ; preds = %bb3862
- ret i32 0
-
-cond_false3904: ; preds = %bb3862
- br i1 false, label %cond_next4003, label %cond_true3935
-
-cond_true3935: ; preds = %cond_false3904
- ret i32 0
-
-cond_next4003: ; preds = %cond_false3904
- br i1 false, label %cond_next5160, label %cond_next4015
-
-cond_next4015: ; preds = %cond_next4003
- ret i32 0
-
-cond_next4378: ; preds = %cond_next3849
- br i1 false, label %cond_next4385, label %bb4393
-
-cond_next4385: ; preds = %cond_next4378
- br i1 false, label %bb3862, label %bb4393
-
-bb4393: ; preds = %cond_next4385, %cond_next4378
- ret i32 0
-
-cond_next5160: ; preds = %cond_next4003
- br i1 false, label %bb5188, label %bb6559
-
-bb5188: ; preds = %cond_next5160
- br i1 false, label %cond_next5285, label %cond_true5210
-
-cond_true5210: ; preds = %bb5188
- ret i32 0
-
-cond_next5285: ; preds = %bb5188
- br i1 false, label %cond_true5302, label %cond_true5330
-
-cond_true5302: ; preds = %cond_next5285
- br i1 false, label %bb7405, label %bb7367
-
-cond_true5330: ; preds = %cond_next5285
- ret i32 0
-
-bb6559: ; preds = %cond_next5160, %cond_next3849
- ret i32 0
-
-bb7367: ; preds = %cond_true5302
- ret i32 0
-
-bb7405: ; preds = %cond_true5302
- br i1 false, label %cond_next8154, label %cond_true7410
-
-cond_true7410: ; preds = %bb7405
- ret i32 0
-
-cond_next8154: ; preds = %bb7405
- br i1 false, label %cond_true8235, label %bb9065
-
-cond_true8235: ; preds = %cond_next8154
- br i1 false, label %bb8274, label %bb8245
-
-bb8245: ; preds = %cond_true8235
- ret i32 0
-
-bb8274: ; preds = %cond_true8235
- br i1 false, label %cond_next8358, label %cond_true8295
-
-cond_true8295: ; preds = %bb8274
- ret i32 0
-
-cond_next8358: ; preds = %bb8274
- br i1 false, label %cond_next.i509, label %cond_true8371
-
-cond_true8371: ; preds = %cond_next8358
- ret i32 -123
-
-cond_next.i509: ; preds = %cond_next8358
- br i1 false, label %bb36.i, label %bb33.i
-
-bb33.i: ; preds = %cond_next.i509
- ret i32 0
-
-bb36.i: ; preds = %cond_next.i509
- br i1 false, label %cond_next54.i, label %cond_true51.i
-
-cond_true51.i: ; preds = %bb36.i
- ret i32 0
-
-cond_next54.i: ; preds = %bb36.i
- %tmp10.i.i527 = call i8* @calloc( i64 0, i64 1 ) ; <i8*> [#uses=1]
- br i1 false, label %cond_next11.i.i, label %bb132.i
-
-bb132.i: ; preds = %cond_next54.i
- ret i32 0
-
-cond_next11.i.i: ; preds = %cond_next54.i
- br i1 false, label %bb32.i.i545, label %cond_true1008.critedge.i
-
-bb32.i.i545: ; preds = %cond_next11.i.i
- br i1 false, label %cond_next349.i, label %cond_true184.i
-
-cond_true184.i: ; preds = %bb32.i.i545
- ret i32 0
-
-cond_next349.i: ; preds = %bb32.i.i545
- br i1 false, label %cond_next535.i, label %cond_true1008.critedge1171.i
-
-cond_next535.i: ; preds = %cond_next349.i
- br i1 false, label %cond_next569.i, label %cond_false574.i
-
-cond_next569.i: ; preds = %cond_next535.i
- br i1 false, label %cond_next670.i, label %cond_true1008.critedge1185.i
-
-cond_false574.i: ; preds = %cond_next535.i
- ret i32 0
-
-cond_next670.i: ; preds = %cond_next569.i
- br i1 false, label %cond_true692.i, label %cond_next862.i
-
-cond_true692.i: ; preds = %cond_next670.i
- br i1 false, label %cond_false742.i, label %cond_true718.i
-
-cond_true718.i: ; preds = %cond_true692.i
- ret i32 0
-
-cond_false742.i: ; preds = %cond_true692.i
- br i1 false, label %cond_true784.i, label %cond_next9079
-
-cond_true784.i: ; preds = %cond_next811.i, %cond_false742.i
- %indvar1411.i.reg2mem.0 = phi i8 [ %indvar.next1412.i, %cond_next811.i ], [ 0, %cond_false742.i ] ; <i8> [#uses=1]
- br i1 false, label %cond_true1008.critedge1190.i, label %cond_next811.i
-
-cond_next811.i: ; preds = %cond_true784.i
- %indvar.next1412.i = add i8 %indvar1411.i.reg2mem.0, 1 ; <i8> [#uses=2]
- %tmp781.i = icmp eq i8 %indvar.next1412.i, 3 ; <i1> [#uses=1]
- br i1 %tmp781.i, label %cond_next9079, label %cond_true784.i
-
-cond_next862.i: ; preds = %cond_next670.i
- ret i32 0
-
-cond_true1008.critedge.i: ; preds = %cond_next11.i.i
- ret i32 0
-
-cond_true1008.critedge1171.i: ; preds = %cond_next349.i
- ret i32 0
-
-cond_true1008.critedge1185.i: ; preds = %cond_next569.i
- ret i32 0
-
-cond_true1008.critedge1190.i: ; preds = %cond_true784.i
- %tmp621.i532.lcssa610 = phi i8* [ %tmp10.i.i527, %cond_true784.i ] ; <i8*> [#uses=0]
- ret i32 0
-
-bb9065: ; preds = %cond_next8154
- ret i32 0
-
-cond_next9079: ; preds = %cond_next811.i, %cond_false742.i
- ret i32 0
-}
diff --git a/llvm/test/Transforms/LoopUnroll/2011-08-08-PhiUpdate.ll b/llvm/test/Transforms/LoopUnroll/2011-08-08-PhiUpdate.ll
deleted file mode 100644
index a87b16a28b7..00000000000
--- a/llvm/test/Transforms/LoopUnroll/2011-08-08-PhiUpdate.ll
+++ /dev/null
@@ -1,103 +0,0 @@
-; RUN: opt < %s -loop-unroll -S -unroll-count=4 | FileCheck %s
-; Test phi update after partial unroll.
-
-declare i1 @check() nounwind
-
-; CHECK: @test
-; CHECK: if.else:
-; CHECK: if.then.loopexit
-; CHECK: %sub5.lcssa = phi i32 [ %sub{{.*}}, %if.else{{.*}} ], [ %sub{{.*}}, %if.else{{.*}} ], [ %sub{{.*}}, %if.else{{.*}} ], [ %sub{{.*}}, %if.else{{.*}} ]
-; CHECK: if.else.3
-define void @test1(i32 %i, i32 %j) nounwind uwtable ssp {
-entry:
- %cond1 = call zeroext i1 @check()
- br i1 %cond1, label %if.then, label %if.else.lr.ph
-
-if.else.lr.ph: ; preds = %entry
- br label %if.else
-
-if.else: ; preds = %if.else, %if.else.lr.ph
- %sub = phi i32 [ %i, %if.else.lr.ph ], [ %sub5, %if.else ]
- %sub5 = sub i32 %sub, %j
- %cond2 = call zeroext i1 @check()
- br i1 %cond2, label %if.then, label %if.else
-
-if.then: ; preds = %if.else, %entry
- %i.tr = phi i32 [ %i, %entry ], [ %sub5, %if.else ]
- ret void
-
-}
-
-; PR7318: assertion failure after doing a simple loop unroll
-;
-; CHECK-LABEL: @test2(
-; CHECK: bb1.bb2_crit_edge:
-; CHECK: %.lcssa = phi i32 [ %{{[2468]}}, %bb1{{.*}} ], [ %{{[2468]}}, %bb1{{.*}} ], [ %{{[2468]}}, %bb1{{.*}} ], [ %{{[2468]}}, %bb1{{.*}} ]
-; CHECK: bb1.3:
-define i32 @test2(i32* nocapture %p, i32 %n) nounwind readonly {
-entry:
- %0 = icmp sgt i32 %n, 0 ; <i1> [#uses=1]
- br i1 %0, label %bb.nph, label %bb2
-
-bb.nph: ; preds = %entry
- %tmp = zext i32 %n to i64 ; <i64> [#uses=1]
- br label %bb
-
-bb: ; preds = %bb.nph, %bb1
- %indvar = phi i64 [ 0, %bb.nph ], [ %indvar.next, %bb1 ] ; <i64> [#uses=2]
- %s.01 = phi i32 [ 0, %bb.nph ], [ %2, %bb1 ] ; <i32> [#uses=1]
- %scevgep = getelementptr i32, i32* %p, i64 %indvar ; <i32*> [#uses=1]
- %1 = load i32, i32* %scevgep, align 1 ; <i32> [#uses=1]
- %2 = add nsw i32 %1, %s.01 ; <i32> [#uses=2]
- br label %bb1
-
-bb1: ; preds = %bb
- %indvar.next = add i64 %indvar, 1 ; <i64> [#uses=2]
- %exitcond = icmp ne i64 %indvar.next, %tmp ; <i1> [#uses=1]
- br i1 %exitcond, label %bb, label %bb1.bb2_crit_edge
-
-bb1.bb2_crit_edge: ; preds = %bb1
- %.lcssa = phi i32 [ %2, %bb1 ] ; <i32> [#uses=1]
- br label %bb2
-
-bb2: ; preds = %bb1.bb2_crit_edge, %entry
- %s.0.lcssa = phi i32 [ %.lcssa, %bb1.bb2_crit_edge ], [ 0, %entry ] ; <i32> [#uses=1]
- ret i32 %s.0.lcssa
-}
-
-; Check phi update for loop with an early-exit.
-;
-; CHECK-LABEL: @test3(
-; CHECK: return.loopexit:
-; CHECK: %tmp7.i.lcssa = phi i32 [ %tmp7.i{{.*}}, %land.lhs.true{{.*}} ], [ %tmp7.i{{.*}}, %land.lhs.true{{.*}} ], [ %tmp7.i{{.*}}, %land.lhs.true{{.*}} ], [ %tmp7.i{{.*}}, %land.lhs.true{{.*}} ]
-; CHECK: exit.3:
-define i32 @test3() nounwind uwtable ssp align 2 {
-entry:
- %cond1 = call zeroext i1 @check()
- br i1 %cond1, label %return, label %if.end
-
-if.end: ; preds = %entry
- br label %do.body
-
-do.body: ; preds = %do.cond, %if.end
- %cond2 = call zeroext i1 @check()
- br i1 %cond2, label %exit, label %do.cond
-
-exit: ; preds = %do.body
- %tmp7.i = load i32, i32* undef, align 8
- br i1 undef, label %do.cond, label %land.lhs.true
-
-land.lhs.true: ; preds = %exit
- br i1 undef, label %return, label %do.cond
-
-do.cond: ; preds = %land.lhs.true, %exit, %do.body
- %cond3 = call zeroext i1 @check()
- br i1 %cond3, label %do.end, label %do.body
-
-do.end: ; preds = %do.cond
- br label %return
-
-return: ; preds = %do.end, %land.lhs.true, %entry
- %retval.0 = phi i32 [ 0, %do.end ], [ 0, %entry ], [ %tmp7.i, %land.lhs.true ]
- ret i32 %retval.0
-}
diff --git a/llvm/test/Transforms/LoopUnroll/2011-08-09-IVSimplify.ll b/llvm/test/Transforms/LoopUnroll/2011-08-09-IVSimplify.ll
deleted file mode 100644
index 0b484095650..00000000000
--- a/llvm/test/Transforms/LoopUnroll/2011-08-09-IVSimplify.ll
+++ /dev/null
@@ -1,41 +0,0 @@
-; RUN: opt -S < %s -loop-unroll -unroll-count=4 | FileCheck %s
-;
-; Test induction variable simplify after loop unrolling. It should
-; expose nice opportunities for GVN.
-;
-; CHECK-NOT: while.body also ensures that loop unrolling (with SCEV)
-; removes unrolled loop exits given that 128 is a multiple of 4.
-
-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"
-
-; PR10534: LoopUnroll not keeping canonical induction variable...
-; CHECK: while.body:
-; CHECK-NOT: while.body.1:
-; CHECK: %shr.1 = lshr i32 %bit_addr.addr.01, 5
-; CHECK: %arrayidx.1 = getelementptr inbounds i32, i32* %bitmap, i32 %shr.1
-; CHECK: %shr.2 = lshr i32 %bit_addr.addr.01, 5
-; CHECK: %arrayidx.2 = getelementptr inbounds i32, i32* %bitmap, i32 %shr.2
-; CHECK: %shr.3 = lshr i32 %bit_addr.addr.01, 5
-; CHECK: %arrayidx.3 = getelementptr inbounds i32, i32* %bitmap, i32 %shr.3
-define void @FlipBit(i32* nocapture %bitmap, i32 %bit_addr, i32 %nbits) nounwind {
-entry:
- br label %while.body
-
-while.body:
- %nbits.addr.02 = phi i32 [ 128, %entry ], [ %dec, %while.body ]
- %bit_addr.addr.01 = phi i32 [ 0, %entry ], [ %inc, %while.body ]
- %dec = add i32 %nbits.addr.02, -1
- %shr = lshr i32 %bit_addr.addr.01, 5
- %rem = and i32 %bit_addr.addr.01, 31
- %shl = shl i32 1, %rem
- %arrayidx = getelementptr inbounds i32, i32* %bitmap, i32 %shr
- %tmp6 = load i32, i32* %arrayidx, align 4
- %xor = xor i32 %tmp6, %shl
- store i32 %xor, i32* %arrayidx, align 4
- %inc = add i32 %bit_addr.addr.01, 1
- %tobool = icmp eq i32 %dec, 0
- br i1 %tobool, label %while.end, label %while.body
-
-while.end:
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/2011-08-09-PhiUpdate.ll b/llvm/test/Transforms/LoopUnroll/2011-08-09-PhiUpdate.ll
deleted file mode 100644
index 8344993a6fd..00000000000
--- a/llvm/test/Transforms/LoopUnroll/2011-08-09-PhiUpdate.ll
+++ /dev/null
@@ -1,62 +0,0 @@
-; RUN: opt -S < %s -instcombine -inline -jump-threading -loop-unroll -unroll-count=4 | FileCheck %s
-;
-; This is a test case that required a number of setup passes because
-; it depends on block order.
-
-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-macosx10.6.8"
-
-declare i1 @check() nounwind
-declare i32 @getval() nounwind
-
-; Check that the loop exit merges values from all the iterations. This
-; could be a tad fragile, but it's a good test.
-;
-; CHECK-LABEL: @foo(
-; CHECK: return:
-; CHECK: %retval.0 = phi i32 [ %tmp7.i, %land.lhs.true ], [ 0, %do.cond ], [ %tmp7.i.1, %land.lhs.true.1 ], [ 0, %do.cond.1 ], [ %tmp7.i.2, %land.lhs.true.2 ], [ 0, %do.cond.2 ], [ %tmp7.i.3, %land.lhs.true.3 ], [ 0, %do.cond.3 ]
-; CHECK-NOT: @bar(
-; CHECK: bar.exit.3
-define i32 @foo() uwtable ssp align 2 {
-entry:
- br i1 undef, label %return, label %if.end
-
-if.end: ; preds = %entry
- %call2 = call i32 @getval()
- br label %do.body
-
-do.body: ; preds = %do.cond, %if.end
- %call6 = call i32 @bar()
- %cmp = icmp ne i32 %call6, 0
- br i1 %cmp, label %land.lhs.true, label %do.cond
-
-land.lhs.true: ; preds = %do.body
- %call10 = call i32 @getval()
- %cmp11 = icmp eq i32 0, %call10
- br i1 %cmp11, label %return, label %do.cond
-
-do.cond: ; preds = %land.lhs.true, %do.body
- %cmp18 = icmp sle i32 0, %call2
- br i1 %cmp18, label %do.body, label %return
-
-return: ; preds = %do.cond, %land.lhs.true, %entry
- %retval.0 = phi i32 [ 0, %entry ], [ %call6, %land.lhs.true ], [ 0, %do.cond ]
- ret i32 %retval.0
-}
-
-define linkonce_odr i32 @bar() nounwind uwtable ssp align 2 {
-entry:
- br i1 undef, label %land.lhs.true, label %cond.end
-
-land.lhs.true: ; preds = %entry
- %cmp4 = call zeroext i1 @check()
- br i1 %cmp4, label %cond.true, label %cond.end
-
-cond.true: ; preds = %land.lhs.true
- %tmp7 = call i32 @getval()
- br label %cond.end
-
-cond.end: ; preds = %cond.true, %land.lhs.true, %entry
- %cond = phi i32 [ %tmp7, %cond.true ], [ 0, %land.lhs.true ], [ 0, %entry ]
- ret i32 %cond
-}
diff --git a/llvm/test/Transforms/LoopUnroll/2011-10-01-NoopTrunc.ll b/llvm/test/Transforms/LoopUnroll/2011-10-01-NoopTrunc.ll
deleted file mode 100644
index 5f9eec72ba5..00000000000
--- a/llvm/test/Transforms/LoopUnroll/2011-10-01-NoopTrunc.ll
+++ /dev/null
@@ -1,36 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-threshold=150 | FileCheck %s
-;
-; Verify that trunc i64 to i32 is considered free by loop unrolling
-; heuristics when i32 is a native type.
-; This should result in full unrolling this loop with size=7, TC=19.
-; If the trunc were not free we would have 8*19=152 > 150.
-
-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"
-
-; Check that for.body was unrolled 19 times.
-; CHECK-LABEL: @test(
-; CHECK: %0 = load
-; CHECK: %conv = sext i8 %0 to i32
-; CHECK: %add.1 = add nsw i32 %conv.1, %conv
-; CHECK: %add.18 = add nsw i32 %conv.18, %add.17
-; CHECK: ret i32 %add.18
-define i32 @test(i8* %arr) nounwind uwtable readnone {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %sum.02 = phi i32 [ 0, %entry ], [ %add, %for.body ]
- %arrayidx = getelementptr inbounds i8, i8* %arr, i64 %indvars.iv
- %0 = load i8, i8* %arrayidx, align 1
- %conv = sext i8 %0 to i32
- %add = add nsw i32 %conv, %sum.02
- %indvars.iv.next = add i64 %indvars.iv, 1
- %lftr.wideiv1 = trunc i64 %indvars.iv.next to i32
- %exitcond2 = icmp eq i32 %lftr.wideiv1, 19
- br i1 %exitcond2, label %for.end, label %for.body
-
-for.end: ; preds = %for.body
- %add.lcssa = phi i32 [ %add, %for.body ]
- ret i32 %add.lcssa
-}
diff --git a/llvm/test/Transforms/LoopUnroll/2012-04-09-unroll-indirectbr.ll b/llvm/test/Transforms/LoopUnroll/2012-04-09-unroll-indirectbr.ll
deleted file mode 100644
index 8946a23c200..00000000000
--- a/llvm/test/Transforms/LoopUnroll/2012-04-09-unroll-indirectbr.ll
+++ /dev/null
@@ -1,40 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -simplifycfg | FileCheck %s
-; PR12513: Loop unrolling breaks with indirect branches.
-; If loop unrolling attempts to transform this loop, it replaces the
-; indirectbr successors. SimplifyCFG then considers them to be unreachable.
-declare void @subtract() nounwind uwtable
-
-; CHECK-NOT: unreachable
-define i32 @main(i32 %argc, i8** nocapture %argv) nounwind uwtable {
-entry:
- %vals19 = alloca [5 x i32], align 16
- %x20 = alloca i32, align 4
- store i32 135, i32* %x20, align 4
- br label %for.body
-
-for.body: ; preds = ; %call2_termjoin, %call3_termjoin
- %indvars.iv = phi i64 [ 0, %entry ], [ %joinphi15.in.in, %call2_termjoin ]
- %a6 = call coldcc i8* @funca(i8* blockaddress(@main, %for.body_code), i8*
-blockaddress(@main, %for.body_codeprime)) nounwind
- indirectbr i8* %a6, [label %for.body_code, label %for.body_codeprime]
-
-for.body_code: ; preds = %for.body
- call void @subtract()
- br label %call2_termjoin
-
-call2_termjoin: ; preds = %for.body_codeprime, %for.body_code
- %joinphi15.in.in = add i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %joinphi15.in.in, 5
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %call2_termjoin
- ret i32 0
-
-for.body_codeprime: ; preds = %for.body
- call void @subtract_v2(i64 %indvars.iv)
- br label %call2_termjoin
-}
-
-declare coldcc i8* @funca(i8*, i8*) readonly
-
-declare void @subtract_v2(i64) nounwind uwtable
diff --git a/llvm/test/Transforms/LoopUnroll/AArch64/falkor-prefetch.ll b/llvm/test/Transforms/LoopUnroll/AArch64/falkor-prefetch.ll
deleted file mode 100644
index b2930dc5f89..00000000000
--- a/llvm/test/Transforms/LoopUnroll/AArch64/falkor-prefetch.ll
+++ /dev/null
@@ -1,169 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -mtriple aarch64 -mcpu=falkor | FileCheck %s
-; RUN: opt < %s -S -loop-unroll -mtriple aarch64 -mcpu=falkor -enable-falkor-hwpf-unroll-fix=0 | FileCheck %s --check-prefix=NOHWPF
-
-; Check that loop unroller doesn't exhaust HW prefetcher resources.
-
-; Partial unroll 2 times for this loop on falkor instead of 4.
-; NOHWPF-LABEL: @unroll1(
-; NOHWPF-LABEL: loop:
-; NOHWPF-NEXT: phi
-; NOHWPF-NEXT: getelementptr
-; NOHWPF-NEXT: load
-; NOHWPF-NEXT: getelementptr
-; NOHWPF-NEXT: load
-; NOHWPF-NEXT: add
-; NOHWPF-NEXT: getelementptr
-; NOHWPF-NEXT: load
-; NOHWPF-NEXT: getelementptr
-; NOHWPF-NEXT: load
-; NOHWPF-NEXT: add
-; NOHWPF-NEXT: getelementptr
-; NOHWPF-NEXT: load
-; NOHWPF-NEXT: getelementptr
-; NOHWPF-NEXT: load
-; NOHWPF-NEXT: add
-; NOHWPF-NEXT: getelementptr
-; NOHWPF-NEXT: load
-; NOHWPF-NEXT: getelementptr
-; NOHWPF-NEXT: load
-; NOHWPF-NEXT: add
-; NOHWPF-NEXT: icmp
-; NOHWPF-NEXT: br
-; NOHWPF-NEXT-LABEL: exit:
-;
-; CHECK-LABEL: @unroll1(
-; CHECK-LABEL: loop:
-; CHECK-NEXT: phi
-; CHECK-NEXT: getelementptr
-; CHECK-NEXT: load
-; CHECK-NEXT: getelementptr
-; CHECK-NEXT: load
-; CHECK-NEXT: add
-; CHECK-NEXT: getelementptr
-; CHECK-NEXT: load
-; CHECK-NEXT: getelementptr
-; CHECK-NEXT: load
-; CHECK-NEXT: add
-; CHECK-NEXT: icmp
-; CHECK-NEXT: br
-; CHECK-NEXT-LABEL: exit:
-define void @unroll1(i32* %p, i32* %p2) {
-entry:
- br label %loop
-
-loop:
- %iv = phi i32 [ 0, %entry ], [ %inc, %loop ]
-
- %gep = getelementptr inbounds i32, i32* %p, i32 %iv
- %load = load volatile i32, i32* %gep
-
- %gep2 = getelementptr inbounds i32, i32* %p2, i32 %iv
- %load2 = load volatile i32, i32* %gep2
-
- %inc = add i32 %iv, 1
- %exitcnd = icmp uge i32 %inc, 1024
- br i1 %exitcnd, label %exit, label %loop
-
-exit:
- ret void
-}
-
-; Partial unroll 4 times for this loop on falkor instead of 8.
-; NOHWPF-LABEL: @unroll2(
-; NOHWPF-LABEL: loop2:
-; NOHWPF-NEXT: phi
-; NOHWPF-NEXT: phi
-; NOHWPF-NEXT: getelementptr
-; NOHWPF-NEXT: load
-; NOHWPF-NEXT: add
-; NOHWPF-NEXT: add
-; NOHWPF-NEXT: getelementptr
-; NOHWPF-NEXT: load
-; NOHWPF-NEXT: add
-; NOHWPF-NEXT: add
-; NOHWPF-NEXT: getelementptr
-; NOHWPF-NEXT: load
-; NOHWPF-NEXT: add
-; NOHWPF-NEXT: add
-; NOHWPF-NEXT: getelementptr
-; NOHWPF-NEXT: load
-; NOHWPF-NEXT: add
-; NOHWPF-NEXT: add
-; NOHWPF-NEXT: getelementptr
-; NOHWPF-NEXT: load
-; NOHWPF-NEXT: add
-; NOHWPF-NEXT: add
-; NOHWPF-NEXT: getelementptr
-; NOHWPF-NEXT: load
-; NOHWPF-NEXT: add
-; NOHWPF-NEXT: add
-; NOHWPF-NEXT: getelementptr
-; NOHWPF-NEXT: load
-; NOHWPF-NEXT: add
-; NOHWPF-NEXT: add
-; NOHWPF-NEXT: getelementptr
-; NOHWPF-NEXT: load
-; NOHWPF-NEXT: add
-; NOHWPF-NEXT: add
-; NOHWPF-NEXT: icmp
-; NOHWPF-NEXT: br
-; NOHWPF-NEXT-LABEL: exit2:
-;
-; CHECK-LABEL: @unroll2(
-; CHECK-LABEL: loop2:
-; CHECK-NEXT: phi
-; CHECK-NEXT: phi
-; CHECK-NEXT: getelementptr
-; CHECK-NEXT: load
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: getelementptr
-; CHECK-NEXT: load
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: getelementptr
-; CHECK-NEXT: load
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: getelementptr
-; CHECK-NEXT: load
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: icmp
-; CHECK-NEXT: br
-; CHECK-NEXT-LABEL: exit2:
-
-define void @unroll2(i32* %p) {
-entry:
- br label %loop1
-
-loop1:
- %iv1 = phi i32 [ 0, %entry ], [ %inc1, %loop1.latch ]
- %outer.sum = phi i32 [ 0, %entry ], [ %sum, %loop1.latch ]
- br label %loop2.header
-
-loop2.header:
- br label %loop2
-
-loop2:
- %iv2 = phi i32 [ 0, %loop2.header ], [ %inc2, %loop2 ]
- %sum = phi i32 [ %outer.sum, %loop2.header ], [ %sum.inc, %loop2 ]
- %gep = getelementptr inbounds i32, i32* %p, i32 %iv2
- %load = load i32, i32* %gep
- %sum.inc = add i32 %sum, %load
- %inc2 = add i32 %iv2, 1
- %exitcnd2 = icmp uge i32 %inc2, 1024
- br i1 %exitcnd2, label %exit2, label %loop2
-
-exit2:
- br label %loop1.latch
-
-loop1.latch:
- %inc1 = add i32 %iv1, 1
- %exitcnd1 = icmp uge i32 %inc1, 1024
- br i1 %exitcnd2, label %exit, label %loop1
-
-exit:
- ret void
-}
-
diff --git a/llvm/test/Transforms/LoopUnroll/AArch64/full-unroll-trip-count-upper-bound.ll b/llvm/test/Transforms/LoopUnroll/AArch64/full-unroll-trip-count-upper-bound.ll
deleted file mode 100644
index 5c70a2668db..00000000000
--- a/llvm/test/Transforms/LoopUnroll/AArch64/full-unroll-trip-count-upper-bound.ll
+++ /dev/null
@@ -1,43 +0,0 @@
-; RUN: opt -loop-unroll -S -mtriple aarch64 -mcpu=cortex-a57 %s | FileCheck %s -check-prefix=UNROLL
-; RUN: opt -loop-unroll -unroll-max-upperbound=0 -S -mtriple aarch64 -mcpu=cortex-a57 %s | FileCheck %s -check-prefix=NOUNROLL
-
-; This IR comes from this C code:
-;
-; for (int i = 0; i < 4; i++) {
-; if (src[i] == 1) {
-; *dst = i;
-; break;
-; }
-; }
-;
-; This test is meant to check that this loop is unrolled into four iterations.
-
-; UNROLL-LABEL: @test
-; UNROLL: load i32, i32*
-; UNROLL: load i32, i32*
-; UNROLL: load i32, i32*
-; UNROLL: load i32, i32*
-; UNROLL-NOT: load i32, i32*
-; NOUNROLL-LABEL: @test
-; NOUNROLL: load i32, i32*
-; NOUNROLL-NOT: load i32, i32*
-
-define void @test(i32* %dst, i32* %src) {
-entry:
- br label %for.body
-
-for.body: ; preds = %entry, %for.body
- %i = phi i32 [ 0, %entry ], [ %inc, %for.body ]
- %0 = sext i32 %i to i64
- %1 = getelementptr inbounds i32, i32* %src, i64 %0
- %2 = load i32, i32* %1
- %inc = add nsw i32 %i, 1
- %cmp1 = icmp slt i32 %inc, 4
- %cmp3 = icmp eq i32 %2, 1
- %or.cond = and i1 %cmp3, %cmp1
- br i1 %or.cond, label %for.body, label %exit
-
-exit: ; preds = %for.body
- store i32 %i, i32* %dst
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/AArch64/lit.local.cfg b/llvm/test/Transforms/LoopUnroll/AArch64/lit.local.cfg
deleted file mode 100644
index cec29af5bbe..00000000000
--- a/llvm/test/Transforms/LoopUnroll/AArch64/lit.local.cfg
+++ /dev/null
@@ -1,3 +0,0 @@
-if not 'AArch64' in config.root.targets:
- config.unsupported = True
-
diff --git a/llvm/test/Transforms/LoopUnroll/AArch64/partial.ll b/llvm/test/Transforms/LoopUnroll/AArch64/partial.ll
deleted file mode 100644
index 8a1ea80c9d5..00000000000
--- a/llvm/test/Transforms/LoopUnroll/AArch64/partial.ll
+++ /dev/null
@@ -1,76 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -mtriple aarch64 -mcpu=cortex-a57 | FileCheck %s
-
-; Partial unroll 8 times for this loop.
-define void @unroll1() nounwind {
-entry:
- br label %loop
-
-loop:
- %iv = phi i32 [ 0, %entry ], [ %inc, %loop ]
- %inc = add i32 %iv, 1
- %exitcnd = icmp uge i32 %inc, 1024
- br i1 %exitcnd, label %exit, label %loop
-
-exit:
- ret void
-}
-
-; CHECK: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: icmp
-
-; Partial unroll 16 times for this loop.
-define void @unroll2() nounwind {
-entry:
- br label %loop1
-
-loop1:
- %iv1 = phi i32 [ 0, %entry ], [ %inc1, %loop1.latch ]
- br label %loop2.header
-
-loop2.header:
- br label %loop2
-
-loop2:
- %iv2 = phi i32 [ 0, %loop2.header ], [ %inc2, %loop2 ]
- %inc2 = add i32 %iv2, 1
- %exitcnd2 = icmp uge i32 %inc2, 1024
- br i1 %exitcnd2, label %exit2, label %loop2
-
-exit2:
- br label %loop1.latch
-
-loop1.latch:
- %inc1 = add i32 %iv1, 1
- %exitcnd1 = icmp uge i32 %inc1, 1024
- br i1 %exitcnd2, label %exit, label %loop1
-
-exit:
- ret void
-}
-
-
-
-; CHECK: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: icmp
diff --git a/llvm/test/Transforms/LoopUnroll/AArch64/runtime-loop.ll b/llvm/test/Transforms/LoopUnroll/AArch64/runtime-loop.ll
deleted file mode 100644
index b800b4ac545..00000000000
--- a/llvm/test/Transforms/LoopUnroll/AArch64/runtime-loop.ll
+++ /dev/null
@@ -1,39 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -mtriple aarch64 -mcpu=cortex-a57 -unroll-runtime-epilog=true | FileCheck %s -check-prefix=EPILOG
-; RUN: opt < %s -S -loop-unroll -mtriple aarch64 -mcpu=cortex-a57 -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG
-
-; Tests for unrolling loops with run-time trip counts
-
-; EPILOG: %xtraiter = and i32 %n
-; EPILOG: for.body:
-; EPILOG: %lcmp.mod = icmp ne i32 %xtraiter, 0
-; EPILOG: br i1 %lcmp.mod, label %for.body.epil.preheader, label %for.end.loopexit
-; EPILOG: for.body.epil:
-
-; PROLOG: %xtraiter = and i32 %n
-; PROLOG: %lcmp.mod = icmp ne i32 %xtraiter, 0
-; PROLOG: br i1 %lcmp.mod, label %for.body.prol.preheader, label %for.body.prol.loopexit
-; PROLOG: for.body.prol:
-; PROLOG: for.body:
-
-define i32 @test(i32* nocapture %a, i32 %n) nounwind uwtable readonly {
-entry:
- %cmp1 = icmp eq i32 %n, 0
- br i1 %cmp1, label %for.end, label %for.body
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
- %sum.02 = phi i32 [ %add, %for.body ], [ 0, %entry ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %add = add nsw i32 %0, %sum.02
- %indvars.iv.next = add i64 %indvars.iv, 1
- %lftr.wideiv = trunc i64 %indvars.iv.next to i32
- %exitcond = icmp eq i32 %lftr.wideiv, %n
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %for.body, %entry
- %sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
- ret i32 %sum.0.lcssa
-}
-
-
diff --git a/llvm/test/Transforms/LoopUnroll/AMDGPU/lit.local.cfg b/llvm/test/Transforms/LoopUnroll/AMDGPU/lit.local.cfg
deleted file mode 100644
index 6baccf05fff..00000000000
--- a/llvm/test/Transforms/LoopUnroll/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/LoopUnroll/AMDGPU/unroll-barrier.ll b/llvm/test/Transforms/LoopUnroll/AMDGPU/unroll-barrier.ll
deleted file mode 100644
index ca8cc32469d..00000000000
--- a/llvm/test/Transforms/LoopUnroll/AMDGPU/unroll-barrier.ll
+++ /dev/null
@@ -1,33 +0,0 @@
-; RUN: opt -mtriple=amdgcn-unknown-amdhsa -mcpu=hawaii -loop-unroll -S < %s | FileCheck %s
-
-; CHECK-LABEL: @test_unroll_convergent_barrier(
-; CHECK: call void @llvm.amdgcn.s.barrier()
-; CHECK: call void @llvm.amdgcn.s.barrier()
-; CHECK: call void @llvm.amdgcn.s.barrier()
-; CHECK: call void @llvm.amdgcn.s.barrier()
-; CHECK-NOT: br
-define amdgpu_kernel void @test_unroll_convergent_barrier(i32 addrspace(1)* noalias nocapture %out, i32 addrspace(1)* noalias nocapture %in) #0 {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i32 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
- %sum.02 = phi i32 [ %add, %for.body ], [ 0, %entry ]
- %arrayidx.in = getelementptr inbounds i32, i32 addrspace(1)* %in, i32 %indvars.iv
- %arrayidx.out = getelementptr inbounds i32, i32 addrspace(1)* %out, i32 %indvars.iv
- %load = load i32, i32 addrspace(1)* %arrayidx.in
- call void @llvm.amdgcn.s.barrier() #1
- %add = add i32 %load, %sum.02
- store i32 %add, i32 addrspace(1)* %arrayidx.out
- %indvars.iv.next = add i32 %indvars.iv, 1
- %exitcond = icmp eq i32 %indvars.iv.next, 4
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %for.body, %entry
- ret void
-}
-
-declare void @llvm.amdgcn.s.barrier() #1
-
-attributes #0 = { nounwind }
-attributes #1 = { nounwind convergent }
diff --git a/llvm/test/Transforms/LoopUnroll/AMDGPU/unroll-cost-call.ll b/llvm/test/Transforms/LoopUnroll/AMDGPU/unroll-cost-call.ll
deleted file mode 100644
index 9ca109c4f74..00000000000
--- a/llvm/test/Transforms/LoopUnroll/AMDGPU/unroll-cost-call.ll
+++ /dev/null
@@ -1,77 +0,0 @@
-; RUN: opt -S -mtriple=amdgcn-unknown-amdhsa -mcpu=hawaii -loop-unroll -unroll-threshold=100 -unroll-peel-count=0 -unroll-allow-partial=false -unroll-max-iteration-count-to-analyze=16 < %s | FileCheck %s
-
-; CHECK-LABEL: @test_intrinsic_call_cost(
-; CHECK-NOT: br i1
-define amdgpu_kernel void @test_intrinsic_call_cost(float addrspace(1)* noalias nocapture %out, float addrspace(1)* noalias nocapture %in) #0 {
-entry:
- br label %for.body
-
-for.body:
- %indvars.iv = phi i32 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
- %sum.02 = phi float [ %fmul, %for.body ], [ 0.0, %entry ]
- %arrayidx.in = getelementptr inbounds float, float addrspace(1)* %in, i32 %indvars.iv
- %arrayidx.out = getelementptr inbounds float, float addrspace(1)* %out, i32 %indvars.iv
- %load = load float, float addrspace(1)* %arrayidx.in
- %call = call float @llvm.minnum.f32(float %load, float 1.0);
- %fmul = fmul float %call, %sum.02
- store float %fmul, float addrspace(1)* %arrayidx.out
- %indvars.iv.next = add i32 %indvars.iv, 1
- %exitcond = icmp eq i32 %indvars.iv.next, 16
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end:
- ret void
-}
-
-; CHECK-LABEL: @test_func_call_cost(
-; CHECK: br i1 %exitcond
-define amdgpu_kernel void @test_func_call_cost(float addrspace(1)* noalias nocapture %out, float addrspace(1)* noalias nocapture %in) #0 {
-entry:
- br label %for.body
-
-for.body:
- %indvars.iv = phi i32 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
- %sum.02 = phi float [ %fmul, %for.body ], [ 0.0, %entry ]
- %arrayidx.in = getelementptr inbounds float, float addrspace(1)* %in, i32 %indvars.iv
- %arrayidx.out = getelementptr inbounds float, float addrspace(1)* %out, i32 %indvars.iv
- %load = load float, float addrspace(1)* %arrayidx.in
- %fptr = load float(float, float)*, float(float, float )* addrspace(4)* null
- %call = tail call float %fptr(float %load, float 1.0)
- %fmul = fmul float %call, %sum.02
- store float %fmul, float addrspace(1)* %arrayidx.out
- %indvars.iv.next = add i32 %indvars.iv, 1
- %exitcond = icmp eq i32 %indvars.iv.next, 16
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end:
- ret void
-}
-
-; CHECK-LABEL: @test_indirect_call_cost(
-; CHECK: br i1 %exitcond
-define amdgpu_kernel void @test_indirect_call_cost(float addrspace(1)* noalias nocapture %out, float addrspace(1)* noalias nocapture %in) #0 {
-entry:
- br label %for.body
-
-for.body:
- %indvars.iv = phi i32 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
- %sum.02 = phi float [ %fmul, %for.body ], [ 0.0, %entry ]
- %arrayidx.in = getelementptr inbounds float, float addrspace(1)* %in, i32 %indvars.iv
- %arrayidx.out = getelementptr inbounds float, float addrspace(1)* %out, i32 %indvars.iv
- %load = load float, float addrspace(1)* %arrayidx.in
- %min = call float @func(float %load, float 1.0);
- %fmul = fmul float %min, %sum.02
- store float %fmul, float addrspace(1)* %arrayidx.out
- %indvars.iv.next = add i32 %indvars.iv, 1
- %exitcond = icmp eq i32 %indvars.iv.next, 16
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end:
- ret void
-}
-
-declare float @llvm.minnum.f32(float, float) #1
-declare float @func(float, float) #1
-
-attributes #0 = { nounwind }
-attributes #1 = { nounwind readnone speculatable }
diff --git a/llvm/test/Transforms/LoopUnroll/AMDGPU/unroll-for-private.ll b/llvm/test/Transforms/LoopUnroll/AMDGPU/unroll-for-private.ll
deleted file mode 100644
index e2606bb69cf..00000000000
--- a/llvm/test/Transforms/LoopUnroll/AMDGPU/unroll-for-private.ll
+++ /dev/null
@@ -1,154 +0,0 @@
-; RUN: opt -data-layout=A5 -mtriple=amdgcn-unknown-amdhsa -loop-unroll -S -amdgpu-unroll-threshold-private=20000 %s | FileCheck %s
-
-; Check that we full unroll loop to be able to eliminate alloca
-; CHECK-LABEL: @non_invariant_ind
-; CHECK: for.body:
-; CHECK-NOT: br
-; CHECK: store i32 %tmp15, i32 addrspace(1)* %arrayidx7, align 4
-; CHECK: ret void
-
-define amdgpu_kernel void @non_invariant_ind(i32 addrspace(1)* nocapture %a, i32 %x) {
-entry:
- %arr = alloca [64 x i32], align 4, addrspace(5)
- %tmp1 = tail call i32 @llvm.amdgcn.workitem.id.x() #1
- br label %for.body
-
-for.cond.cleanup: ; preds = %for.body
- %arrayidx5 = getelementptr inbounds [64 x i32], [64 x i32] addrspace(5)* %arr, i32 0, i32 %x
- %tmp15 = load i32, i32 addrspace(5)* %arrayidx5, align 4
- %arrayidx7 = getelementptr inbounds i32, i32 addrspace(1)* %a, i32 %tmp1
- store i32 %tmp15, i32 addrspace(1)* %arrayidx7, align 4
- ret void
-
-for.body: ; preds = %for.body, %entry
- %i.015 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
- %idxprom = sext i32 %i.015 to i64
- %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %a, i64 %idxprom
- %tmp16 = load i32, i32 addrspace(1)* %arrayidx, align 4
- %add = add nsw i32 %i.015, %tmp1
- %rem = srem i32 %add, 64
- %arrayidx3 = getelementptr inbounds [64 x i32], [64 x i32] addrspace(5)* %arr, i32 0, i32 %rem
- store i32 %tmp16, i32 addrspace(5)* %arrayidx3, align 4
- %inc = add nuw nsw i32 %i.015, 1
- %exitcond = icmp eq i32 %inc, 100
- br i1 %exitcond, label %for.cond.cleanup, label %for.body
-}
-
-; Check that we unroll inner loop but not outer
-; CHECK-LABEL: @invariant_ind
-; CHECK: %[[exitcond:[^ ]+]] = icmp eq i32 %{{.*}}, 32
-; CHECK: br i1 %[[exitcond]]
-; CHECK-NOT: icmp eq i32 %{{.*}}, 100
-
-define amdgpu_kernel void @invariant_ind(i32 addrspace(1)* nocapture %a, i32 %x) {
-entry:
- %arr = alloca [64 x i32], align 4, addrspace(5)
- %tmp1 = tail call i32 @llvm.amdgcn.workitem.id.x() #1
- br label %for.cond2.preheader
-
-for.cond2.preheader: ; preds = %for.cond.cleanup5, %entry
- %i.026 = phi i32 [ 0, %entry ], [ %inc10, %for.cond.cleanup5 ]
- %idxprom = sext i32 %i.026 to i64
- %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %a, i64 %idxprom
- %tmp15 = load i32, i32 addrspace(1)* %arrayidx, align 4
- br label %for.body6
-
-for.cond.cleanup: ; preds = %for.cond.cleanup5
- %arrayidx13 = getelementptr inbounds [64 x i32], [64 x i32] addrspace(5)* %arr, i32 0, i32 %x
- %tmp16 = load i32, i32 addrspace(5)* %arrayidx13, align 4
- %arrayidx15 = getelementptr inbounds i32, i32 addrspace(1)* %a, i32 %tmp1
- store i32 %tmp16, i32 addrspace(1)* %arrayidx15, align 4
- ret void
-
-for.cond.cleanup5: ; preds = %for.body6
- %inc10 = add nuw nsw i32 %i.026, 1
- %exitcond27 = icmp eq i32 %inc10, 32
- br i1 %exitcond27, label %for.cond.cleanup, label %for.cond2.preheader
-
-for.body6: ; preds = %for.body6, %for.cond2.preheader
- %j.025 = phi i32 [ 0, %for.cond2.preheader ], [ %inc, %for.body6 ]
- %add = add nsw i32 %j.025, %tmp1
- %rem = srem i32 %add, 64
- %arrayidx8 = getelementptr inbounds [64 x i32], [64 x i32] addrspace(5)* %arr, i32 0, i32 %rem
- store i32 %tmp15, i32 addrspace(5)* %arrayidx8, align 4
- %inc = add nuw nsw i32 %j.025, 1
- %exitcond = icmp eq i32 %inc, 100
- br i1 %exitcond, label %for.cond.cleanup5, label %for.body6
-}
-
-; Check we do not enforce unroll if alloca is too big
-; CHECK-LABEL: @too_big
-; CHECK: for.body:
-; CHECK: icmp eq i32 %{{.*}}, 100
-; CHECK: br
-
-define amdgpu_kernel void @too_big(i32 addrspace(1)* nocapture %a, i32 %x) {
-entry:
- %arr = alloca [256 x i32], align 4, addrspace(5)
- %tmp1 = tail call i32 @llvm.amdgcn.workitem.id.x() #1
- br label %for.body
-
-for.cond.cleanup: ; preds = %for.body
- %arrayidx5 = getelementptr inbounds [256 x i32], [256 x i32] addrspace(5)* %arr, i32 0, i32 %x
- %tmp15 = load i32, i32 addrspace(5)* %arrayidx5, align 4
- %arrayidx7 = getelementptr inbounds i32, i32 addrspace(1)* %a, i32 %tmp1
- store i32 %tmp15, i32 addrspace(1)* %arrayidx7, align 4
- ret void
-
-for.body: ; preds = %for.body, %entry
- %i.015 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
- %idxprom = sext i32 %i.015 to i64
- %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %a, i64 %idxprom
- %tmp16 = load i32, i32 addrspace(1)* %arrayidx, align 4
- %add = add nsw i32 %i.015, %tmp1
- %rem = srem i32 %add, 64
- %arrayidx3 = getelementptr inbounds [256 x i32], [256 x i32] addrspace(5)* %arr, i32 0, i32 %rem
- store i32 %tmp16, i32 addrspace(5)* %arrayidx3, align 4
- %inc = add nuw nsw i32 %i.015, 1
- %exitcond = icmp eq i32 %inc, 100
- br i1 %exitcond, label %for.cond.cleanup, label %for.body
-}
-
-; Check we do not enforce unroll if alloca is dynamic
-; CHECK-LABEL: @dynamic_size_alloca(
-; CHECK: alloca i32, i32 %n
-; CHECK: for.body:
-; CHECK: icmp eq i32 %{{.*}}, 100
-; CHECK: br
-
-define amdgpu_kernel void @dynamic_size_alloca(i32 addrspace(1)* nocapture %a, i32 %n, i32 %x) {
-entry:
- %arr = alloca i32, i32 %n, align 4, addrspace(5)
- %tmp1 = tail call i32 @llvm.amdgcn.workitem.id.x() #1
- br label %for.body
-
-for.cond.cleanup: ; preds = %for.body
- %arrayidx5 = getelementptr inbounds i32, i32 addrspace(5)* %arr, i32 %x
- %tmp15 = load i32, i32 addrspace(5)* %arrayidx5, align 4
- %arrayidx7 = getelementptr inbounds i32, i32 addrspace(1)* %a, i32 %tmp1
- store i32 %tmp15, i32 addrspace(1)* %arrayidx7, align 4
- ret void
-
-for.body: ; preds = %for.body, %entry
- %i.015 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
- %idxprom = sext i32 %i.015 to i64
- %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %a, i64 %idxprom
- %tmp16 = load i32, i32 addrspace(1)* %arrayidx, align 4
- %add = add nsw i32 %i.015, %tmp1
- %rem = srem i32 %add, 64
- %arrayidx3 = getelementptr inbounds i32, i32 addrspace(5)* %arr, i32 %rem
- store i32 %tmp16, i32 addrspace(5)* %arrayidx3, align 4
- %inc = add nuw nsw i32 %i.015, 1
- %exitcond = icmp eq i32 %inc, 100
- br i1 %exitcond, label %for.cond.cleanup, label %for.body
-}
-
-declare i8 addrspace(4)* @llvm.amdgcn.dispatch.ptr() #1
-
-declare i32 @llvm.amdgcn.workitem.id.x() #1
-
-declare i32 @llvm.amdgcn.workgroup.id.x() #1
-
-declare i8 addrspace(4)* @llvm.amdgcn.implicitarg.ptr() #1
-
-attributes #1 = { nounwind readnone }
diff --git a/llvm/test/Transforms/LoopUnroll/ARM/lit.local.cfg b/llvm/test/Transforms/LoopUnroll/ARM/lit.local.cfg
deleted file mode 100644
index 98c6700c209..00000000000
--- a/llvm/test/Transforms/LoopUnroll/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/LoopUnroll/ARM/loop-unrolling.ll b/llvm/test/Transforms/LoopUnroll/ARM/loop-unrolling.ll
deleted file mode 100644
index bb5277bedc0..00000000000
--- a/llvm/test/Transforms/LoopUnroll/ARM/loop-unrolling.ll
+++ /dev/null
@@ -1,247 +0,0 @@
-; RUN: opt -mtriple=armv7 -mcpu=cortex-a57 -loop-unroll -S %s -o - | FileCheck %s --check-prefix=CHECK-UNROLL-A
-; RUN: opt -mtriple=thumbv7 -mcpu=cortex-a57 -loop-unroll -S %s -o - | FileCheck %s --check-prefix=CHECK-UNROLL-A
-; RUN: opt -mtriple=thumbv7 -mcpu=cortex-a72 -loop-unroll -S %s -o - | FileCheck %s --check-prefix=CHECK-UNROLL-A
-; RUN: opt -mtriple=thumbv8m -mcpu=cortex-m23 -loop-unroll -S %s -o - | FileCheck %s --check-prefix=CHECK-UNROLL-T1
-; RUN: opt -mtriple=thumbv8m.main -mcpu=cortex-m33 -loop-unroll -S %s -o - | FileCheck %s --check-prefix=CHECK-UNROLL-T2
-; RUN: opt -mtriple=thumbv7em -mcpu=cortex-m7 -loop-unroll -S %s -o - | FileCheck %s --check-prefix=CHECK-UNROLL-T2
-
-; CHECK-LABEL: partial
-define arm_aapcs_vfpcc void @partial(i32* nocapture %C, i32* nocapture readonly %A, i32* nocapture readonly %B) local_unnamed_addr #0 {
-entry:
- br label %for.body
-
-; CHECK-LABEL: for.body
-for.body:
-
-; CHECK-UNROLL-A: [[IV0:%[a-z.0-9]+]] = phi i32 [ 0, %entry ], [ [[IV2:%[a-z.0-9]+]], %for.body ]
-; CHECK-UNROLL-A: [[IV1:%[a-z.0-9]+]] = add nuw nsw i32 [[IV0]], 1
-; CHECK-UNROLL-A: [[IV2]] = add nuw nsw i32 [[IV1]], 1
-; CHECK-UNROLL-A: [[CMP:%[a-z.0-9]+]] = icmp eq i32 [[IV2]], 1024
-; CHECK-UNROLL-A: br i1 [[CMP]], label [[END:%[a-z.]+]], label %for.body
-
-; CHECK-UNROLL-T1: [[IV0:%[a-z.0-9]+]] = phi i32 [ 0, %entry ], [ [[IV1:%[a-z.0-9]+]], %for.body ]
-; CHECK-UNROLL-T1: [[IV1]] = add nuw nsw i32 [[IV0]], 1
-; CHECK-UNROLL-T1: [[CMP:%[a-z.0-9]+]] = icmp eq i32 [[IV1]], 1024
-; CHECK-UNROLL-T1: br i1 [[CMP]], label [[END:%[a-z.]+]], label %for.body
-
-; CHECK-UNROLL-T2: [[IV0:%[a-z.0-9]+]] = phi i32 [ 0, %entry ], [ [[IV16:%[a-z.0-9]+]], %for.body ]
-; CHECK-UNROLL-T2: [[IV1:%[a-z.0-9]+]] = add nuw nsw i32 [[IV0]], 1
-; CHECK-UNROLL-T2: [[IV2:%[a-z.0-9]+]] = add nuw nsw i32 [[IV1]], 1
-; CHECK-UNROLL-T2: [[IV3:%[a-z.0-9]+]] = add nuw nsw i32 [[IV2]], 1
-; CHECK-UNROLL-T2: [[IV4:%[a-z.0-9]+]] = add nuw nsw i32 [[IV3]], 1
-; CHECK-UNROLL-T2: [[IV5:%[a-z.0-9]+]] = add nuw nsw i32 [[IV4]], 1
-; CHECK-UNROLL-T2: [[IV6:%[a-z.0-9]+]] = add nuw nsw i32 [[IV5]], 1
-; CHECK-UNROLL-T2: [[IV7:%[a-z.0-9]+]] = add nuw nsw i32 [[IV6]], 1
-; CHECK-UNROLL-T2: [[IV8:%[a-z.0-9]+]] = add nuw nsw i32 [[IV7]], 1
-; CHECK-UNROLL-T2: [[IV9:%[a-z.0-9]+]] = add nuw nsw i32 [[IV8]], 1
-; CHECK-UNROLL-T2: [[IV10:%[a-z.0-9]+]] = add nuw nsw i32 [[IV9]], 1
-; CHECK-UNROLL-T2: [[IV11:%[a-z.0-9]+]] = add nuw nsw i32 [[IV10]], 1
-; CHECK-UNROLL-T2: [[IV12:%[a-z.0-9]+]] = add nuw nsw i32 [[IV11]], 1
-; CHECK-UNROLL-T2: [[IV13:%[a-z.0-9]+]] = add nuw nsw i32 [[IV12]], 1
-; CHECK-UNROLL-T2: [[IV14:%[a-z.0-9]+]] = add nuw nsw i32 [[IV13]], 1
-; CHECK-UNROLL-T2: [[IV15:%[a-z.0-9]+]] = add nuw nsw i32 [[IV14]], 1
-; CHECK-UNROLL-T2: [[IV16]] = add nuw nsw i32 [[IV15]], 1
-; CHECK-UNROLL-T2: [[CMP:%[a-z.0-9]+]] = icmp eq i32 [[IV16]], 1024
-; CHECK-UNROLL-T2: br i1 [[CMP]], label [[END:%[a-z.]+]], label %for.body
-
- %i.08 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %A, i32 %i.08
- %0 = load i32, i32* %arrayidx, align 4
- %arrayidx1 = getelementptr inbounds i32, i32* %B, i32 %i.08
- %1 = load i32, i32* %arrayidx1, align 4
- %mul = mul nsw i32 %1, %0
- %arrayidx2 = getelementptr inbounds i32, i32* %C, i32 %i.08
- store i32 %mul, i32* %arrayidx2, align 4
- %inc = add nuw nsw i32 %i.08, 1
- %exitcond = icmp eq i32 %inc, 1024
- br i1 %exitcond, label %for.cond.cleanup, label %for.body
-
-for.cond.cleanup:
- ret void
-}
-
-; CHECK-LABEL: runtime
-define arm_aapcs_vfpcc void @runtime(i32* nocapture %C, i32* nocapture readonly %A, i32* nocapture readonly %B, i32 %N) local_unnamed_addr #0 {
-entry:
- %cmp8 = icmp eq i32 %N, 0
- br i1 %cmp8, label %for.cond.cleanup, label %for.body
-
-; CHECK-LABEL: for.body
-for.body:
-; CHECK-UNROLL-A: [[IV0:%[a-z.0-9]+]] = phi i32 [ 0, [[PRE:%[a-z.0-9]+]] ], [ [[IV2:%[a-z.0-9]+]], %for.body ]
-; CHECK-UNROLL-A: [[IV1:%[a-z.0-9]+]] = add nuw nsw i32 [[IV0]], 1
-; CHECK-UNROLL-A: [[IV2]] = add nuw i32 [[IV1]], 1
-; CHECK-UNROLL-A: br
-
-; CHECK-UNROLL-T1: %i.09 = phi i32 [ %inc, %for.body ], [ 0
-; CHECK-UNROLL-T1: %inc = add nuw i32 %i.09, 1
-; CHECK-UNROLL-T1: %exitcond = icmp eq i32 %inc, %N
-; CHECK-UNROLL-T1: br
-
-; CHECK-UNROLL-T2: [[IV0:%[a-z.0-9]+]] = phi i32 [ 0, [[PRE:%[a-z.0-9]+]] ], [ [[IV4:%[a-z.0-9]+]], %for.body ]
-; CHECK-UNROLL-T2: [[IV1:%[a-z.0-9]+]] = add nuw nsw i32 [[IV0]], 1
-; CHECK-UNROLL-T2: [[IV2:%[a-z.0-9]+]] = add nuw nsw i32 [[IV1]], 1
-; CHECK-UNROLL-T2: [[IV3:%[a-z.0-9]+]] = add nuw nsw i32 [[IV2]], 1
-; CHECK-UNROLL-T2: [[IV4]] = add nuw i32 [[IV3]], 1
-; CHECK-UNROLL-T2: br
-
-; CHECK-UNROLL-T2: for.body.epil:
-; CHECK-UNROLL-T2: for.body.epil.1:
-; CHECK-UNROLL-T2: for.body.epil.2:
-
- %i.09 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
- %arrayidx = getelementptr inbounds i32, i32* %A, i32 %i.09
- %0 = load i32, i32* %arrayidx, align 4
- %arrayidx1 = getelementptr inbounds i32, i32* %B, i32 %i.09
- %1 = load i32, i32* %arrayidx1, align 4
- %mul = mul nsw i32 %1, %0
- %arrayidx2 = getelementptr inbounds i32, i32* %C, i32 %i.09
- store i32 %mul, i32* %arrayidx2, align 4
- %inc = add nuw i32 %i.09, 1
- %exitcond = icmp eq i32 %inc, %N
- br i1 %exitcond, label %for.cond.cleanup, label %for.body
-
-for.cond.cleanup:
- ret void
-}
-
-; CHECK-LABEL: nested_runtime
-define arm_aapcs_vfpcc void @nested_runtime(i32* nocapture %C, i16* nocapture readonly %A, i16* nocapture readonly %B, i32 %N) local_unnamed_addr #0 {
-entry:
- %cmp25 = icmp eq i32 %N, 0
- br i1 %cmp25, label %for.cond.cleanup, label %for.body4.lr.ph
-
-for.body4.lr.ph:
- %h.026 = phi i32 [ %inc11, %for.cond.cleanup3 ], [ 0, %entry ]
- %mul = mul i32 %h.026, %N
- br label %for.body4
-
-for.cond.cleanup:
- ret void
-
-for.cond.cleanup3:
- %inc11 = add nuw i32 %h.026, 1
- %exitcond27 = icmp eq i32 %inc11, %N
- br i1 %exitcond27, label %for.cond.cleanup, label %for.body4.lr.ph
-
-; CHECK-LABEL: for.body4
-for.body4:
-; CHECK-UNROLL-T1: [[IV0:%[a-z.0-9]+]] = phi i32 [ 0, [[PRE:%[a-z0-9.]+]] ], [ [[IV1:%[a-z.0-9]+]], %for.body4 ]
-; CHECK-UNROLL-T1: [[IV1]] = add nuw i32 [[IV0]], 1
-; CHECK-UNROLL-T1: br
-
-; CHECK-UNROLL-T2: for.body4.epil:
-; CHECK-UNROLL-T2: [[IV0:%[a-z.0-9]+]] = phi i32 [ 0, [[PRE:%[a-z0-9.]+]] ], [ [[IV4:%[a-z.0-9]+]], %for.body4 ]
-; CHECK-UNROLL-T2: [[IV1:%[a-z.0-9]+]] = add nuw nsw i32 [[IV0]], 1
-; CHECK-UNROLL-T2: [[IV2:%[a-z.0-9]+]] = add nuw nsw i32 [[IV1]], 1
-; CHECK-UNROLL-T2: [[IV3:%[a-z.0-9]+]] = add nuw nsw i32 [[IV2]], 1
-; CHECK-UNROLL-T2: [[IV4]] = add nuw i32 [[IV3]], 1
-; CHECK-UNROLL-T2: br
-; CHECK-UNROLL-T2: for.body4.epil.1:
-; CHECK-UNROLL-T2: for.body4.epil.2:
-
- %w.024 = phi i32 [ 0, %for.body4.lr.ph ], [ %inc, %for.body4 ]
- %add = add i32 %w.024, %mul
- %arrayidx = getelementptr inbounds i16, i16* %A, i32 %add
- %0 = load i16, i16* %arrayidx, align 2
- %conv = sext i16 %0 to i32
- %arrayidx5 = getelementptr inbounds i16, i16* %B, i32 %w.024
- %1 = load i16, i16* %arrayidx5, align 2
- %conv6 = sext i16 %1 to i32
- %mul7 = mul nsw i32 %conv6, %conv
- %arrayidx8 = getelementptr inbounds i32, i32* %C, i32 %w.024
- %2 = load i32, i32* %arrayidx8, align 4
- %add9 = add nsw i32 %mul7, %2
- store i32 %add9, i32* %arrayidx8, align 4
- %inc = add nuw i32 %w.024, 1
- %exitcond = icmp eq i32 %inc, %N
- br i1 %exitcond, label %for.cond.cleanup3, label %for.body4
-}
-
-; CHECK-LABEL: loop_call
-define arm_aapcs_vfpcc void @loop_call(i32* nocapture %C, i32* nocapture readonly %A, i32* nocapture readonly %B) local_unnamed_addr #1 {
-entry:
- br label %for.body
-
-for.cond.cleanup:
- ret void
-
-; CHECK-LABEL: for.body
-for.body:
-; CHECK-UNROLL-A: [[IV0:%[a-z.0-9]+]] = phi i32 [ 0, %entry ], [ [[IV1:%[a-z.0-9]+]], %for.body ]
-; CHECK-UNROLL-A: [[IV1]] = add nuw nsw i32 [[IV0]], 1
-; CHECK-UNROLL-A: icmp eq i32 [[IV1]], 1024
-; CHECK-UNROLL-A: br
-
-; CHECK-UNROLL-T1: [[IV0:%[a-z.0-9]+]] = phi i32 [ 0, %entry ], [ [[IV1:%[a-z.0-9]+]], %for.body ]
-; CHECK-UNROLL-T1: [[IV1]] = add nuw nsw i32 [[IV0]], 1
-; CHECK-UNROLL-T1: icmp eq i32 [[IV1]], 1024
-; CHECK-UNROLL-T1: br
-
-; CHECK-UNROLL-T2: [[IV0:%[a-z.0-9]+]] = phi i32 [ 0, %entry ], [ [[IV1:%[a-z.0-9]+]], %for.body ]
-; CHECK-UNROLL-T2: [[IV1]] = add nuw nsw i32 [[IV0]], 1
-; CHECK-UNROLL-T2: icmp eq i32 [[IV1]], 1024
-; CHECK-UNROLL-T2: br
-
- %i.08 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %A, i32 %i.08
- %0 = load i32, i32* %arrayidx, align 4
- %arrayidx1 = getelementptr inbounds i32, i32* %B, i32 %i.08
- %1 = load i32, i32* %arrayidx1, align 4
- %call = tail call arm_aapcs_vfpcc i32 @some_func(i32 %0, i32 %1) #3
- %arrayidx2 = getelementptr inbounds i32, i32* %C, i32 %i.08
- store i32 %call, i32* %arrayidx2, align 4
- %inc = add nuw nsw i32 %i.08, 1
- %exitcond = icmp eq i32 %inc, 1024
- br i1 %exitcond, label %for.cond.cleanup, label %for.body
-}
-
-; CHECK-LABEL: iterate_inc
-; CHECK-UNROLL-A: %n.addr.04 = phi %struct.Node* [ %1, %while.body ], [ %n, %while.body.preheader ]
-; CHECK-UNROLL-A: %tobool = icmp eq %struct.Node* %1, null
-; CHECK-UNROLL-A: br i1 %tobool
-; CHECK-UNROLL-A-NOT: load
-
-; CHECK-UNROLL-T1: %n.addr.04 = phi %struct.Node* [ %1, %while.body ], [ %n, %while.body.preheader ]
-; CHECK-UNROLL-T1: %tobool = icmp eq %struct.Node* %1, null
-; CHECK-UNROLL-T1: br i1 %tobool
-; CHECK-UNROLL-T1-NOT: load
-
-; CHECK-UNROLL-T2: [[CMP0:%[a-z.0-9]+]] = icmp eq %struct.Node* [[VAR0:%[a-z.0-9]+]], null
-; CHECK-UNROLL-T2: br i1 [[CMP0]], label [[END:%[a-z.0-9]+]]
-; CHECK-UNROLL-T2: [[CMP1:%[a-z.0-9]+]] = icmp eq %struct.Node* [[VAR1:%[a-z.0-9]+]], null
-; CHECK-UNROLL-T2: br i1 [[CMP1]], label [[END]]
-; CHECK-UNROLL-T2: [[CMP2:%[a-z.0-9]+]] = icmp eq %struct.Node* [[VAR2:%[a-z.0-9]+]], null
-; CHECK-UNROLL-T2: br i1 [[CMP2]], label [[END]]
-; CHECK-UNROLL-T2: [[CMP3:%[a-z.0-9]+]] = icmp eq %struct.Node* [[VAR3:%[a-z.0-9]+]], null
-; CHECK-UNROLL-T2: br i1 [[CMP3]], label [[END]]
-; CHECK-UNROLL-T2: [[CMP4:%[a-z.0-9]+]] = icmp eq %struct.Node* [[VAR4:%[a-z.0-9]+]], null
-; CHECK-UNROLL-T2: br i1 [[CMP4]], label [[END]]
-; CHECK-UNROLL-T2-NOT: load
-
-%struct.Node = type { %struct.Node*, i32 }
-
-define arm_aapcscc void @iterate_inc(%struct.Node* %n) local_unnamed_addr #0 {
-entry:
- %tobool3 = icmp eq %struct.Node* %n, null
- br i1 %tobool3, label %while.end, label %while.body.preheader
-
-while.body.preheader:
- br label %while.body
-
-while.body:
- %n.addr.04 = phi %struct.Node* [ %1, %while.body ], [ %n, %while.body.preheader ]
- %val = getelementptr inbounds %struct.Node, %struct.Node* %n.addr.04, i32 0, i32 1
- %0 = load i32, i32* %val, align 4
- %add = add nsw i32 %0, 1
- store i32 %add, i32* %val, align 4
- %next = getelementptr inbounds %struct.Node, %struct.Node* %n.addr.04, i32 0, i32 0
- %1 = load %struct.Node*, %struct.Node** %next, align 4
- %tobool = icmp eq %struct.Node* %1, null
- br i1 %tobool, label %while.end, label %while.body
-
-while.end:
- ret void
-}
-
-declare arm_aapcs_vfpcc i32 @some_func(i32, i32) local_unnamed_addr #2
diff --git a/llvm/test/Transforms/LoopUnroll/ARM/multi-blocks.ll b/llvm/test/Transforms/LoopUnroll/ARM/multi-blocks.ll
deleted file mode 100644
index 7e8c55e7541..00000000000
--- a/llvm/test/Transforms/LoopUnroll/ARM/multi-blocks.ll
+++ /dev/null
@@ -1,316 +0,0 @@
-; RUN: opt -mtriple=thumbv8m.main -mcpu=cortex-m33 -loop-unroll -S < %s -o - | FileCheck %s
-; RUN: opt -mtriple=thumbv7em -mcpu=cortex-m7 -loop-unroll -S < %s -o - | FileCheck %s
-
-;CHECK-LABEL: test_three_blocks
-;CHECK: for.body.epil:
-;CHECK: if.then.epil:
-;CHECK: for.inc.epil:
-;CHECK: for.body:
-;CHECK: if.then:
-;CHECK: for.inc:
-;CHECK: for.body.epil.1:
-;CHECK: if.then.epil.1:
-;CHECK: for.inc.epil.1:
-;CHECK: for.body.epil.2:
-;CHECK: if.then.epil.2:
-;CHECK: for.inc.epil.2:
-;CHECK: if.then.1:
-;CHECK: for.inc.1:
-;CHECK: if.then.2:
-;CHECK: for.inc.2:
-;CHECK: if.then.3:
-;CHECK: for.inc.3:
-define void @test_three_blocks(i32* nocapture %Output,
- i32* nocapture readonly %Condition,
- i32* nocapture readonly %Input,
- i32 %MaxJ) {
-entry:
- %cmp8 = icmp eq i32 %MaxJ, 0
- br i1 %cmp8, label %for.cond.cleanup, label %for.body.preheader
-
-for.body.preheader: ; preds = %entry
- br label %for.body
-
-for.cond.cleanup: ; preds = %for.inc, %entry
- %temp.0.lcssa = phi i32 [ 0, %entry ], [ %temp.1, %for.inc ]
- store i32 %temp.0.lcssa, i32* %Output, align 4
- ret void
-
-for.body: ; preds = %for.body.preheader, %for.inc
- %j.010 = phi i32 [ %inc, %for.inc ], [ 0, %for.body.preheader ]
- %temp.09 = phi i32 [ %temp.1, %for.inc ], [ 0, %for.body.preheader ]
- %arrayidx = getelementptr inbounds i32, i32* %Condition, i32 %j.010
- %0 = load i32, i32* %arrayidx, align 4
- %tobool = icmp eq i32 %0, 0
- br i1 %tobool, label %for.inc, label %if.then
-
-if.then: ; preds = %for.body
- %arrayidx1 = getelementptr inbounds i32, i32* %Input, i32 %j.010
- %1 = load i32, i32* %arrayidx1, align 4
- %add = add i32 %1, %temp.09
- br label %for.inc
-
-for.inc: ; preds = %for.body, %if.then
- %temp.1 = phi i32 [ %add, %if.then ], [ %temp.09, %for.body ]
- %inc = add nuw i32 %j.010, 1
- %exitcond = icmp eq i32 %inc, %MaxJ
- br i1 %exitcond, label %for.cond.cleanup, label %for.body
-}
-
-;CHECK-LABEL: test_two_exits
-;CHECK: for.body:
-;CHECK: if.end:
-;CHECK: cleanup.loopexit:
-;CHECK: cleanup:
-;CHECK: for.body.1:
-;CHECK: if.end.1:
-;CHECK: for.body.2:
-;CHECK: if.end.2:
-;CHECK: for.body.3:
-;CHECK: if.end.3:
-define void @test_two_exits(i32* nocapture %Output,
- i32* nocapture readonly %Condition,
- i32* nocapture readonly %Input,
- i32 %MaxJ) {
-entry:
- %cmp14 = icmp eq i32 %MaxJ, 0
- br i1 %cmp14, label %cleanup, label %for.body.preheader
-
-for.body.preheader: ; preds = %entry
- br label %for.body
-
-for.body: ; preds = %for.body.preheader, %if.end
- %j.016 = phi i32 [ %inc, %if.end ], [ 0, %for.body.preheader ]
- %temp.015 = phi i32 [ %temp.0.add, %if.end ], [ 0, %for.body.preheader ]
- %arrayidx = getelementptr inbounds i32, i32* %Input, i32 %j.016
- %0 = load i32, i32* %arrayidx, align 4
- %cmp1 = icmp ugt i32 %0, 65535
- br i1 %cmp1, label %cleanup, label %if.end
-
-if.end: ; preds = %for.body
- %arrayidx2 = getelementptr inbounds i32, i32* %Condition, i32 %j.016
- %1 = load i32, i32* %arrayidx2, align 4
- %tobool = icmp eq i32 %1, 0
- %add = select i1 %tobool, i32 0, i32 %0
- %temp.0.add = add i32 %add, %temp.015
- %inc = add nuw i32 %j.016, 1
- %cmp = icmp ult i32 %inc, %MaxJ
- br i1 %cmp, label %for.body, label %cleanup
-
-cleanup: ; preds = %if.end, %for.body, %entry
- %temp.0.lcssa = phi i32 [ 0, %entry ], [ %temp.015, %for.body ], [ %temp.0.add, %if.end ]
- store i32 %temp.0.lcssa, i32* %Output, align 4
- ret void
-}
-
-;CHECK-LABEL: test_three_exits
-;CHECK-NOT: for.body.epil
-;CHECK-NOT: if.end.epil
-;CHECK-LABEL: for.body
-;CHECK-LABEL: if.end
-;CHECK-LABEL: if.end5
-define void @test_three_exits(i32* nocapture %Output,
- i32* nocapture readonly %Condition,
- i32* nocapture readonly %Input,
- i32 %MaxJ) {
-entry:
- %cmp20 = icmp eq i32 %MaxJ, 0
- br i1 %cmp20, label %cleanup, label %for.body.preheader
-
-for.body.preheader: ; preds = %entry
- br label %for.body
-
-for.body: ; preds = %for.body.preheader, %if.end5
- %j.022 = phi i32 [ %inc, %if.end5 ], [ 0, %for.body.preheader ]
- %temp.021 = phi i32 [ %temp.0.add, %if.end5 ], [ 0, %for.body.preheader ]
- %arrayidx = getelementptr inbounds i32, i32* %Condition, i32 %j.022
- %0 = load i32, i32* %arrayidx, align 4
- %cmp1 = icmp ugt i32 %0, 65535
- br i1 %cmp1, label %cleanup, label %if.end
-
-if.end: ; preds = %for.body
- %arrayidx2 = getelementptr inbounds i32, i32* %Input, i32 %j.022
- %1 = load i32, i32* %arrayidx2, align 4
- %cmp3 = icmp ugt i32 %1, 65535
- br i1 %cmp3, label %cleanup, label %if.end5
-
-if.end5: ; preds = %if.end
- %tobool = icmp eq i32 %0, 0
- %add = select i1 %tobool, i32 0, i32 %1
- %temp.0.add = add i32 %add, %temp.021
- %inc = add nuw i32 %j.022, 1
- %cmp = icmp ult i32 %inc, %MaxJ
- br i1 %cmp, label %for.body, label %cleanup
-
-cleanup: ; preds = %if.end5, %for.body, %if.end, %entry
- %temp.0.lcssa = phi i32 [ 0, %entry ], [ %temp.021, %if.end ], [ %temp.021, %for.body ], [ %temp.0.add, %if.end5 ]
- store i32 %temp.0.lcssa, i32* %Output, align 4
- ret void
-}
-
-;CHECK-LABEL: test_four_blocks
-;CHECK: for.body.epil:
-;CHECK: if.else.epil:
-;CHECK: if.then.epil:
-;CHECK: for.cond.cleanup:
-;CHECK: for.body:
-;CHECK: if.then:
-;CHECK: for.inc:
-;CHECK: for.body.epil.1:
-;CHECK: if.else.epil.1:
-;CHECK: if.then.epil.1:
-;CHECK: for.inc.epil.1:
-;CHECK: for.body.epil.2:
-;CHECK: if.else.epil.2:
-;CHECK: if.then.epil.2:
-;CHECK: for.inc.epil.2:
-;CHECK: if.else.1:
-;CHECK: if.then.1:
-;CHECK: for.inc.1:
-;CHECK: if.else.2:
-;CHECK: if.then.2:
-;CHECK: for.inc.2:
-;CHECK: if.else.3:
-;CHECK: if.then.3:
-;CHECK: for.inc.3:
-define void @test_four_blocks(i32* nocapture %Output,
- i32* nocapture readonly %Condition,
- i32* nocapture readonly %Input,
- i32 %MaxJ) {
-entry:
- %cmp25 = icmp ugt i32 %MaxJ, 1
- br i1 %cmp25, label %for.body.lr.ph, label %for.cond.cleanup
-
-for.body.lr.ph: ; preds = %entry
- %.pre = load i32, i32* %Input, align 4
- br label %for.body
-
-for.cond.cleanup: ; preds = %for.inc, %entry
- %temp.0.lcssa = phi i32 [ 0, %entry ], [ %temp.1, %for.inc ]
- store i32 %temp.0.lcssa, i32* %Output, align 4
- ret void
-
-for.body: ; preds = %for.inc, %for.body.lr.ph
- %0 = phi i32 [ %.pre, %for.body.lr.ph ], [ %2, %for.inc ]
- %j.027 = phi i32 [ 1, %for.body.lr.ph ], [ %inc, %for.inc ]
- %temp.026 = phi i32 [ 0, %for.body.lr.ph ], [ %temp.1, %for.inc ]
- %arrayidx = getelementptr inbounds i32, i32* %Condition, i32 %j.027
- %1 = load i32, i32* %arrayidx, align 4
- %cmp1 = icmp ugt i32 %1, 65535
- %arrayidx2 = getelementptr inbounds i32, i32* %Input, i32 %j.027
- %2 = load i32, i32* %arrayidx2, align 4
- %cmp4 = icmp ugt i32 %2, %0
- br i1 %cmp1, label %if.then, label %if.else
-
-if.then: ; preds = %for.body
- %cond = zext i1 %cmp4 to i32
- %add = add i32 %temp.026, %cond
- br label %for.inc
-
-if.else: ; preds = %for.body
- %not.cmp4 = xor i1 %cmp4, true
- %sub = sext i1 %not.cmp4 to i32
- %sub10.sink = add i32 %j.027, %sub
- %arrayidx11 = getelementptr inbounds i32, i32* %Input, i32 %sub10.sink
- %3 = load i32, i32* %arrayidx11, align 4
- %sub13 = sub i32 %temp.026, %3
- br label %for.inc
-
-for.inc: ; preds = %if.then, %if.else
- %temp.1 = phi i32 [ %add, %if.then ], [ %sub13, %if.else ]
- %inc = add nuw i32 %j.027, 1
- %exitcond = icmp eq i32 %inc, %MaxJ
- br i1 %exitcond, label %for.cond.cleanup, label %for.body
-}
-
-;CHECK-LABEL: test_five_blocks
-;CHECK-NOT: for.body.epil:
-;CHECK: for.body:
-;CHECK: if.end:
-;CHECK: if.else:
-;CHECK: for.inc:
-;CHECK-NOT: for.inc.1:
-define void @test_five_blocks(i32* nocapture %Output,
- i32* nocapture readonly %Condition,
- i32* nocapture readonly %Input,
- i32 %MaxJ) {
-entry:
- %cmp24 = icmp ugt i32 %MaxJ, 1
- br i1 %cmp24, label %for.body.preheader, label %cleanup
-
-for.body.preheader: ; preds = %entry
- br label %for.body
-
-for.body: ; preds = %for.body.preheader, %for.inc
- %j.026 = phi i32 [ %inc, %for.inc ], [ 1, %for.body.preheader ]
- %temp.025 = phi i32 [ %temp.1, %for.inc ], [ 0, %for.body.preheader ]
- %arrayidx = getelementptr inbounds i32, i32* %Input, i32 %j.026
- %0 = load i32, i32* %arrayidx, align 4
- %add = add i32 %0, %temp.025
- %cmp1 = icmp ugt i32 %add, 16777215
- br i1 %cmp1, label %cleanup, label %if.end
-
-if.end: ; preds = %for.body
- %arrayidx2 = getelementptr inbounds i32, i32* %Condition, i32 %j.026
- %1 = load i32, i32* %arrayidx2, align 4
- %cmp3 = icmp ugt i32 %1, 65535
- br i1 %cmp3, label %if.then4, label %if.else
-
-if.then4: ; preds = %if.end
- %sub = add i32 %j.026, -1
- %arrayidx6 = getelementptr inbounds i32, i32* %Input, i32 %sub
- %2 = load i32, i32* %arrayidx6, align 4
- %cmp7 = icmp ugt i32 %0, %2
- %cond = zext i1 %cmp7 to i32
- %add8 = add i32 %add, %cond
- br label %for.inc
-
-if.else: ; preds = %if.end
- %and = and i32 %add, %0
- br label %for.inc
-
-for.inc: ; preds = %if.then4, %if.else
- %temp.1 = phi i32 [ %add8, %if.then4 ], [ %and, %if.else ]
- %inc = add nuw i32 %j.026, 1
- %cmp = icmp ult i32 %inc, %MaxJ
- br i1 %cmp, label %for.body, label %cleanup
-
-cleanup: ; preds = %for.inc, %for.body, %entry
- %temp.2 = phi i32 [ 0, %entry ], [ %add, %for.body ], [ %temp.1, %for.inc ]
- store i32 %temp.2, i32* %Output, align 4
- ret void
-}
-
-;CHECK-LABEL: iterate_inc
-;CHECK: while.body:
-;CHECK: while.end:
-;CHECK: while.body.1:
-;CHECK: while.body.2:
-;CHECK: while.body.3:
-%struct.Node = type { %struct.Node*, i32 }
-define void @iterate_inc(%struct.Node* %n, i32 %limit) {
-entry:
- %tobool5 = icmp eq %struct.Node* %n, null
- br i1 %tobool5, label %while.end, label %land.rhs.preheader
-
-land.rhs.preheader: ; preds = %entry
- br label %land.rhs
-
-land.rhs: ; preds = %land.rhs.preheader, %while.body
- %list.addr.06 = phi %struct.Node* [ %2, %while.body ], [ %n, %land.rhs.preheader ]
- %val = getelementptr inbounds %struct.Node, %struct.Node* %list.addr.06, i32 0, i32 1
- %0 = load i32, i32* %val, align 4
- %cmp = icmp slt i32 %0, %limit
- br i1 %cmp, label %while.body, label %while.end
-
-while.body: ; preds = %land.rhs
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %val, align 4
- %1 = bitcast %struct.Node* %list.addr.06 to %struct.Node**
- %2 = load %struct.Node*, %struct.Node** %1, align 4
- %tobool = icmp eq %struct.Node* %2, null
- br i1 %tobool, label %while.end, label %land.rhs
-
-while.end: ; preds = %land.rhs, %while.body, %entry
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/Hexagon/lit.local.cfg b/llvm/test/Transforms/LoopUnroll/Hexagon/lit.local.cfg
deleted file mode 100644
index ba72ff632d4..00000000000
--- a/llvm/test/Transforms/LoopUnroll/Hexagon/lit.local.cfg
+++ /dev/null
@@ -1,3 +0,0 @@
-if not 'Hexagon' in config.root.targets:
- config.unsupported = True
-
diff --git a/llvm/test/Transforms/LoopUnroll/Hexagon/peel-small-loop.ll b/llvm/test/Transforms/LoopUnroll/Hexagon/peel-small-loop.ll
deleted file mode 100644
index 45c2553a70a..00000000000
--- a/llvm/test/Transforms/LoopUnroll/Hexagon/peel-small-loop.ll
+++ /dev/null
@@ -1,37 +0,0 @@
-; RUN: opt -loop-unroll -mtriple=hexagon -S < %s | FileCheck %s
-; Check that the loop is peeled twice for Hexagon.
-; CHECK: while.body.peel
-; CHECK: while.body.peel2
-
-%struct.STREAM = type { %union.anon, i32, i32 }
-%union.anon = type { i32* }
-
-define void @function(%struct.STREAM* nocapture readonly %b) local_unnamed_addr {
-entry:
- %bitPtr3 = getelementptr inbounds %struct.STREAM, %struct.STREAM* %b, i32 0, i32 2
- %0 = load i32, i32* %bitPtr3, align 4
- %cmp11 = icmp ult i32 %0, 32
- br i1 %cmp11, label %while.body.preheader, label %do.end
-
-while.body.preheader:
- %value2 = getelementptr inbounds %struct.STREAM, %struct.STREAM* %b, i32 0, i32 1
- %1 = load i32, i32* %value2, align 4
- %w = getelementptr inbounds %struct.STREAM, %struct.STREAM* %b, i32 0, i32 0, i32 0
- %2 = load i32*, i32** %w, align 4
- br label %while.body
-
-while.body:
- %bitPtr.014 = phi i32 [ %add, %while.body ], [ %0, %while.body.preheader ]
- %value.013 = phi i32 [ %shl, %while.body ], [ %1, %while.body.preheader ]
- %ptr.012 = phi i32* [ %incdec.ptr, %while.body ], [ %2, %while.body.preheader ]
- %add = add nuw i32 %bitPtr.014, 8
- %shr = lshr i32 %value.013, 24
- %incdec.ptr = getelementptr inbounds i32, i32* %ptr.012, i32 1
- store i32 %shr, i32* %ptr.012, align 4
- %shl = shl i32 %value.013, 8
- %cmp = icmp ult i32 %add, 17
- br i1 %cmp, label %while.body, label %do.end
-
-do.end:
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/PowerPC/a2-high-cost-trip-count-computation.ll b/llvm/test/Transforms/LoopUnroll/PowerPC/a2-high-cost-trip-count-computation.ll
deleted file mode 100644
index bd5f68f9f20..00000000000
--- a/llvm/test/Transforms/LoopUnroll/PowerPC/a2-high-cost-trip-count-computation.ll
+++ /dev/null
@@ -1,27 +0,0 @@
-; RUN: opt < %s -S -mtriple=powerpc64-unknown-linux-gnu -mcpu=a2 -loop-unroll | 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-S128"
-
-;; Check that we do emit expensive instructions to compute trip
-;; counts when unrolling loops on the a2 (because we unroll a lot).
-
-define i32 @test(i64 %v12, i8* %array, i64* %loc) {
-; CHECK-LABEL: @test(
-; CHECK: udiv
-entry:
- %step = load i64, i64* %loc, !range !0
- br label %loop
-
-loop: ; preds = %entry, %loop
- %k.015 = phi i64 [ %v15, %loop ], [ %v12, %entry ]
- %v14 = getelementptr inbounds i8, i8* %array, i64 %k.015
- store i8 0, i8* %v14
- %v15 = add nuw nsw i64 %k.015, %step
- %v16 = icmp slt i64 %v15, 8193
- br i1 %v16, label %loop, label %loopexit
-
-loopexit: ; preds = %loop
- ret i32 0
-}
-
-!0 = !{i64 1, i64 100}
diff --git a/llvm/test/Transforms/LoopUnroll/PowerPC/a2-unrolling.ll b/llvm/test/Transforms/LoopUnroll/PowerPC/a2-unrolling.ll
deleted file mode 100644
index 6b9d31e2d99..00000000000
--- a/llvm/test/Transforms/LoopUnroll/PowerPC/a2-unrolling.ll
+++ /dev/null
@@ -1,34 +0,0 @@
-; RUN: opt < %s -S -mtriple=powerpc64-unknown-linux-gnu -mcpu=a2 -loop-unroll -unroll-runtime-epilog=true | FileCheck %s -check-prefix=EPILOG
-; RUN: opt < %s -S -mtriple=powerpc64-unknown-linux-gnu -mcpu=a2 -loop-unroll -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG
-
-define i32 @test(i32* nocapture %a, i32 %n) nounwind uwtable readonly {
-entry:
- %cmp1 = icmp eq i32 %n, 0
- br i1 %cmp1, label %for.end, label %for.body
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
- %sum.02 = phi i32 [ %add, %for.body ], [ 0, %entry ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %add = add nsw i32 %0, %sum.02
- %indvars.iv.next = add i64 %indvars.iv, 1
- %lftr.wideiv = trunc i64 %indvars.iv.next to i32
- %exitcond = icmp eq i32 %lftr.wideiv, %n
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %for.body, %entry
- %sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
- ret i32 %sum.0.lcssa
-}
-
-; EPILOG-LABEL: @test
-; EPILOG: for.body:
-; EPILOG: br i1 %niter.ncmp.7, label %for.end.loopexit{{.*}}, label %for.body
-; EPILOG: for.body.epil{{.*}}:
-
-; PROLOG-LABEL: @test
-; PROLOG: for.body.prol{{.*}}:
-; PROLOG: for.body:
-; PROLOG: br i1 %exitcond.7, label %for.end.loopexit{{.*}}, label %for.body
-
diff --git a/llvm/test/Transforms/LoopUnroll/PowerPC/lit.local.cfg b/llvm/test/Transforms/LoopUnroll/PowerPC/lit.local.cfg
deleted file mode 100644
index 5d33887ff0a..00000000000
--- a/llvm/test/Transforms/LoopUnroll/PowerPC/lit.local.cfg
+++ /dev/null
@@ -1,3 +0,0 @@
-if not 'PowerPC' in config.root.targets:
- config.unsupported = True
-
diff --git a/llvm/test/Transforms/LoopUnroll/PowerPC/p7-unrolling.ll b/llvm/test/Transforms/LoopUnroll/PowerPC/p7-unrolling.ll
deleted file mode 100644
index c9677d83e37..00000000000
--- a/llvm/test/Transforms/LoopUnroll/PowerPC/p7-unrolling.ll
+++ /dev/null
@@ -1,50 +0,0 @@
-; RUN: opt < %s -S -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -loop-unroll | FileCheck %s
-define void @unroll_default() nounwind {
-entry:
- br label %loop
-
-loop:
- %iv = phi i32 [ 0, %entry ], [ %inc, %loop ]
- %inc = add i32 %iv, 1
- %exitcnd = icmp uge i32 %inc, 1024
- br i1 %exitcnd, label %exit, label %loop
-
-exit:
- ret void
-}
-
-; CHECK-LABEL: @unroll_default
-; CHECK: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: add
-; CHECK-NEXT: icmp
-
diff --git a/llvm/test/Transforms/LoopUnroll/PowerPC/p8-unrolling-legalize-vectors.ll b/llvm/test/Transforms/LoopUnroll/PowerPC/p8-unrolling-legalize-vectors.ll
deleted file mode 100644
index 27998230abe..00000000000
--- a/llvm/test/Transforms/LoopUnroll/PowerPC/p8-unrolling-legalize-vectors.ll
+++ /dev/null
@@ -1,74 +0,0 @@
-; RUN: opt < %s -S -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 -loop-unroll | FileCheck %s
-; RUN: opt < %s -S -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr9 -loop-unroll | FileCheck %s
-
-target datalayout = "e-m:e-i64:64-n32:64"
-target triple = "powerpc64le-unknown-linux-gnu"
-
-; Function Attrs: norecurse nounwind
-define i8* @f(i8* returned %s, i32 zeroext %x, i32 signext %k) local_unnamed_addr #0 {
-entry:
- %cmp10 = icmp sgt i32 %k, 0
- br i1 %cmp10, label %for.body.lr.ph, label %for.end
-
-for.body.lr.ph: ; preds = %entry
- %wide.trip.count = zext i32 %k to i64
- %min.iters.check = icmp ult i32 %k, 16
- br i1 %min.iters.check, label %for.body.preheader, label %vector.ph
-
-vector.ph: ; preds = %for.body.lr.ph
- %n.vec = and i64 %wide.trip.count, 4294967280
- %broadcast.splatinsert = insertelement <16 x i32> undef, i32 %x, i32 0
- %broadcast.splat = shufflevector <16 x i32> %broadcast.splatinsert, <16 x i32> undef, <16 x i32> zeroinitializer
- br label %vector.body
-
-vector.body: ; preds = %vector.body, %vector.ph
- %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
- %vec.ind12 = phi <16 x i32> [ <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>, %vector.ph ], [ %vec.ind.next13, %vector.body ]
- %0 = shl <16 x i32> <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>, %vec.ind12
- %1 = and <16 x i32> %0, %broadcast.splat
- %2 = icmp eq <16 x i32> %1, zeroinitializer
- %3 = select <16 x i1> %2, <16 x i8> <i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48>, <16 x i8> <i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49>
- %4 = getelementptr inbounds i8, i8* %s, i64 %index
- %5 = bitcast i8* %4 to <16 x i8>*
- store <16 x i8> %3, <16 x i8>* %5, align 1
- %index.next = add i64 %index, 16
- %vec.ind.next13 = add <16 x i32> %vec.ind12, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
- %6 = icmp eq i64 %index.next, %n.vec
- br i1 %6, label %middle.block, label %vector.body
-
-middle.block: ; preds = %vector.body
- %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
- br i1 %cmp.n, label %for.end, label %for.body.preheader
-
-for.body.preheader: ; preds = %middle.block, %for.body.lr.ph
- %indvars.iv.ph = phi i64 [ 0, %for.body.lr.ph ], [ %n.vec, %middle.block ]
- br label %for.body
-
-for.body: ; preds = %for.body.preheader, %for.body
- %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader ]
- %7 = trunc i64 %indvars.iv to i32
- %shl = shl i32 1, %7
- %and = and i32 %shl, %x
- %tobool = icmp eq i32 %and, 0
- %conv = select i1 %tobool, i8 48, i8 49
- %arrayidx = getelementptr inbounds i8, i8* %s, i64 %indvars.iv
- store i8 %conv, i8* %arrayidx, 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.end, label %for.body
-
-for.end: ; preds = %for.body, %middle.block, %entry
- %idxprom1 = sext i32 %k to i64
- %arrayidx2 = getelementptr inbounds i8, i8* %s, i64 %idxprom1
- store i8 0, i8* %arrayidx2, align 1
- ret i8* %s
-}
-
-
-; CHECK-LABEL: vector.body
-; CHECK: shl
-; CHECK-NEXT: and
-; CHECK: shl
-; CHECK-NEXT: and
-; CHECK: label %vector.body
-
diff --git a/llvm/test/Transforms/LoopUnroll/X86/lit.local.cfg b/llvm/test/Transforms/LoopUnroll/X86/lit.local.cfg
deleted file mode 100644
index e71f3cc4c41..00000000000
--- a/llvm/test/Transforms/LoopUnroll/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/LoopUnroll/X86/mmx.ll b/llvm/test/Transforms/LoopUnroll/X86/mmx.ll
deleted file mode 100644
index 7f00545b71f..00000000000
--- a/llvm/test/Transforms/LoopUnroll/X86/mmx.ll
+++ /dev/null
@@ -1,24 +0,0 @@
-; RUN: opt < %s -S -loop-unroll | FileCheck %s
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
-define x86_mmx @f() #0 {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %phi = phi i32 [ 1, %entry ], [ %add, %for.body ]
- %add = add i32 %phi, 1
- %cmp = icmp eq i32 %phi, 0
- br i1 %cmp, label %exit, label %for.body
-
-exit: ; preds = %for.body
- %ret = phi x86_mmx [ undef, %for.body ]
- ; CHECK: %[[ret_ph:.*]] = phi x86_mmx [ undef, %entry
- ; CHECK: %[[ret_ph1:.*]] = phi x86_mmx [ undef,
- ; CHECK: %[[ret:.*]] = phi x86_mmx [ %[[ret_ph]], {{.*}} ], [ %[[ret_ph1]],
- ; CHECK: ret x86_mmx %[[ret]]
- ret x86_mmx %ret
-}
-
-attributes #0 = { "target-cpu"="x86-64" }
diff --git a/llvm/test/Transforms/LoopUnroll/X86/partial.ll b/llvm/test/Transforms/LoopUnroll/X86/partial.ll
deleted file mode 100644
index a6f35e6f97a..00000000000
--- a/llvm/test/Transforms/LoopUnroll/X86/partial.ll
+++ /dev/null
@@ -1,130 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -mcpu=nehalem | FileCheck %s
-; RUN: opt < %s -S -loop-unroll -unroll-runtime=0 | FileCheck -check-prefix=CHECK-NOUNRL %s
-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* noalias nocapture readnone %ip, double %alpha, double* noalias nocapture %a, double* noalias nocapture readonly %b) #0 {
-entry:
- br label %vector.body
-
-vector.body: ; preds = %vector.body, %entry
- %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
- %0 = getelementptr inbounds double, double* %b, i64 %index
- %1 = bitcast double* %0 to <2 x double>*
- %wide.load = load <2 x double>, <2 x double>* %1, align 8
- %.sum9 = or i64 %index, 2
- %2 = getelementptr double, double* %b, i64 %.sum9
- %3 = bitcast double* %2 to <2 x double>*
- %wide.load8 = load <2 x double>, <2 x double>* %3, align 8
- %4 = fadd <2 x double> %wide.load, <double 1.000000e+00, double 1.000000e+00>
- %5 = fadd <2 x double> %wide.load8, <double 1.000000e+00, double 1.000000e+00>
- %6 = getelementptr inbounds double, double* %a, i64 %index
- %7 = bitcast double* %6 to <2 x double>*
- store <2 x double> %4, <2 x double>* %7, align 8
- %.sum10 = or i64 %index, 2
- %8 = getelementptr double, double* %a, i64 %.sum10
- %9 = bitcast double* %8 to <2 x double>*
- store <2 x double> %5, <2 x double>* %9, align 8
- %index.next = add i64 %index, 4
- %10 = icmp eq i64 %index.next, 1600
- br i1 %10, label %for.end, label %vector.body
-
-; FIXME: We should probably unroll this loop by a factor of 2, but the cost
-; model needs to be fixed to account for instructions likely to be folded
-; as part of an addressing mode.
-; CHECK-LABEL: @foo
-; CHECK-NOUNRL-LABEL: @foo
-
-for.end: ; preds = %vector.body
- ret void
-}
-
-define void @bar(i32* noalias nocapture readnone %ip, double %alpha, double* noalias nocapture %a, double* noalias nocapture readonly %b) #0 {
-entry:
- br label %vector.body
-
-vector.body: ; preds = %vector.body, %entry
- %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]
- %v0 = getelementptr inbounds double, double* %b, i64 %index
- %v1 = bitcast double* %v0 to <2 x double>*
- %wide.load = load <2 x double>, <2 x double>* %v1, align 8
- %v4 = fadd <2 x double> %wide.load, <double 1.000000e+00, double 1.000000e+00>
- %v5 = fmul <2 x double> %v4, <double 8.000000e+00, double 8.000000e+00>
- %v6 = getelementptr inbounds double, double* %a, i64 %index
- %v7 = bitcast double* %v6 to <2 x double>*
- store <2 x double> %v5, <2 x double>* %v7, align 8
- %index.next = add i64 %index, 2
- %v10 = icmp eq i64 %index.next, 1600
- br i1 %v10, label %for.end, label %vector.body
-
-; FIXME: We should probably unroll this loop by a factor of 2, but the cost
-; model needs to first to fixed to account for instructions likely to be folded
-; as part of an addressing mode.
-
-; CHECK-LABEL: @bar
-; CHECK: fadd
-; CHECK-NEXT: fmul
-; CHECK: fadd
-; CHECK-NEXT: fmul
-
-; CHECK-NOUNRL-LABEL: @bar
-; CHECK-NOUNRL: fadd
-; CHECK-NOUNRL-NEXT: fmul
-; CHECK-NOUNRL-NOT: fadd
-
-for.end: ; preds = %vector.body
- ret void
-}
-
-define zeroext i16 @test1(i16* nocapture readonly %arr, i32 %n) #0 {
-entry:
- %cmp25 = icmp eq i32 %n, 0
- br i1 %cmp25, label %for.end, label %for.body
-
-for.body: ; preds = %entry, %for.body
- %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
- %reduction.026 = phi i16 [ %add14, %for.body ], [ 0, %entry ]
- %arrayidx = getelementptr inbounds i16, i16* %arr, i64 %indvars.iv
- %0 = load i16, i16* %arrayidx, align 2
- %mul = shl i16 %0, 1
- %add = add i16 %mul, %reduction.026
- %sext = mul i64 %indvars.iv, 12884901888
- %idxprom3 = ashr exact i64 %sext, 32
- %arrayidx4 = getelementptr inbounds i16, i16* %arr, i64 %idxprom3
- %1 = load i16, i16* %arrayidx4, align 2
- %mul2 = shl i16 %1, 1
- %add7 = add i16 %add, %mul2
- %sext28 = mul i64 %indvars.iv, 21474836480
- %idxprom10 = ashr exact i64 %sext28, 32
- %arrayidx11 = getelementptr inbounds i16, i16* %arr, i64 %idxprom10
- %2 = load i16, i16* %arrayidx11, align 2
- %mul3 = shl i16 %2, 1
- %add14 = add i16 %add7, %mul3
- %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 %for.end, label %for.body
-
-for.end: ; preds = %for.body, %entry
- %reduction.0.lcssa = phi i16 [ 0, %entry ], [ %add14, %for.body ]
- ret i16 %reduction.0.lcssa
-
-; This loop is too large to be partially unrolled (size=16)
-
-; CHECK-LABEL: @test1
-; CHECK: br
-; CHECK: br
-; CHECK: br
-; CHECK: br
-; CHECK-NOT: br
-
-; CHECK-NOUNRL-LABEL: @test1
-; CHECK-NOUNRL: br
-; CHECK-NOUNRL: br
-; CHECK-NOUNRL: br
-; CHECK-NOUNRL: br
-; CHECK-NOUNRL-NOT: br
-}
-
-attributes #0 = { nounwind uwtable }
-
diff --git a/llvm/test/Transforms/LoopUnroll/X86/store_cost.ll b/llvm/test/Transforms/LoopUnroll/X86/store_cost.ll
deleted file mode 100644
index f15b82d8162..00000000000
--- a/llvm/test/Transforms/LoopUnroll/X86/store_cost.ll
+++ /dev/null
@@ -1,104 +0,0 @@
-; REQUIRES: asserts
-; RUN: opt -mcpu=core-avx2 -loop-unroll --debug-only=loop-unroll -S -unroll-allow-partial < %s 2>&1 | FileCheck %s
-
-target triple = "x86_64-unknown-linux-gnu"
-
-; CHECK: Loop Unroll: F[foo] Loop %loop.2.header
-; CHECK: Loop Size = 27
-; CHECK-NOT: UNROLLING loop %loop.2.header
-; CHECK: Loop Unroll: F[foo] Loop %loop.header
-; CHECK: Loop Size = 25
-; CHECK: UNROLLING loop %loop.header by 2
-
-define void @foo(i32 * %out) {
-entry:
- %0 = alloca [1024 x i32]
- %x0 = alloca [1024 x i32]
- %x01 = alloca [1024 x i32]
- %x02 = alloca [1024 x i32]
- %x03 = alloca [1024 x i32]
- %x04 = alloca [1024 x i32]
- %x05 = alloca [1024 x i32]
- %x06 = alloca [1024 x i32]
- br label %loop.header
-
-loop.header:
- %counter = phi i32 [0, %entry], [%inc, %loop.inc]
- br label %loop.body
-
-loop.body:
- %ptr = getelementptr [1024 x i32], [1024 x i32]* %0, i32 0, i32 %counter
- store i32 %counter, i32* %ptr
- %val = add i32 %counter, 5
- %xptr = getelementptr [1024 x i32], [1024 x i32]* %x0, i32 0, i32 %counter
- store i32 %val, i32* %xptr
- %val1 = add i32 %counter, 6
- %xptr1 = getelementptr [1024 x i32], [1024 x i32]* %x01, i32 0, i32 %counter
- store i32 %val1, i32* %xptr1
- %val2 = add i32 %counter, 7
- %xptr2 = getelementptr [1024 x i32], [1024 x i32]* %x02, i32 0, i32 %counter
- store i32 %val2, i32* %xptr2
- %val3 = add i32 %counter, 8
- %xptr3 = getelementptr [1024 x i32], [1024 x i32]* %x03, i32 0, i32 %counter
- store i32 %val3, i32* %xptr3
- %val4 = add i32 %counter, 9
- %xptr4 = getelementptr [1024 x i32], [1024 x i32]* %x04, i32 0, i32 %counter
- store i32 %val4, i32* %xptr4
- %val5 = add i32 %counter, 10
- %xptr5 = getelementptr [1024 x i32], [1024 x i32]* %x05, i32 0, i32 %counter
- store i32 %val5, i32* %xptr5
- br label %loop.inc
-
-loop.inc:
- %inc = add i32 %counter, 2
- %1 = icmp sge i32 %inc, 1023
- br i1 %1, label %exit.0, label %loop.header
-
-exit.0:
- %2 = getelementptr [1024 x i32], [1024 x i32]* %0, i32 0, i32 5
- %3 = load i32, i32* %2
- store i32 %3, i32 * %out
- br label %loop.2.header
-
-
-loop.2.header:
- %counter.2 = phi i32 [0, %exit.0], [%inc.2, %loop.2.inc]
- br label %loop.2.body
-
-loop.2.body:
- %ptr.2 = getelementptr [1024 x i32], [1024 x i32]* %0, i32 0, i32 %counter.2
- store i32 %counter.2, i32* %ptr.2
- %val.2 = add i32 %counter.2, 5
- %xptr.2 = getelementptr [1024 x i32], [1024 x i32]* %x0, i32 0, i32 %counter.2
- store i32 %val.2, i32* %xptr.2
- %val1.2 = add i32 %counter.2, 6
- %xptr1.2 = getelementptr [1024 x i32], [1024 x i32]* %x01, i32 0, i32 %counter.2
- store i32 %val1, i32* %xptr1.2
- %val2.2 = add i32 %counter.2, 7
- %xptr2.2 = getelementptr [1024 x i32], [1024 x i32]* %x02, i32 0, i32 %counter.2
- store i32 %val2, i32* %xptr2.2
- %val3.2 = add i32 %counter.2, 8
- %xptr3.2 = getelementptr [1024 x i32], [1024 x i32]* %x03, i32 0, i32 %counter.2
- store i32 %val3.2, i32* %xptr3.2
- %val4.2 = add i32 %counter.2, 9
- %xptr4.2 = getelementptr [1024 x i32], [1024 x i32]* %x04, i32 0, i32 %counter.2
- store i32 %val4.2, i32* %xptr4.2
- %val5.2 = add i32 %counter.2, 10
- %xptr5.2 = getelementptr [1024 x i32], [1024 x i32]* %x05, i32 0, i32 %counter.2
- store i32 %val5.2, i32* %xptr5.2
- %xptr6.2 = getelementptr [1024 x i32], [1024 x i32]* %x06, i32 0, i32 %counter.2
- store i32 %val5.2, i32* %xptr6.2
- br label %loop.2.inc
-
-loop.2.inc:
- %inc.2 = add i32 %counter.2, 2
- %4 = icmp sge i32 %inc.2, 1023
- br i1 %4, label %exit.2, label %loop.2.header
-
-exit.2:
- %x2 = getelementptr [1024 x i32], [1024 x i32]* %0, i32 0, i32 6
- %x3 = load i32, i32* %x2
- %out2 = getelementptr i32, i32 * %out, i32 1
- store i32 %3, i32 * %out2
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/basic.ll b/llvm/test/Transforms/LoopUnroll/basic.ll
deleted file mode 100644
index 1ceac935482..00000000000
--- a/llvm/test/Transforms/LoopUnroll/basic.ll
+++ /dev/null
@@ -1,48 +0,0 @@
-; RUN: opt < %s -loop-unroll -S | FileCheck %s
-; RUN: opt < %s -passes='require<opt-remark-emit>,unroll' -S | FileCheck %s
-
-
-; This should not unroll since the address of the loop header is taken.
-
-; CHECK-LABEL: @test1(
-; CHECK: store i8* blockaddress(@test1, %l1), i8** %P
-; CHECK: l1:
-; CHECK-NEXT: phi i32
-; rdar://8287027
-define i32 @test1(i8** %P) nounwind ssp {
-entry:
- store i8* blockaddress(@test1, %l1), i8** %P
- br label %l1
-
-l1: ; preds = %l1, %entry
- %x.0 = phi i32 [ 0, %entry ], [ %inc, %l1 ]
- %inc = add nsw i32 %x.0, 1
- %exitcond = icmp eq i32 %inc, 3
- br i1 %exitcond, label %l2, label %l1
-
-l2: ; preds = %l1
- ret i32 0
-}
-
-; This should not unroll since the call is 'noduplicate'.
-
-; CHECK-LABEL: @test2(
-define i32 @test2(i8** %P) nounwind ssp {
-entry:
- br label %l1
-
-l1: ; preds = %l1, %entry
- %x.0 = phi i32 [ 0, %entry ], [ %inc, %l1 ]
-; CHECK: call void @f()
-; CHECK-NOT: call void @f()
- call void @f() noduplicate
- %inc = add nsw i32 %x.0, 1
- %exitcond = icmp eq i32 %inc, 3
- br i1 %exitcond, label %l2, label %l1
-
-l2: ; preds = %l1
- ret i32 0
-; CHECK: }
-}
-
-declare void @f()
diff --git a/llvm/test/Transforms/LoopUnroll/complete_unroll_profitability_with_assume.ll b/llvm/test/Transforms/LoopUnroll/complete_unroll_profitability_with_assume.ll
deleted file mode 100644
index ee43b5b0231..00000000000
--- a/llvm/test/Transforms/LoopUnroll/complete_unroll_profitability_with_assume.ll
+++ /dev/null
@@ -1,119 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -S < %s -loop-unroll -unroll-threshold=42 | FileCheck %s --check-prefix=ANALYZE-FULL
-
-; This test is supposed to check that calls to @llvm.assume builtin are not
-; prohibiting the analysis of full unroll profitability in case the cost of the
-; unrolled loop (not acounting to any simplifications done by such unrolling) is
-; higher than some threshold.
-;
-; Ensure that we indeed are testing this code path by verifying that the loop is
-; not unrolled without such analysis:
-
-; RUN: opt -S < %s -loop-unroll -unroll-threshold=42 -unroll-max-iteration-count-to-analyze=2 \
-; RUN: -unroll-peel-max-count=0 | FileCheck %s --check-prefix=DONT-ANALYZE-FULL
-
-; Function Attrs: nounwind
-declare void @llvm.assume(i1) #1
-
-define i32 @foo(i32* %a) {
-; ANALYZE-FULL-LABEL: @foo(
-; ANALYZE-FULL-NEXT: entry:
-; ANALYZE-FULL-NEXT: br label [[FOR_BODY:%.*]]
-; ANALYZE-FULL: for.body:
-; ANALYZE-FULL-NEXT: br i1 true, label [[DO_STORE:%.*]], label [[FOR_NEXT:%.*]]
-; ANALYZE-FULL: do_store:
-; ANALYZE-FULL-NEXT: store i32 0, i32* [[A:%.*]]
-; ANALYZE-FULL-NEXT: br label [[FOR_NEXT]]
-; ANALYZE-FULL: for.next:
-; ANALYZE-FULL-NEXT: br i1 true, label [[DO_STORE_1:%.*]], label [[FOR_NEXT_1:%.*]]
-; ANALYZE-FULL: do_store.1:
-; ANALYZE-FULL-NEXT: [[GEP_1:%.*]] = getelementptr i32, i32* [[A]], i32 1
-; ANALYZE-FULL-NEXT: store i32 1, i32* [[GEP_1]]
-; ANALYZE-FULL-NEXT: br label [[FOR_NEXT_1]]
-; ANALYZE-FULL: for.next.1:
-; ANALYZE-FULL-NEXT: br i1 true, label [[DO_STORE_2:%.*]], label [[FOR_NEXT_2:%.*]]
-; ANALYZE-FULL: do_store.2:
-; ANALYZE-FULL-NEXT: [[GEP_2:%.*]] = getelementptr i32, i32* [[A]], i32 2
-; ANALYZE-FULL-NEXT: store i32 2, i32* [[GEP_2]]
-; ANALYZE-FULL-NEXT: br label [[FOR_NEXT_2]]
-; ANALYZE-FULL: for.next.2:
-; ANALYZE-FULL-NEXT: br i1 true, label [[DO_STORE_3:%.*]], label [[FOR_NEXT_3:%.*]]
-; ANALYZE-FULL: do_store.3:
-; ANALYZE-FULL-NEXT: [[GEP_3:%.*]] = getelementptr i32, i32* [[A]], i32 3
-; ANALYZE-FULL-NEXT: store i32 3, i32* [[GEP_3]]
-; ANALYZE-FULL-NEXT: br label [[FOR_NEXT_3]]
-; ANALYZE-FULL: for.next.3:
-; ANALYZE-FULL-NEXT: br i1 false, label [[DO_STORE_4:%.*]], label [[FOR_NEXT_4:%.*]]
-; ANALYZE-FULL: do_store.4:
-; ANALYZE-FULL-NEXT: [[GEP_4:%.*]] = getelementptr i32, i32* [[A]], i32 4
-; ANALYZE-FULL-NEXT: store i32 4, i32* [[GEP_4]]
-; ANALYZE-FULL-NEXT: br label [[FOR_NEXT_4]]
-; ANALYZE-FULL: for.next.4:
-; ANALYZE-FULL-NEXT: br i1 false, label [[DO_STORE_5:%.*]], label [[FOR_NEXT_5:%.*]]
-; ANALYZE-FULL: do_store.5:
-; ANALYZE-FULL-NEXT: [[GEP_5:%.*]] = getelementptr i32, i32* [[A]], i32 5
-; ANALYZE-FULL-NEXT: store i32 5, i32* [[GEP_5]]
-; ANALYZE-FULL-NEXT: br label [[FOR_NEXT_5]]
-; ANALYZE-FULL: for.next.5:
-; ANALYZE-FULL-NEXT: br i1 false, label [[DO_STORE_6:%.*]], label [[FOR_NEXT_6:%.*]]
-; ANALYZE-FULL: do_store.6:
-; ANALYZE-FULL-NEXT: [[GEP_6:%.*]] = getelementptr i32, i32* [[A]], i32 6
-; ANALYZE-FULL-NEXT: store i32 6, i32* [[GEP_6]]
-; ANALYZE-FULL-NEXT: br label [[FOR_NEXT_6]]
-; ANALYZE-FULL: for.next.6:
-; ANALYZE-FULL-NEXT: br i1 false, label [[DO_STORE_7:%.*]], label [[FOR_NEXT_7:%.*]]
-; ANALYZE-FULL: do_store.7:
-; ANALYZE-FULL-NEXT: [[GEP_7:%.*]] = getelementptr i32, i32* [[A]], i32 7
-; ANALYZE-FULL-NEXT: store i32 7, i32* [[GEP_7]]
-; ANALYZE-FULL-NEXT: br label [[FOR_NEXT_7]]
-; ANALYZE-FULL: for.next.7:
-; ANALYZE-FULL-NEXT: br i1 false, label [[DO_STORE_8:%.*]], label [[FOR_NEXT_8:%.*]]
-; ANALYZE-FULL: do_store.8:
-; ANALYZE-FULL-NEXT: [[GEP_8:%.*]] = getelementptr i32, i32* [[A]], i32 8
-; ANALYZE-FULL-NEXT: store i32 8, i32* [[GEP_8]]
-; ANALYZE-FULL-NEXT: br label [[FOR_NEXT_8]]
-; ANALYZE-FULL: for.next.8:
-; ANALYZE-FULL-NEXT: ret i32 9
-;
-; DONT-ANALYZE-FULL-LABEL: @foo(
-; DONT-ANALYZE-FULL-NEXT: entry:
-; DONT-ANALYZE-FULL-NEXT: br label [[FOR_BODY:%.*]]
-; DONT-ANALYZE-FULL: for.body:
-; DONT-ANALYZE-FULL-NEXT: [[INDVAR:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INDVAR_NEXT:%.*]], [[FOR_NEXT:%.*]] ]
-; DONT-ANALYZE-FULL-NEXT: [[INDVAR_NEXT]] = add i32 [[INDVAR]], 1
-; DONT-ANALYZE-FULL-NEXT: [[CMP:%.*]] = icmp ule i32 [[INDVAR]], 20
-; DONT-ANALYZE-FULL-NEXT: tail call void @llvm.assume(i1 [[CMP]])
-; DONT-ANALYZE-FULL-NEXT: [[CMP2:%.*]] = icmp ule i32 [[INDVAR]], 3
-; DONT-ANALYZE-FULL-NEXT: br i1 [[CMP2]], label [[DO_STORE:%.*]], label [[FOR_NEXT]]
-; DONT-ANALYZE-FULL: do_store:
-; DONT-ANALYZE-FULL-NEXT: [[GEP:%.*]] = getelementptr i32, i32* [[A:%.*]], i32 [[INDVAR]]
-; DONT-ANALYZE-FULL-NEXT: store i32 [[INDVAR]], i32* [[GEP]]
-; DONT-ANALYZE-FULL-NEXT: br label [[FOR_NEXT]]
-; DONT-ANALYZE-FULL: for.next:
-; DONT-ANALYZE-FULL-NEXT: [[EXITCOND:%.*]] = icmp ne i32 [[INDVAR_NEXT]], 9
-; DONT-ANALYZE-FULL-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[LOOPEXIT:%.*]]
-; DONT-ANALYZE-FULL: loopexit:
-; DONT-ANALYZE-FULL-NEXT: [[INDVAR_NEXT_LCSSA:%.*]] = phi i32 [ [[INDVAR_NEXT]], [[FOR_NEXT]] ]
-; DONT-ANALYZE-FULL-NEXT: ret i32 [[INDVAR_NEXT_LCSSA]]
-;
-entry:
- br label %for.body
-for.body:
- %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %for.next ]
- %indvar.next = add i32 %indvar, 1
- %cmp = icmp ule i32 %indvar, 20
- tail call void @llvm.assume(i1 %cmp)
- %cmp2 = icmp ule i32 %indvar, 3
- br i1 %cmp2, label %do_store, label %for.next
-
-do_store:
- %gep = getelementptr i32, i32* %a, i32 %indvar
- store i32 %indvar, i32* %gep
- br label %for.next
-
-for.next:
- %exitcond = icmp ne i32 %indvar.next, 9
- br i1 %exitcond, label %for.body, label %loopexit
-loopexit:
- ret i32 %indvar.next
-}
diff --git a/llvm/test/Transforms/LoopUnroll/convergent.ll b/llvm/test/Transforms/LoopUnroll/convergent.ll
deleted file mode 100644
index 8417c370f84..00000000000
--- a/llvm/test/Transforms/LoopUnroll/convergent.ll
+++ /dev/null
@@ -1,179 +0,0 @@
-; RUN: opt < %s -loop-unroll -unroll-runtime -unroll-allow-partial -S | FileCheck %s
-
-declare void @f() convergent
-
-; Although this loop contains a convergent instruction, it should be
-; fully unrolled.
-;
-; CHECK-LABEL: @full_unroll(
-define i32 @full_unroll() {
-entry:
- br label %l3
-
-l3:
- %x.0 = phi i32 [ 0, %entry ], [ %inc, %l3 ]
-; CHECK: call void @f()
-; CHECK: call void @f()
-; CHECK: call void @f()
-; CHECK-NOT: call void @f()
- call void @f() ;convergent
- %inc = add nsw i32 %x.0, 1
- %exitcond = icmp eq i32 %inc, 3
- br i1 %exitcond, label %exit, label %l3
-
-exit:
- ret i32 0
-}
-
-; This loop contains a convergent instruction, but it should be partially
-; unrolled. The unroll count is the largest power of 2 that divides the
-; multiple -- 4, in this case.
-;
-; CHECK-LABEL: @runtime_unroll(
-define i32 @runtime_unroll(i32 %n) {
-entry:
- %loop_ctl = mul nsw i32 %n, 12
- br label %l3
-
-l3:
- %x.0 = phi i32 [ 0, %entry ], [ %inc, %l3 ]
-; CHECK: call void @f()
-; CHECK: call void @f()
-; CHECK: call void @f()
-; CHECK: call void @f()
-; CHECK-NOT: call void @f()
- call void @f() convergent
- %inc = add nsw i32 %x.0, 1
- %exitcond = icmp eq i32 %inc, %loop_ctl
- br i1 %exitcond, label %exit, label %l3
-
-exit:
- ret i32 0
-}
-
-; This loop contains a convergent instruction, so its partial unroll
-; count must divide its trip multiple. This overrides its unroll
-; pragma -- we unroll exactly 8 times, even though 16 is requested.
-; CHECK-LABEL: @pragma_unroll
-define i32 @pragma_unroll(i32 %n) {
-entry:
- %loop_ctl = mul nsw i32 %n, 24
- br label %l3, !llvm.loop !0
-
-l3:
- %x.0 = phi i32 [ 0, %entry ], [ %inc, %l3 ]
-; CHECK: call void @f()
-; CHECK: call void @f()
-; CHECK: call void @f()
-; CHECK: call void @f()
-; CHECK: call void @f()
-; CHECK: call void @f()
-; CHECK: call void @f()
-; CHECK: call void @f()
-; CHECK-NOT: call void @f()
- call void @f() convergent
- %inc = add nsw i32 %x.0, 1
- %exitcond = icmp eq i32 %inc, %loop_ctl
- br i1 %exitcond, label %exit, label %l3, !llvm.loop !0
-
-exit:
- ret i32 0
-}
-
-; This loop contains a convergent instruction. Since the pragma loop unroll
-; count 2 divides trip count 4. The loop unroll should respect the pragma.
-; CHECK-LABEL: @pragma_unroll_divisible_trip_count
-define void @pragma_unroll_divisible_trip_count() {
-entry:
- br label %l3, !llvm.loop !1
-
-l3:
- %x.0 = phi i32 [ 0, %entry ], [ %inc, %l3 ]
-; CHECK: call void @f()
-; CHECK: call void @f()
-; CHECK-NOT: call void @f()
- call void @f() convergent
- %inc = add nsw i32 %x.0, 1
- %exitcond = icmp eq i32 %inc, 4
- br i1 %exitcond, label %exit, label %l3, !llvm.loop !1
-
-exit:
- ret void
-}
-
-; This loop contains a convergent instruction. Since the pragma loop unroll
-; count 2 divides trip multiple 2. The loop unroll should respect the pragma.
-; CHECK-LABEL: @pragma_unroll_divisible_trip_multiple
-define i32 @pragma_unroll_divisible_trip_multiple(i32 %n) {
-entry:
- %loop_ctl = mul nsw i32 %n, 2
- br label %l3, !llvm.loop !1
-
-l3:
- %x.0 = phi i32 [ 0, %entry ], [ %inc, %l3 ]
-; CHECK: call void @f()
-; CHECK: call void @f()
-; CHECK-NOT: call void @f()
- call void @f() convergent
- %inc = add nsw i32 %x.0, 1
- %exitcond = icmp eq i32 %inc, %loop_ctl
- br i1 %exitcond, label %exit, label %l3, !llvm.loop !1
-
-exit:
- ret i32 0
-}
-
-; This loop contains a convergent instruction. Since the pragma loop unroll
-; count 2 is unknown to divide runtime trip count, the loop is not unrolled
-; since remainder is forbidden for unrolling convergent loop.
-; ToDo: Forbidding remainder for unrolling convergent loop may be relaxed
-; in the future.
-; CHECK-LABEL: @pragma_unroll_indivisible_runtime_trip_count
-define i32 @pragma_unroll_indivisible_runtime_trip_count(i32 %n) {
-entry:
- br label %l3, !llvm.loop !1
-
-l3:
- %x.0 = phi i32 [ 0, %entry ], [ %inc, %l3 ]
-; CHECK: call void @f()
-; CHECK-NOT: call void @f()
- call void @f() convergent
- %inc = add nsw i32 %x.0, 1
- %exitcond = icmp eq i32 %inc, %n
- br i1 %exitcond, label %exit, label %l3, !llvm.loop !1
-
-exit:
- ret i32 0
-}
-
-; This loop contains a convergent instruction. Since the pragma loop unroll
-; count 2 does not divide trip count 5, the loop is not unrolled by 2
-; since remainder is forbidden for unrolling convergent loop. Instead, the
-; loop gets fully unrolled.
-; ToDo: Forbidding remainder for unrolling convergent loop may be relaxed
-; in the future.
-; CHECK-LABEL: @pragma_unroll_indivisible_trip_count
-define i32 @pragma_unroll_indivisible_trip_count() {
-entry:
- br label %l3, !llvm.loop !1
-
-l3:
- %x.0 = phi i32 [ 0, %entry ], [ %inc, %l3 ]
-; CHECK: call void @f()
-; CHECK: call void @f()
-; CHECK: call void @f()
-; CHECK: call void @f()
-; CHECK: call void @f()
-; CHECK-NOT: call void @f()
- call void @f() convergent
- %inc = add nsw i32 %x.0, 1
- %exitcond = icmp eq i32 %inc, 5
- br i1 %exitcond, label %exit, label %l3, !llvm.loop !1
-
-exit:
- ret i32 0
-}
-
-!0 = !{!0, !{!"llvm.loop.unroll.count", i32 16}}
-!1 = !{!1, !{!"llvm.loop.unroll.count", i32 2}}
-
diff --git a/llvm/test/Transforms/LoopUnroll/debug-info.ll b/llvm/test/Transforms/LoopUnroll/debug-info.ll
deleted file mode 100644
index 646ca441e5a..00000000000
--- a/llvm/test/Transforms/LoopUnroll/debug-info.ll
+++ /dev/null
@@ -1,75 +0,0 @@
-; RUN: opt %s -S -o - -loop-unroll | FileCheck %s
-; generated at -O3 from:
-; void f() {
-; for (int i = 1; i <=32; i <<=2 )
-; bar(i>>1);
-; }
-source_filename = "/tmp/loop.c"
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-apple-macosx10.13.0"
-
-; Function Attrs: nounwind ssp uwtable
-define void @f() local_unnamed_addr #0 !dbg !8 {
-entry:
- tail call void @llvm.dbg.value(metadata i32 1, metadata !12, metadata !DIExpression()), !dbg !15
- br label %for.body, !dbg !16
-
-for.cond.cleanup: ; preds = %for.body
- ret void, !dbg !17
-
-for.body: ; preds = %entry, %for.body
- %i.04 = phi i32 [ 1, %entry ], [ %shl, %for.body ]
- tail call void @llvm.dbg.value(metadata i32 %i.04, metadata !12, metadata !DIExpression()), !dbg !15
- %shr = ashr i32 %i.04, 1, !dbg !18
-
- ; The loop gets unrolled entirely.
- ; CHECK: call void @llvm.dbg.value(metadata i32 1, metadata !12, metadata !DIExpression()), !dbg !15
- ; CHECK: call void @llvm.dbg.value(metadata i32 4, metadata !12, metadata !DIExpression()), !dbg !15
- ; CHECK: call void @llvm.dbg.value(metadata i32 16, metadata !12, metadata !DIExpression()), !dbg !15
- ; CHECK: call void @llvm.dbg.value(metadata i32 64, metadata !12, metadata !DIExpression()), !dbg !15
-
- %call = tail call i32 (i32, ...) bitcast (i32 (...)* @bar to i32 (i32, ...)*)(i32 %shr) #3, !dbg !20
- %shl = shl i32 %i.04, 2, !dbg !21
- tail call void @llvm.dbg.value(metadata i32 %shl, metadata !12, metadata !DIExpression()), !dbg !15
- %cmp = icmp slt i32 %shl, 33, !dbg !22
- br i1 %cmp, label %for.body, label %for.cond.cleanup, !dbg !16, !llvm.loop !23
-}
-
-declare i32 @bar(...) local_unnamed_addr
-
-; Function Attrs: nounwind readnone speculatable
-declare void @llvm.dbg.value(metadata, metadata, metadata) #2
-
-attributes #0 = { nounwind ssp uwtable }
-attributes #2 = { nounwind readnone speculatable }
-attributes #3 = { nounwind }
-
-!llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!3, !4, !5, !6}
-!llvm.ident = !{!7}
-
-!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 (trunk 317113) (llvm/trunk 317122)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
-!1 = !DIFile(filename: "/tmp/loop.c", directory: "/Data/llvm")
-!2 = !{}
-!3 = !{i32 2, !"Dwarf Version", i32 4}
-!4 = !{i32 2, !"Debug Info Version", i32 3}
-!5 = !{i32 1, !"wchar_size", i32 4}
-!6 = !{i32 7, !"PIC Level", i32 2}
-!7 = !{!"clang version 6.0.0 (trunk 317113) (llvm/trunk 317122)"}
-!8 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !9, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0, retainedNodes: !11)
-!9 = !DISubroutineType(types: !10)
-!10 = !{null}
-!11 = !{!12}
-!12 = !DILocalVariable(name: "i", scope: !13, file: !1, line: 2, type: !14)
-!13 = distinct !DILexicalBlock(scope: !8, file: !1, line: 2, column: 3)
-!14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
-!15 = !DILocation(line: 2, column: 12, scope: !13)
-!16 = !DILocation(line: 2, column: 3, scope: !13)
-!17 = !DILocation(line: 4, column: 1, scope: !8)
-!18 = !DILocation(line: 3, column: 10, scope: !19)
-!19 = distinct !DILexicalBlock(scope: !13, file: !1, line: 2, column: 3)
-!20 = !DILocation(line: 3, column: 5, scope: !19)
-!21 = !DILocation(line: 2, column: 29, scope: !19)
-!22 = !DILocation(line: 2, column: 21, scope: !19)
-!23 = distinct !{!23, !16, !24}
-!24 = !DILocation(line: 3, column: 13, scope: !13)
diff --git a/llvm/test/Transforms/LoopUnroll/disable-loop-unrolling_forced.ll b/llvm/test/Transforms/LoopUnroll/disable-loop-unrolling_forced.ll
deleted file mode 100644
index 9a0900df1a1..00000000000
--- a/llvm/test/Transforms/LoopUnroll/disable-loop-unrolling_forced.ll
+++ /dev/null
@@ -1,30 +0,0 @@
-; RUN: opt -disable-loop-unrolling -O1 -S < %s | FileCheck %s
-;
-; Check loop unrolling metadata is honored despite automatic unrolling
-; being disabled in the pass builder.
-;
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-
-; CHECK-LABEL: @forced(
-; CHECK: load
-; CHECK: load
-define void @forced(i32* nocapture %a) {
-entry:
- br label %for.body
-
-for.body:
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %arrayidx, align 4
- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, 64
- br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !0
-
-for.end:
- ret void
-}
-
-!0 = distinct !{!0, !{!"llvm.loop.unroll.enable"},
- !{!"llvm.loop.unroll.count", i32 2}}
diff --git a/llvm/test/Transforms/LoopUnroll/disable_nonforced.ll b/llvm/test/Transforms/LoopUnroll/disable_nonforced.ll
deleted file mode 100644
index 0678cca44d9..00000000000
--- a/llvm/test/Transforms/LoopUnroll/disable_nonforced.ll
+++ /dev/null
@@ -1,29 +0,0 @@
-; RUN: opt -loop-unroll -unroll-count=2 -S < %s | FileCheck %s
-;
-; Check that the disable_nonforced loop property is honored by
-; loop unroll.
-;
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-
-; CHECK-LABEL: @disable_nonforced(
-; CHECK: load
-; CHECK-NOT: load
-define void @disable_nonforced(i32* nocapture %a) {
-entry:
- br label %for.body
-
-for.body:
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %arrayidx, align 4
- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, 64
- br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !0
-
-for.end:
- ret void
-}
-
-!0 = !{!0, !{!"llvm.loop.disable_nonforced"}}
diff --git a/llvm/test/Transforms/LoopUnroll/disable_nonforced_count.ll b/llvm/test/Transforms/LoopUnroll/disable_nonforced_count.ll
deleted file mode 100644
index 73517e5ffe7..00000000000
--- a/llvm/test/Transforms/LoopUnroll/disable_nonforced_count.ll
+++ /dev/null
@@ -1,30 +0,0 @@
-; RUN: opt -loop-unroll -unroll-count=2 -S < %s | FileCheck %s
-;
-; Check whether the llvm.loop.unroll.count loop property overrides
-; llvm.loop.disable_nonforced.
-;
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-
-; CHECK-LABEL: @disable_nonforced_count(
-; CHECK: store
-; CHECK: store
-; CHECK-NOT: store
-define void @disable_nonforced_count(i32* nocapture %a) {
-entry:
- br label %for.body
-
-for.body:
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %arrayidx, align 4
- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, 64
- br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !0
-
-for.end:
- ret void
-}
-
-!0 = !{!0, !{!"llvm.loop.disable_nonforced"}, !{!"llvm.loop.unroll.count", i32 2}}
diff --git a/llvm/test/Transforms/LoopUnroll/disable_nonforced_enable.ll b/llvm/test/Transforms/LoopUnroll/disable_nonforced_enable.ll
deleted file mode 100644
index 75bbc3ed149..00000000000
--- a/llvm/test/Transforms/LoopUnroll/disable_nonforced_enable.ll
+++ /dev/null
@@ -1,30 +0,0 @@
-; RUN: opt -loop-unroll -unroll-count=2 -S < %s | FileCheck %s
-;
-; Check that the llvm.loop.unroll.enable loop property overrides
-; llvm.loop.disable_nonforced.
-;
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-
-; CHECK-LABEL: @disable_nonforced_enable(
-; CHECK: store
-; CHECK: store
-; CHECK-NOT: store
-define void @disable_nonforced_enable(i32* nocapture %a) {
-entry:
- br label %for.body
-
-for.body:
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %arrayidx, align 4
- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, 64
- br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !0
-
-for.end:
- ret void
-}
-
-!0 = !{!0, !{!"llvm.loop.disable_nonforced"}, !{!"llvm.loop.unroll.enable"}}
diff --git a/llvm/test/Transforms/LoopUnroll/disable_nonforced_full.ll b/llvm/test/Transforms/LoopUnroll/disable_nonforced_full.ll
deleted file mode 100644
index 447108b257d..00000000000
--- a/llvm/test/Transforms/LoopUnroll/disable_nonforced_full.ll
+++ /dev/null
@@ -1,32 +0,0 @@
-; RUN: opt -loop-unroll -S < %s | FileCheck %s
-;
-; Check that the llvm.loop.unroll.full loop property overrides
-; llvm.loop.disable_nonforced.
-;
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-
-; CHECK-LABEL: @disable_nonforced_full(
-; CHECK: store
-; CHECK: store
-; CHECK: store
-; CHECK: store
-; CHECK-NOT: store
-define void @disable_nonforced_full(i32* nocapture %a) {
-entry:
- br label %for.body
-
-for.body:
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %arrayidx, align 4
- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, 4
- br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !0
-
-for.end:
- ret void
-}
-
-!0 = !{!0, !{!"llvm.loop.disable_nonforced"}, !{!"llvm.loop.unroll.full"}}
diff --git a/llvm/test/Transforms/LoopUnroll/ephemeral.ll b/llvm/test/Transforms/LoopUnroll/ephemeral.ll
deleted file mode 100644
index d16eba7a964..00000000000
--- a/llvm/test/Transforms/LoopUnroll/ephemeral.ll
+++ /dev/null
@@ -1,44 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-threshold=50 | FileCheck %s
-
-; Make sure this loop is completely unrolled...
-; CHECK-LABEL: @test1
-; CHECK: for.body:
-; CHECK-NOT: for.end:
-
-define i32 @test1(i32* nocapture %a) nounwind uwtable readonly {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %sum.01 = phi i32 [ 0, %entry ], [ %add, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
-
- ; This loop will be completely unrolled, even with these extra instructions,
- ; but only because they're ephemeral (and, thus, free).
- %1 = add nsw i32 %0, 2
- %2 = add nsw i32 %1, 4
- %3 = add nsw i32 %2, 4
- %4 = add nsw i32 %3, 4
- %5 = add nsw i32 %4, 4
- %6 = add nsw i32 %5, 4
- %7 = add nsw i32 %6, 4
- %8 = add nsw i32 %7, 4
- %9 = add nsw i32 %8, 4
- %10 = add nsw i32 %9, 4
- %ca = icmp sgt i32 %10, -7
- call void @llvm.assume(i1 %ca)
-
- %add = add nsw i32 %0, %sum.01
- %indvars.iv.next = add i64 %indvars.iv, 1
- %lftr.wideiv = trunc i64 %indvars.iv.next to i32
- %exitcond = icmp eq i32 %lftr.wideiv, 5
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %for.body
- ret i32 %add
-}
-
-declare void @llvm.assume(i1) nounwind
-
diff --git a/llvm/test/Transforms/LoopUnroll/epilog_const_phi.ll b/llvm/test/Transforms/LoopUnroll/epilog_const_phi.ll
deleted file mode 100644
index 22e52576094..00000000000
--- a/llvm/test/Transforms/LoopUnroll/epilog_const_phi.ll
+++ /dev/null
@@ -1,65 +0,0 @@
-; RUN: opt -S -loop-unroll -unroll-runtime < %s | FileCheck %s
-
-; Epilog unroll allows to keep PHI constant value.
-; For the test this means that after unroll XOR could be deleted.
-; Check that we do epilogue reminder here.
-
-; CHECK-LABEL: const_phi_val
-; CHECK: for.body.epil
-
-; Function Attrs: norecurse nounwind uwtable
-define void @const_phi_val(i32 %i0, i32* nocapture %a) {
-entry:
- %cmp6 = icmp slt i32 %i0, 1000
- br i1 %cmp6, label %for.body.preheader, label %for.end
-
-for.body.preheader: ; preds = %entry
- %tmp = sext i32 %i0 to i64
- br label %for.body
-
-for.body: ; preds = %for.body, %for.body.preheader
- %indvars.iv = phi i64 [ %tmp, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
- %s.08 = phi i32 [ 0, %for.body.preheader ], [ %xor, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- store i32 %s.08, i32* %arrayidx, align 4
- %xor = xor i32 %s.08, 1
- %indvars.iv.next = add nsw i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, 1000
- br i1 %exitcond, label %for.end.loopexit, label %for.body
-
-for.end.loopexit: ; preds = %for.body
- br label %for.end
-
-for.end: ; preds = %for.end.loopexit, %entry
- ret void
-}
-
-; When there is no phi with const coming from preheader,
-; there is no need to do epilogue unrolling.
-
-; CHECK-LABEL: var_phi_val
-; CHECK: for.body.prol
-
-; Function Attrs: norecurse nounwind uwtable
-define void @var_phi_val(i32 %i0, i32* nocapture %a) {
-entry:
- %cmp6 = icmp slt i32 %i0, 1000
- br i1 %cmp6, label %for.body.preheader, label %for.end
-
-for.body.preheader: ; preds = %entry
- %tmp = sext i32 %i0 to i64
- br label %for.body
-
-for.body: ; preds = %for.body, %for.body.preheader
- %indvars.iv = phi i64 [ %tmp, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %indvars.iv.next = add nsw i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, 1000
- br i1 %exitcond, label %for.end.loopexit, label %for.body
-
-for.end.loopexit: ; preds = %for.body
- br label %for.end
-
-for.end: ; preds = %for.end.loopexit, %entry
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/followup.ll b/llvm/test/Transforms/LoopUnroll/followup.ll
deleted file mode 100644
index 8d26159563d..00000000000
--- a/llvm/test/Transforms/LoopUnroll/followup.ll
+++ /dev/null
@@ -1,63 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-count=2 | FileCheck %s -check-prefixes=COUNT,COMMON
-; RUN: opt < %s -S -loop-unroll -unroll-runtime=true -unroll-runtime-epilog=true | FileCheck %s -check-prefixes=EPILOG,COMMON
-; RUN: opt < %s -S -loop-unroll -unroll-runtime=true -unroll-runtime-epilog=false | FileCheck %s -check-prefixes=PROLOG,COMMON
-;
-; Check that followup-attributes are applied after LoopUnroll.
-;
-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"
-
-define i32 @test(i32* nocapture %a, i32 %n) nounwind uwtable readonly {
-entry:
- %cmp1 = icmp eq i32 %n, 0
- br i1 %cmp1, label %for.end, label %for.body
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
- %sum.02 = phi i32 [ %add, %for.body ], [ 0, %entry ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %add = add nsw i32 %0, %sum.02
- %indvars.iv.next = add i64 %indvars.iv, 1
- %lftr.wideiv = trunc i64 %indvars.iv.next to i32
- %exitcond = icmp eq i32 %lftr.wideiv, %n
- br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !4
-
-for.end: ; preds = %for.body, %entry
- %sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
- ret i32 %sum.0.lcssa
-}
-
-!1 = !{!"llvm.loop.unroll.followup_all", !{!"FollowupAll"}}
-!2 = !{!"llvm.loop.unroll.followup_unrolled", !{!"FollowupUnrolled"}}
-!3 = !{!"llvm.loop.unroll.followup_remainder", !{!"FollowupRemainder"}}
-!4 = distinct !{!4, !1, !2, !3}
-
-
-; COMMON-LABEL: @test(
-
-
-; COUNT: br i1 %exitcond.1, label %for.end.loopexit, label %for.body, !llvm.loop ![[LOOP:[0-9]+]]
-
-; COUNT: ![[FOLLOWUP_ALL:[0-9]+]] = !{!"FollowupAll"}
-; COUNT: ![[FOLLOWUP_UNROLLED:[0-9]+]] = !{!"FollowupUnrolled"}
-; COUNT: ![[LOOP]] = distinct !{![[LOOP]], ![[FOLLOWUP_ALL]], ![[FOLLOWUP_UNROLLED]]}
-
-
-; EPILOG: br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa.loopexit, label %for.body, !llvm.loop ![[LOOP_0:[0-9]+]]
-; EPILOG: br i1 %epil.iter.cmp, label %for.body.epil, label %for.end.loopexit.epilog-lcssa, !llvm.loop ![[LOOP_2:[0-9]+]]
-
-; EPILOG: ![[LOOP_0]] = distinct !{![[LOOP_0]], ![[FOLLOWUP_ALL:[0-9]+]], ![[FOLLOWUP_UNROLLED:[0-9]+]]}
-; EPILOG: ![[FOLLOWUP_ALL]] = !{!"FollowupAll"}
-; EPILOG: ![[FOLLOWUP_UNROLLED]] = !{!"FollowupUnrolled"}
-; EPILOG: ![[LOOP_2]] = distinct !{![[LOOP_2]], ![[FOLLOWUP_ALL]], ![[FOLLOWUP_REMAINDER:[0-9]+]]}
-; EPILOG: ![[FOLLOWUP_REMAINDER]] = !{!"FollowupRemainder"}
-
-
-; PROLOG: br i1 %prol.iter.cmp, label %for.body.prol, label %for.body.prol.loopexit.unr-lcssa, !llvm.loop ![[LOOP_0:[0-9]+]]
-; PROLOG: br i1 %exitcond.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop ![[LOOP_2:[0-9]+]]
-
-; PROLOG: ![[LOOP_0]] = distinct !{![[LOOP_0]], ![[FOLLOWUP_ALL:[0-9]+]], ![[FOLLOWUP_REMAINDER:[0-9]+]]}
-; PROLOG: ![[FOLLOWUP_ALL]] = !{!"FollowupAll"}
-; PROLOG: ![[FOLLOWUP_REMAINDER]] = !{!"FollowupRemainder"}
-; PROLOG: ![[LOOP_2]] = distinct !{![[LOOP_2]], ![[FOLLOWUP_ALL]], ![[FOLLOWUP_UNROLLED:[0-9]+]]}
-; PROLOG: ![[FOLLOWUP_UNROLLED]] = !{!"FollowupUnrolled"}
diff --git a/llvm/test/Transforms/LoopUnroll/full-unroll-bad-cost.ll b/llvm/test/Transforms/LoopUnroll/full-unroll-bad-cost.ll
deleted file mode 100644
index 9bbd21accc8..00000000000
--- a/llvm/test/Transforms/LoopUnroll/full-unroll-bad-cost.ll
+++ /dev/null
@@ -1,59 +0,0 @@
-; RUN: opt -S -loop-unroll < %s | FileCheck %s
-; RUN: opt < %s -passes='require<opt-remark-emit>,loop(unroll-full)' -S | FileCheck %s
-
-; LLVM should not try to fully unroll this loop.
-
-declare void @f()
-declare void @g()
-declare void @h()
-
-define void @trivial_loop() {
-; CHECK-LABEL: @trivial_loop(
- entry:
- br label %loop
-
- loop:
- %idx = phi i32 [ 0, %entry ], [ %idx.inc, %loop ]
- %idx.inc = add i32 %idx, 1
- call void @f()
- call void @g()
- call void @h()
- call void @f()
- call void @g()
- call void @h()
- call void @f()
- call void @g()
- call void @h()
- call void @f()
- call void @g()
- call void @h()
- call void @f()
- call void @g()
- call void @h()
- %be = icmp slt i32 %idx, 268435456
- br i1 %be, label %loop, label %exit
-
-; CHECK: loop:
-; CHECK-NEXT: %idx = phi i32 [ 0, %entry ], [ %idx.inc, %loop ]
-; CHECK-NEXT: %idx.inc = add i32 %idx, 1
-; CHECK-NEXT: call void @f()
-; CHECK-NEXT: call void @g()
-; CHECK-NEXT: call void @h()
-; CHECK-NEXT: call void @f()
-; CHECK-NEXT: call void @g()
-; CHECK-NEXT: call void @h()
-; CHECK-NEXT: call void @f()
-; CHECK-NEXT: call void @g()
-; CHECK-NEXT: call void @h()
-; CHECK-NEXT: call void @f()
-; CHECK-NEXT: call void @g()
-; CHECK-NEXT: call void @h()
-; CHECK-NEXT: call void @f()
-; CHECK-NEXT: call void @g()
-; CHECK-NEXT: call void @h()
-; CHECK-NEXT: %be = icmp slt i32 %idx, 268435456
-; CHECK-NEXT: br i1 %be, label %loop, label %exit
-
- exit:
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/full-unroll-crashers.ll b/llvm/test/Transforms/LoopUnroll/full-unroll-crashers.ll
deleted file mode 100644
index d83e56635e8..00000000000
--- a/llvm/test/Transforms/LoopUnroll/full-unroll-crashers.ll
+++ /dev/null
@@ -1,225 +0,0 @@
-; Check that we don't crash on corner cases.
-; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=1 -unroll-max-percent-threshold-boost=200 -o /dev/null
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(unroll-full)' -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=1 -unroll-max-percent-threshold-boost=200 -o /dev/null
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-
-@known_constant = internal unnamed_addr constant [10 x i32] [i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1], align 16
-
-define void @foo1() {
-entry:
- br label %for.body
-
-for.body:
- %phi = phi i64 [ 0, %entry ], [ %inc, %for.body ]
- %idx = zext i32 undef to i64
- %add.ptr = getelementptr inbounds i64, i64* null, i64 %idx
- %inc = add nuw nsw i64 %phi, 1
- %cmp = icmp ult i64 %inc, 999
- br i1 %cmp, label %for.body, label %for.exit
-
-for.exit:
- ret void
-}
-
-define void @foo2() {
-entry:
- br label %for.body
-
-for.body:
- %phi = phi i64 [ 0, %entry ], [ %inc, %for.body ]
- %x = getelementptr i32, <4 x i32*> undef, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
- %inc = add nuw nsw i64 %phi, 1
- %cmp = icmp ult i64 %inc, 999
- br i1 %cmp, label %for.body, label %for.exit
-
-for.exit:
- ret void
-}
-
-define void @cmp_undef() {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.inc, %entry
- %iv.0 = phi i64 [ 0, %entry ], [ %iv.1, %for.inc ]
- %arrayidx1 = getelementptr inbounds [10 x i32], [10 x i32]* @known_constant, i64 0, i64 %iv.0
- %x1 = load i32, i32* %arrayidx1, align 4
- %cmp = icmp eq i32 %x1, undef
- br i1 %cmp, label %if.then, label %for.inc
-
-if.then: ; preds = %for.body
- br label %for.inc
-
-for.inc: ; preds = %for.body, %if.then
- %iv.1 = add nuw nsw i64 %iv.0, 1
- %exitcond = icmp eq i64 %iv.1, 10
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %for.inc
- ret void
-}
-
-define void @switch() {
-entry:
- br label %for.body
-
-for.body:
- %iv.0 = phi i64 [ 0, %entry ], [ %iv.1, %for.inc ]
- %arrayidx1 = getelementptr inbounds [10 x i32], [10 x i32]* @known_constant, i64 0, i64 %iv.0
- %x1 = load i32, i32* %arrayidx1, align 4
- switch i32 %x1, label %l1 [
- ]
-
-l1:
- %x2 = add i32 %x1, 2
- br label %for.inc
-
-for.inc:
- %iv.1 = add nuw nsw i64 %iv.0, 1
- %exitcond = icmp eq i64 %iv.1, 10
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end:
- ret void
-}
-
-define <4 x i32> @vec_load() {
-entry:
- br label %for.body
-
-for.body:
- %phi = phi i64 [ 0, %entry ], [ %inc, %for.body ]
- %vec_phi = phi <4 x i32> [ <i32 0, i32 0, i32 0, i32 0>, %entry ], [ %r, %for.body ]
- %arrayidx = getelementptr inbounds [10 x i32], [10 x i32]* @known_constant, i64 0, i64 %phi
- %bc = bitcast i32* %arrayidx to <4 x i32>*
- %x = load <4 x i32>, < 4 x i32>* %bc, align 4
- %r = add <4 x i32> %x, %vec_phi
- %inc = add nuw nsw i64 %phi, 1
- %cmp = icmp ult i64 %inc, 999
- br i1 %cmp, label %for.body, label %for.exit
-
-for.exit:
- ret <4 x i32> %r
-}
-
-define void @ptrtoint_cast() optsize {
-entry:
- br label %for.body
-
-for.body:
- br i1 true, label %for.inc, label %if.then
-
-if.then:
- %arraydecay = getelementptr inbounds [1 x i32], [1 x i32]* null, i64 0, i64 0
- %x = ptrtoint i32* %arraydecay to i64
- br label %for.inc
-
-for.inc:
- br i1 false, label %for.body, label %for.cond.cleanup
-
-for.cond.cleanup:
- ret void
-}
-
-define void @ptrtoint_cast2() {
-entry:
- br i1 false, label %for.body.lr.ph, label %exit
-
-for.body.lr.ph:
- br label %for.body
-
-for.body:
- %iv = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
- %offset = getelementptr inbounds float, float* null, i32 3
- %bc = bitcast float* %offset to i64*
- %inc = add nuw nsw i32 %iv, 1
- br i1 false, label %for.body, label %exit
-
-exit:
- ret void
-}
-
-@i = external global i32, align 4
-
-define void @folded_not_to_constantint() {
-entry:
- br label %for.body
-
-for.body:
- %iv = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
- %m = phi i32* [ @i, %entry ], [ %m, %for.inc ]
- br i1 undef, label %if.else, label %if.then
-
-if.then:
- unreachable
-
-if.else:
- %cmp = icmp ult i32* %m, null
- br i1 %cmp, label %cond.false, label %for.inc
-
-cond.false:
- unreachable
-
-for.inc:
- %inc = add nuw nsw i32 %iv, 1
- %cmp2 = icmp ult i32 %inc, 10
- br i1 %cmp2, label %for.body, label %for.end
-
-for.end:
- ret void
-}
-
-define void @index_too_large() {
-entry:
- br label %for.body
-
-for.body:
- %iv = phi i64 [ -73631599, %entry ], [ %iv.next, %for.inc ]
- br i1 undef, label %for.body2, label %for.inc
-
-for.body2:
- %idx = getelementptr inbounds [10 x i32], [10 x i32]* @known_constant, i64 0, i64 %iv
- %x = load i32, i32* %idx, align 1
- br label %for.inc
-
-for.inc:
- %iv.next = add nsw i64 %iv, -1
- br i1 undef, label %for.body, label %for.end
-
-for.end:
- ret void
-}
-
-define void @cmp_type_mismatch() {
-entry:
- br label %for.header
-
-for.header:
- br label %for.body
-
-for.body:
- %d = phi i32* [ null, %for.header ]
- %cmp = icmp eq i32* %d, null
- br i1 undef, label %for.end, label %for.header
-
-for.end:
- ret void
-}
-
-define void @load_type_mismatch() {
-entry:
- br label %for.body
-
-for.body:
- %iv.0 = phi i64 [ 0, %entry ], [ %iv.1, %for.body ]
- %arrayidx1 = getelementptr inbounds [10 x i32], [10 x i32]* @known_constant, i64 0, i64 %iv.0
- %bc = bitcast i32* %arrayidx1 to i64*
- %x1 = load i64, i64* %bc, align 4
- %x2 = add i64 10, %x1
- %iv.1 = add nuw nsw i64 %iv.0, 1
- %exitcond = icmp eq i64 %iv.1, 10
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end:
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/full-unroll-heuristics-2.ll b/llvm/test/Transforms/LoopUnroll/full-unroll-heuristics-2.ll
deleted file mode 100644
index a143056affe..00000000000
--- a/llvm/test/Transforms/LoopUnroll/full-unroll-heuristics-2.ll
+++ /dev/null
@@ -1,90 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=10 -unroll-max-percent-threshold-boost=200 | FileCheck %s
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(unroll-full)' -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=10 -unroll-max-percent-threshold-boost=200 | FileCheck %s
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-
-@unknown_global = internal unnamed_addr global [9 x i32] [i32 0, i32 -1, i32 0, i32 -1, i32 5, i32 -1, i32 0, i32 -1, i32 0], align 16
-@weak_constant = weak unnamed_addr constant [9 x i32] [i32 0, i32 -1, i32 0, i32 -1, i32 5, i32 -1, i32 0, i32 -1, i32 0], align 16
-
-; Though @unknown_global is initialized with constant values, we can't consider
-; it as a constant, so we shouldn't unroll the loop.
-; CHECK-LABEL: @foo
-; CHECK: %array_const_idx = getelementptr inbounds [9 x i32], [9 x i32]* @unknown_global, i64 0, i64 %iv
-define i32 @foo(i32* noalias nocapture readonly %src) {
-entry:
- br label %loop
-
-loop: ; preds = %loop, %entry
- %iv = phi i64 [ 0, %entry ], [ %inc, %loop ]
- %r = phi i32 [ 0, %entry ], [ %add, %loop ]
- %arrayidx = getelementptr inbounds i32, i32* %src, i64 %iv
- %src_element = load i32, i32* %arrayidx, align 4
- %array_const_idx = getelementptr inbounds [9 x i32], [9 x i32]* @unknown_global, i64 0, i64 %iv
- %const_array_element = load i32, i32* %array_const_idx, align 4
- %mul = mul nsw i32 %src_element, %const_array_element
- %add = add nsw i32 %mul, %r
- %inc = add nuw nsw i64 %iv, 1
- %exitcond86.i = icmp eq i64 %inc, 9
- br i1 %exitcond86.i, label %loop.end, label %loop
-
-loop.end: ; preds = %loop
- %r.lcssa = phi i32 [ %r, %loop ]
- ret i32 %r.lcssa
-}
-
-; Similarly, we can't consider 'weak' symbols as a known constant value, so we
-; shouldn't unroll the loop.
-; CHECK-LABEL: @foo2
-; CHECK: %array_const_idx = getelementptr inbounds [9 x i32], [9 x i32]* @weak_constant, i64 0, i64 %iv
-define i32 @foo2(i32* noalias nocapture readonly %src) {
-entry:
- br label %loop
-
-loop: ; preds = %loop, %entry
- %iv = phi i64 [ 0, %entry ], [ %inc, %loop ]
- %r = phi i32 [ 0, %entry ], [ %add, %loop ]
- %arrayidx = getelementptr inbounds i32, i32* %src, i64 %iv
- %src_element = load i32, i32* %arrayidx, align 4
- %array_const_idx = getelementptr inbounds [9 x i32], [9 x i32]* @weak_constant, i64 0, i64 %iv
- %const_array_element = load i32, i32* %array_const_idx, align 4
- %mul = mul nsw i32 %src_element, %const_array_element
- %add = add nsw i32 %mul, %r
- %inc = add nuw nsw i64 %iv, 1
- %exitcond86.i = icmp eq i64 %inc, 9
- br i1 %exitcond86.i, label %loop.end, label %loop
-
-loop.end: ; preds = %loop
- %r.lcssa = phi i32 [ %r, %loop ]
- ret i32 %r.lcssa
-}
-
-; In this case the loaded value is used only to control branch.
-; If we missed that, we could've thought that it's unused and unrolling would
-; clean up almost entire loop. Make sure that we do not unroll such loop.
-; CHECK-LABEL: @foo3
-; CHECK: br i1 %exitcond, label %loop.end, label %loop.header
-define i32 @foo3(i32* noalias nocapture readonly %src) {
-entry:
- br label %loop.header
-
-loop.header:
- %iv = phi i64 [ 0, %entry ], [ %inc, %loop.latch ]
- %r1 = phi i32 [ 0, %entry ], [ %r3, %loop.latch ]
- %arrayidx = getelementptr inbounds i32, i32* %src, i64 %iv
- %src_element = load i32, i32* %arrayidx, align 4
- %cmp = icmp eq i32 0, %src_element
- br i1 %cmp, label %loop.if, label %loop.latch
-
-loop.if:
- %r2 = add i32 %r1, 1
- br label %loop.latch
-
-loop.latch:
- %r3 = phi i32 [%r1, %loop.header], [%r2, %loop.if]
- %inc = add nuw nsw i64 %iv, 1
- %exitcond = icmp eq i64 %inc, 9
- br i1 %exitcond, label %loop.end, label %loop.header
-
-loop.end:
- %r.lcssa = phi i32 [ %r3, %loop.latch ]
- ret i32 %r.lcssa
-}
diff --git a/llvm/test/Transforms/LoopUnroll/full-unroll-heuristics-cmp.ll b/llvm/test/Transforms/LoopUnroll/full-unroll-heuristics-cmp.ll
deleted file mode 100644
index e65f794286e..00000000000
--- a/llvm/test/Transforms/LoopUnroll/full-unroll-heuristics-cmp.ll
+++ /dev/null
@@ -1,79 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=100 -unroll-threshold=10 -unroll-max-percent-threshold-boost=200 | FileCheck %s
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(unroll-full)' -unroll-max-iteration-count-to-analyze=100 -unroll-threshold=10 -unroll-max-percent-threshold-boost=200 | FileCheck %s
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-
-@known_constant = internal unnamed_addr constant [10 x i32] [i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1], align 16
-
-; If we can figure out result of comparison on each iteration, we can resolve
-; the depending branch. That means, that the unrolled version of the loop would
-; have less code, because we don't need not-taken basic blocks there.
-; This test checks that this is taken into consideration.
-; We expect this loop to be unrolled, because the most complicated part of its
-; body (if.then block) is never actually executed.
-; CHECK-LABEL: @branch_folded
-; CHECK-NOT: br i1 %
-; CHECK: ret i32
-define i32 @branch_folded(i32* noalias nocapture readonly %b) {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.inc, %entry
- %iv.0 = phi i64 [ 0, %entry ], [ %iv.1, %for.inc ]
- %r.0 = phi i32 [ 0, %entry ], [ %r.1, %for.inc ]
- %arrayidx1 = getelementptr inbounds [10 x i32], [10 x i32]* @known_constant, i64 0, i64 %iv.0
- %x1 = load i32, i32* %arrayidx1, align 4
- %cmp = icmp eq i32 %x1, 0
- %iv.1 = add nuw nsw i64 %iv.0, 1
- br i1 %cmp, label %if.then, label %for.inc
-
-if.then: ; preds = %for.body
- %arrayidx2 = getelementptr inbounds i32, i32* %b, i64 %iv.0
- %x2 = load i32, i32* %arrayidx2, align 4
- %add = add nsw i32 %x2, %r.0
- br label %for.inc
-
-for.inc: ; preds = %for.body, %if.then
- %r.1 = phi i32 [ %add, %if.then ], [ %x1, %for.body ]
- %exitcond = icmp eq i64 %iv.1, 10
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %for.inc
- ret i32 %r.1
-}
-
-; Check that we don't crash when we analyze icmp with pointer-typed IV and a
-; pointer.
-; CHECK-LABEL: @ptr_cmp_crash
-; CHECK: ret void
-define void @ptr_cmp_crash() {
-entry:
- br label %while.body
-
-while.body:
- %iv.0 = phi i32* [ getelementptr inbounds ([10 x i32], [10 x i32]* @known_constant, i64 0, i64 0), %entry ], [ %iv.1, %while.body ]
- %iv.1 = getelementptr inbounds i32, i32* %iv.0, i64 1
- %exitcond = icmp eq i32* %iv.1, getelementptr inbounds ([10 x i32], [10 x i32]* @known_constant, i64 0, i64 9)
- br i1 %exitcond, label %loop.exit, label %while.body
-
-loop.exit:
- ret void
-}
-
-; Check that we don't crash when we analyze ptrtoint cast.
-; CHECK-LABEL: @ptrtoint_cast_crash
-; CHECK: ret void
-define void @ptrtoint_cast_crash(i8 * %a) {
-entry:
- %limit = getelementptr i8, i8* %a, i64 512
- br label %loop.body
-
-loop.body:
- %iv.0 = phi i8* [ %a, %entry ], [ %iv.1, %loop.body ]
- %cast = ptrtoint i8* %iv.0 to i64
- %iv.1 = getelementptr inbounds i8, i8* %iv.0, i64 1
- %exitcond = icmp ne i8* %iv.1, %limit
- br i1 %exitcond, label %loop.body, label %loop.exit
-
-loop.exit:
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/full-unroll-heuristics-dce.ll b/llvm/test/Transforms/LoopUnroll/full-unroll-heuristics-dce.ll
deleted file mode 100644
index 57de3041f57..00000000000
--- a/llvm/test/Transforms/LoopUnroll/full-unroll-heuristics-dce.ll
+++ /dev/null
@@ -1,39 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=100 -unroll-threshold=12 -unroll-max-percent-threshold-boost=400 | FileCheck %s
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(unroll-full)' -unroll-max-iteration-count-to-analyze=100 -unroll-threshold=12 -unroll-max-percent-threshold-boost=400 | FileCheck %s
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-
-@known_constant = internal unnamed_addr constant [10 x i32] [i32 0, i32 0, i32 0, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0], align 16
-
-; If a load becomes a constant after loop unrolling, we sometimes can simplify
-; CFG. This test verifies that we handle such cases.
-; After one operand in an instruction is constant-folded and the
-; instruction is simplified, the other operand might become dead.
-; In this test we have::
-; for i in 1..10:
-; r += A[i] * B[i]
-; A[i] is 0 almost at every iteration, so there is no need in loading B[i] at
-; all.
-
-
-; CHECK-LABEL: @unroll_dce
-; CHECK-NOT: br i1 %exitcond, label %for.end, label %for.body
-define i32 @unroll_dce(i32* noalias nocapture readonly %b) {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %iv.0 = phi i64 [ 0, %entry ], [ %iv.1, %for.body ]
- %r.0 = phi i32 [ 0, %entry ], [ %r.1, %for.body ]
- %arrayidx1 = getelementptr inbounds [10 x i32], [10 x i32]* @known_constant, i64 0, i64 %iv.0
- %x1 = load i32, i32* %arrayidx1, align 4
- %arrayidx2 = getelementptr inbounds i32, i32* %b, i64 %iv.0
- %x2 = load i32, i32* %arrayidx2, align 4
- %mul = mul i32 %x1, %x2
- %r.1 = add i32 %mul, %r.0
- %iv.1 = add nuw nsw i64 %iv.0, 1
- %exitcond = icmp eq i64 %iv.1, 10
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %for.body
- ret i32 %r.1
-}
diff --git a/llvm/test/Transforms/LoopUnroll/full-unroll-heuristics-geps.ll b/llvm/test/Transforms/LoopUnroll/full-unroll-heuristics-geps.ll
deleted file mode 100644
index 238869d120b..00000000000
--- a/llvm/test/Transforms/LoopUnroll/full-unroll-heuristics-geps.ll
+++ /dev/null
@@ -1,29 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=100 -unroll-threshold=10 -unroll-max-percent-threshold-boost=200 | FileCheck %s
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(unroll-full)' -unroll-max-iteration-count-to-analyze=100 -unroll-threshold=10 -unroll-max-percent-threshold-boost=200 | FileCheck %s
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-
-; When examining gep-instructions we shouldn't consider them simplified if the
-; corresponding memory access isn't simplified. Doing the opposite might bias
-; our estimate, so that we might decide to unroll even a simple memcpy loop.
-;
-; Thus, the following loop shouldn't be unrolled:
-; CHECK-LABEL: @not_simplified_geps
-; CHECK: br i1 %
-; CHECK: ret void
-define void @not_simplified_geps(i32* noalias %b, i32* noalias %c) {
-entry:
- br label %for.body
-
-for.body:
- %iv.0 = phi i64 [ 0, %entry ], [ %iv.1, %for.body ]
- %arrayidx1 = getelementptr inbounds i32, i32* %b, i64 %iv.0
- %x1 = load i32, i32* %arrayidx1, align 4
- %arrayidx2 = getelementptr inbounds i32, i32* %c, i64 %iv.0
- store i32 %x1, i32* %arrayidx2, align 4
- %iv.1 = add nuw nsw i64 %iv.0, 1
- %exitcond = icmp eq i64 %iv.1, 10
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end:
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/full-unroll-heuristics-phi-prop.ll b/llvm/test/Transforms/LoopUnroll/full-unroll-heuristics-phi-prop.ll
deleted file mode 100644
index aa517cb1589..00000000000
--- a/llvm/test/Transforms/LoopUnroll/full-unroll-heuristics-phi-prop.ll
+++ /dev/null
@@ -1,24 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=100 -unroll-threshold=10 -unroll-max-percent-threshold-boost=200 | FileCheck %s
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(unroll-full)' -unroll-max-iteration-count-to-analyze=100 -unroll-threshold=10 -unroll-max-percent-threshold-boost=200 | FileCheck %s
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-
-define i64 @propagate_loop_phis() {
-; CHECK-LABEL: @propagate_loop_phis(
-; CHECK-NOT: br i1
-; CHECK: ret i64 3
-entry:
- br label %loop
-
-loop:
- %iv = phi i64 [ 0, %entry ], [ %inc, %loop ]
- %x0 = phi i64 [ 0, %entry ], [ %x2, %loop ]
- %x1 = or i64 %x0, 1
- %x2 = or i64 %x1, 2
- %inc = add nuw nsw i64 %iv, 1
- %cond = icmp sge i64 %inc, 10
- br i1 %cond, label %loop.end, label %loop
-
-loop.end:
- %x.lcssa = phi i64 [ %x2, %loop ]
- ret i64 %x.lcssa
-}
diff --git a/llvm/test/Transforms/LoopUnroll/full-unroll-heuristics.ll b/llvm/test/Transforms/LoopUnroll/full-unroll-heuristics.ll
deleted file mode 100644
index 27ecb65ad61..00000000000
--- a/llvm/test/Transforms/LoopUnroll/full-unroll-heuristics.ll
+++ /dev/null
@@ -1,69 +0,0 @@
-; In this test we check how heuristics for complete unrolling work. We have
-; three knobs:
-; 1) -unroll-threshold
-; 3) -unroll-percent-dynamic-cost-saved-threshold and
-; 2) -unroll-dynamic-cost-savings-discount
-;
-; They control loop-unrolling according to the following rules:
-; * If size of unrolled loop exceeds the absoulte threshold, we don't unroll
-; this loop under any circumstances.
-; * If size of unrolled loop is below the '-unroll-threshold', then we'll
-; consider this loop as a very small one, and completely unroll it.
-; * If a loop size is between these two tresholds, we only do complete unroll
-; it if estimated number of potentially optimized instructions is high (we
-; specify the minimal percent of such instructions).
-
-; In this particular test-case, complete unrolling will allow later
-; optimizations to remove ~55% of the instructions, the loop body size is 9,
-; and unrolled size is 65.
-
-; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=10 -unroll-max-percent-threshold-boost=100 | FileCheck %s -check-prefix=TEST1
-; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=20 -unroll-max-percent-threshold-boost=200 | FileCheck %s -check-prefix=TEST2
-; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=20 -unroll-max-percent-threshold-boost=100 | FileCheck %s -check-prefix=TEST3
-
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(unroll-full)' -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=10 -unroll-max-percent-threshold-boost=100 | FileCheck %s -check-prefix=TEST1
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(unroll-full)' -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=20 -unroll-max-percent-threshold-boost=200 | FileCheck %s -check-prefix=TEST2
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(unroll-full)' -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=20 -unroll-max-percent-threshold-boost=100 | FileCheck %s -check-prefix=TEST3
-
-; Check that these work when the unroller has partial unrolling enabled too.
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll' -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=10 -unroll-max-percent-threshold-boost=100 | FileCheck %s -check-prefix=TEST1
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll' -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=20 -unroll-max-percent-threshold-boost=200 | FileCheck %s -check-prefix=TEST2
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll' -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=20 -unroll-max-percent-threshold-boost=100 | FileCheck %s -check-prefix=TEST3
-
-; If the absolute threshold is too low, we should not unroll:
-; TEST1: %array_const_idx = getelementptr inbounds [9 x i32], [9 x i32]* @known_constant, i64 0, i64 %iv
-
-; Otherwise, we should:
-; TEST2-NOT: %array_const_idx = getelementptr inbounds [9 x i32], [9 x i32]* @known_constant, i64 0, i64 %iv
-
-; If we do not boost threshold, the unroll will not happen:
-; TEST3: %array_const_idx = getelementptr inbounds [9 x i32], [9 x i32]* @known_constant, i64 0, i64 %iv
-
-; And check that we don't crash when we're not allowed to do any analysis.
-; RUN: opt < %s -loop-unroll -unroll-max-iteration-count-to-analyze=0 -disable-output
-; RUN: opt < %s -passes='require<opt-remark-emit>,loop(unroll-full)' -unroll-max-iteration-count-to-analyze=0 -disable-output
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-
-@known_constant = internal unnamed_addr constant [9 x i32] [i32 0, i32 -1, i32 0, i32 -1, i32 5, i32 -1, i32 0, i32 -1, i32 0], align 16
-
-define i32 @foo(i32* noalias nocapture readonly %src) {
-entry:
- br label %loop
-
-loop: ; preds = %loop, %entry
- %iv = phi i64 [ 0, %entry ], [ %inc, %loop ]
- %r = phi i32 [ 0, %entry ], [ %add, %loop ]
- %arrayidx = getelementptr inbounds i32, i32* %src, i64 %iv
- %src_element = load i32, i32* %arrayidx, align 4
- %array_const_idx = getelementptr inbounds [9 x i32], [9 x i32]* @known_constant, i64 0, i64 %iv
- %const_array_element = load i32, i32* %array_const_idx, align 4
- %mul = mul nsw i32 %src_element, %const_array_element
- %add = add nsw i32 %mul, %r
- %inc = add nuw nsw i64 %iv, 1
- %exitcond86.i = icmp eq i64 %inc, 9
- br i1 %exitcond86.i, label %loop.end, label %loop
-
-loop.end: ; preds = %loop
- %r.lcssa = phi i32 [ %r, %loop ]
- ret i32 %r.lcssa
-}
diff --git a/llvm/test/Transforms/LoopUnroll/full-unroll-keep-first-exit.ll b/llvm/test/Transforms/LoopUnroll/full-unroll-keep-first-exit.ll
deleted file mode 100644
index 682d1b35c1f..00000000000
--- a/llvm/test/Transforms/LoopUnroll/full-unroll-keep-first-exit.ll
+++ /dev/null
@@ -1,208 +0,0 @@
-; RUN: opt -S -loop-unroll < %s | FileCheck %s
-; RUN: opt -S -passes='require<opt-remark-emit>,loop(unroll-full)' < %s | FileCheck %s
-
-; Unroll twice, with first loop exit kept
-; CHECK-LABEL: @s32_max1
-; CHECK: do.body:
-; CHECK: store
-; CHECK: br i1 %cmp, label %do.body.1, label %do.end
-; CHECK: do.end:
-; CHECK: ret void
-; CHECK: do.body.1:
-; CHECK: store
-; CHECK: br label %do.end
-define void @s32_max1(i32 %n, i32* %p) {
-entry:
- %add = add i32 %n, 1
- br label %do.body
-
-do.body:
- %i.0 = phi i32 [ %n, %entry ], [ %inc, %do.body ]
- %arrayidx = getelementptr i32, i32* %p, i32 %i.0
- store i32 %i.0, i32* %arrayidx, align 4
- %inc = add i32 %i.0, 1
- %cmp = icmp slt i32 %i.0, %add
- br i1 %cmp, label %do.body, label %do.end ; taken either 0 or 1 times
-
-do.end:
- ret void
-}
-
-; Unroll thrice, with first loop exit kept
-; CHECK-LABEL: @s32_max2
-; CHECK: do.body:
-; CHECK: store
-; CHECK: br i1 %cmp, label %do.body.1, label %do.end
-; CHECK: do.end:
-; CHECK: ret void
-; CHECK: do.body.1:
-; CHECK: store
-; CHECK: store
-; CHECK: br label %do.end
-define void @s32_max2(i32 %n, i32* %p) {
-entry:
- %add = add i32 %n, 2
- br label %do.body
-
-do.body:
- %i.0 = phi i32 [ %n, %entry ], [ %inc, %do.body ]
- %arrayidx = getelementptr i32, i32* %p, i32 %i.0
- store i32 %i.0, i32* %arrayidx, align 4
- %inc = add i32 %i.0, 1
- %cmp = icmp slt i32 %i.0, %add
- br i1 %cmp, label %do.body, label %do.end ; taken either 0 or 2 times
-
-do.end:
- ret void
-}
-
-; Should not be unrolled
-; CHECK-LABEL: @s32_maxx
-; CHECK: do.body:
-; CHECK: do.end:
-; CHECK-NOT: do.body.1:
-define void @s32_maxx(i32 %n, i32 %x, i32* %p) {
-entry:
- %add = add i32 %x, %n
- br label %do.body
-
-do.body:
- %i.0 = phi i32 [ %n, %entry ], [ %inc, %do.body ]
- %arrayidx = getelementptr i32, i32* %p, i32 %i.0
- store i32 %i.0, i32* %arrayidx, align 4
- %inc = add i32 %i.0, 1
- %cmp = icmp slt i32 %i.0, %add
- br i1 %cmp, label %do.body, label %do.end ; taken either 0 or x times
-
-do.end:
- ret void
-}
-
-; Should not be unrolled
-; CHECK-LABEL: @s32_max2_unpredictable_exit
-; CHECK: do.body:
-; CHECK: do.end:
-; CHECK-NOT: do.body.1:
-define void @s32_max2_unpredictable_exit(i32 %n, i32 %x, i32* %p) {
-entry:
- %add = add i32 %n, 2
- br label %do.body
-
-do.body:
- %i.0 = phi i32 [ %n, %entry ], [ %inc, %if.end ]
- %cmp = icmp eq i32 %i.0, %x
- br i1 %cmp, label %do.end, label %if.end ; unpredictable
-
-if.end:
- %arrayidx = getelementptr i32, i32* %p, i32 %i.0
- store i32 %i.0, i32* %arrayidx, align 4
- %inc = add i32 %i.0, 1
- %cmp1 = icmp slt i32 %i.0, %add
- br i1 %cmp1, label %do.body, label %do.end ; taken either 0 or 2 times
-
-do.end:
- ret void
-}
-
-; Unroll twice, with first loop exit kept
-; CHECK-LABEL: @u32_max1
-; CHECK: do.body:
-; CHECK: store
-; CHECK: br i1 %cmp, label %do.body.1, label %do.end
-; CHECK: do.end:
-; CHECK: ret void
-; CHECK: do.body.1:
-; CHECK: store
-; CHECK: br label %do.end
-define void @u32_max1(i32 %n, i32* %p) {
-entry:
- %add = add i32 %n, 1
- br label %do.body
-
-do.body:
- %i.0 = phi i32 [ %n, %entry ], [ %inc, %do.body ]
- %arrayidx = getelementptr i32, i32* %p, i32 %i.0
- store i32 %i.0, i32* %arrayidx, align 4
- %inc = add i32 %i.0, 1
- %cmp = icmp ult i32 %i.0, %add
- br i1 %cmp, label %do.body, label %do.end ; taken either 0 or 1 times
-
-do.end:
- ret void
-}
-
-; Unroll thrice, with first loop exit kept
-; CHECK-LABEL: @u32_max2
-; CHECK: do.body:
-; CHECK: store
-; CHECK: br i1 %cmp, label %do.body.1, label %do.end
-; CHECK: do.end:
-; CHECK: ret void
-; CHECK: do.body.1:
-; CHECK: store
-; CHECK: store
-; CHECK: br label %do.end
-define void @u32_max2(i32 %n, i32* %p) {
-entry:
- %add = add i32 %n, 2
- br label %do.body
-
-do.body:
- %i.0 = phi i32 [ %n, %entry ], [ %inc, %do.body ]
- %arrayidx = getelementptr i32, i32* %p, i32 %i.0
- store i32 %i.0, i32* %arrayidx, align 4
- %inc = add i32 %i.0, 1
- %cmp = icmp ult i32 %i.0, %add
- br i1 %cmp, label %do.body, label %do.end ; taken either 0 or 2 times
-
-do.end:
- ret void
-}
-
-; Should not be unrolled
-; CHECK-LABEL: @u32_maxx
-; CHECK: do.body:
-; CHECK: do.end:
-; CHECK-NOT: do.body.1:
-define void @u32_maxx(i32 %n, i32 %x, i32* %p) {
-entry:
- %add = add i32 %x, %n
- br label %do.body
-
-do.body:
- %i.0 = phi i32 [ %n, %entry ], [ %inc, %do.body ]
- %arrayidx = getelementptr i32, i32* %p, i32 %i.0
- store i32 %i.0, i32* %arrayidx, align 4
- %inc = add i32 %i.0, 1
- %cmp = icmp ult i32 %i.0, %add
- br i1 %cmp, label %do.body, label %do.end ; taken either 0 or x times
-
-do.end:
- ret void
-}
-
-; Should not be unrolled
-; CHECK-LABEL: @u32_max2_unpredictable_exit
-; CHECK: do.body:
-; CHECK: do.end:
-; CHECK-NOT: do.body.1:
-define void @u32_max2_unpredictable_exit(i32 %n, i32 %x, i32* %p) {
-entry:
- %add = add i32 %n, 2
- br label %do.body
-
-do.body:
- %i.0 = phi i32 [ %n, %entry ], [ %inc, %if.end ]
- %cmp = icmp eq i32 %i.0, %x
- br i1 %cmp, label %do.end, label %if.end ; unpredictable
-
-if.end:
- %arrayidx = getelementptr i32, i32* %p, i32 %i.0
- store i32 %i.0, i32* %arrayidx, align 4
- %inc = add i32 %i.0, 1
- %cmp1 = icmp ult i32 %i.0, %add
- br i1 %cmp1, label %do.body, label %do.end ; taken either 0 or 2 times
-
-do.end:
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/high-cost-trip-count-computation.ll b/llvm/test/Transforms/LoopUnroll/high-cost-trip-count-computation.ll
deleted file mode 100644
index bdb8566e0df..00000000000
--- a/llvm/test/Transforms/LoopUnroll/high-cost-trip-count-computation.ll
+++ /dev/null
@@ -1,61 +0,0 @@
-; RUN: opt -S -unroll-runtime -loop-unroll < %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-S128"
-
-;; Check that we don't emit expensive instructions to compute trip
-;; counts when unrolling loops.
-
-define i32 @test(i64 %v12, i8* %array, i64* %loc) {
-; CHECK-LABEL: @test(
-; CHECK-NOT: udiv
-entry:
- %step = load i64, i64* %loc, !range !0
- br label %loop
-
-loop: ; preds = %entry, %loop
- %k.015 = phi i64 [ %v15, %loop ], [ %v12, %entry ]
- %v14 = getelementptr inbounds i8, i8* %array, i64 %k.015
- store i8 0, i8* %v14
- %v15 = add nuw nsw i64 %k.015, %step
- %v16 = icmp slt i64 %v15, 8193
- br i1 %v16, label %loop, label %loopexit
-
-loopexit: ; preds = %loop
- ret i32 0
-}
-
-;; Though SCEV for loop tripcount contains division,
-;; it shouldn't be considered expensive, since the division already
-;; exists in the code and we don't need to expand it once more.
-;; Thus, it shouldn't prevent us from unrolling the loop.
-
-define i32 @test2(i64* %loc, i64 %conv7) {
-; CHECK-LABEL: @test2(
-; CHECK: udiv
-; CHECK: udiv
-; CHECK-NOT: udiv
-; CHECK-LABEL: for.body
-entry:
- %rem0 = load i64, i64* %loc, align 8
- %ExpensiveComputation = udiv i64 %rem0, 42 ; <<< Extra computations are added to the trip-count expression
- br label %bb1
-bb1:
- %div11 = udiv i64 %ExpensiveComputation, %conv7
- %cmp.i38 = icmp ugt i64 %div11, 1
- %div12 = select i1 %cmp.i38, i64 %div11, i64 1
- br label %for.body
-for.body:
- %rem1 = phi i64 [ %rem0, %bb1 ], [ %rem2, %for.body ]
- %k1 = phi i64 [ %div12, %bb1 ], [ %dec, %for.body ]
- %mul1 = mul i64 %rem1, 48271
- %rem2 = urem i64 %mul1, 2147483647
- %dec = add i64 %k1, -1
- %cmp = icmp eq i64 %dec, 0
- br i1 %cmp, label %exit, label %for.body
-exit:
- %rem3 = phi i64 [ %rem2, %for.body ]
- store i64 %rem3, i64* %loc, align 8
- ret i32 0
-}
-
-!0 = !{i64 1, i64 100}
diff --git a/llvm/test/Transforms/LoopUnroll/ignore-annotation-intrinsic-cost.ll b/llvm/test/Transforms/LoopUnroll/ignore-annotation-intrinsic-cost.ll
deleted file mode 100644
index 2101b63e026..00000000000
--- a/llvm/test/Transforms/LoopUnroll/ignore-annotation-intrinsic-cost.ll
+++ /dev/null
@@ -1,133 +0,0 @@
-; REQUIRES: asserts
-; RUN: opt < %s -disable-output -stats -loop-unroll -info-output-file - | FileCheck %s --check-prefix=STATS
-; STATS: 1 loop-unroll - Number of loops unrolled (completely or otherwise)
-; Test that llvm.annotation intrinsic do not count against the loop body size
-; and prevent unrolling.
-target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
-
-@B = common global i32 0, align 4
-
-define void @foo(i32* noalias %A, i32 %B, i32 %C) {
-entry:
- br label %for.body
-
-; A loop that has a small loop body (except for the annotations) that should be
-; unrolled with the default heuristic. Make sure the extra annotations do not
-; prevent unrolling
-for.body: ; preds = %entry, %for.body
- %i.01 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
- ; The real loop.
- %mul = mul nsw i32 %B, %C
- %arrayidx = getelementptr inbounds i32, i32* %A, i32 %i.01
- store i32 %mul, i32* %arrayidx, align 4
- %inc = add nsw i32 %i.01, 1
- %exitcond = icmp ne i32 %inc, 4
-
- ; A bunch of annotations
- %annot.0 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.1 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.2 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.3 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.4 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.5 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.6 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.7 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.8 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.9 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.10 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.11 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.12 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.13 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.14 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.15 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.16 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.17 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.18 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.19 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.20 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.21 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.22 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.23 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.24 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.25 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.26 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.27 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.28 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.29 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.30 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.31 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.32 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.33 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.34 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.35 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.36 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.37 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.38 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.39 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.40 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.41 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.42 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.43 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.44 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.45 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.46 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.47 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.48 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.49 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.50 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.51 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.52 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.53 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.54 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.55 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.56 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.57 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.58 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.59 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.60 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.61 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.62 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.63 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.64 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.65 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.66 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.67 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.68 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.69 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.70 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.71 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.72 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.73 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.74 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.75 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.76 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.77 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.78 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.79 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.80 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.81 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.82 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.83 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.84 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.85 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.86 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.87 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.88 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.89 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.90 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.91 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.92 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.93 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.94 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.95 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.96 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.97 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.98 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- %annot.99 = tail call i32 @llvm.annotation.i32(i32 %i.01, i8* null, i8* null, i32 0)
- br i1 %exitcond, label %for.body, label %for.end
-
-for.end: ; preds = %for.body
- ret void
-}
-
-declare i32 @llvm.annotation.i32(i32, i8*, i8*, i32)
diff --git a/llvm/test/Transforms/LoopUnroll/invalidate_right_loop.ll b/llvm/test/Transforms/LoopUnroll/invalidate_right_loop.ll
deleted file mode 100644
index cb769af63c7..00000000000
--- a/llvm/test/Transforms/LoopUnroll/invalidate_right_loop.ll
+++ /dev/null
@@ -1,51 +0,0 @@
-; RUN: opt < %s -S -indvars -loop-unroll -verify-dom-info | 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"
-
-; Make sure that this test doesn't crash because of dangling pointer in SCEV.
-declare void @llvm.experimental.guard(i1, ...)
-
-define void @test(i32* %p, i8** %p2, i64* %dest) {
-
-; CHECK-LABEL: @test(
-
-entry:
- br label %outer.loop
-
-outer.loop: ; preds = %outer.latch, %entry
- %local_2_ = phi i32 [ 10, %entry ], [ %tmp2, %outer.latch ]
- %tmp1 = icmp eq i32 %local_2_, 0
- br label %inner.loop
-
-outer.latch: ; preds = %inner.latch
- %tmp2 = add i32 %local_2_, 1
- br label %outer.loop
-
-inner.loop: ; preds = %inner.latch, %outer.loop
- %local_4_20 = phi i32 [ 7, %outer.loop ], [ %tmp15, %inner.latch ]
- %tmp6 = icmp eq i32 %local_4_20, 0
- call void (i1, ...) @llvm.experimental.guard(i1 %tmp6) [ "deopt"() ]
- br label %innermost.loop
-
-store.block: ; preds = %innermost.loop
- store i64 %tmp20, i64* %dest, align 8
- br i1 %tmp1, label %exit, label %inner.latch
-
-inner.latch: ; preds = %store.block
- %tmp15 = add i32 %local_4_20, 4
- %tmp16 = icmp sgt i32 %tmp15, 263
- br i1 %tmp16, label %outer.latch, label %inner.loop
-
-innermost.loop: ; preds = %innermost.loop, %inner.loop
- %tmp17 = phi i64 [ 0, %inner.loop ], [ %tmp20, %innermost.loop ]
- %local_6_51 = phi i32 [ 1, %inner.loop ], [ %tmp21, %innermost.loop ]
- %ze = zext i32 %local_6_51 to i64
- %tmp20 = add i64 %tmp17, %ze
- %tmp21 = add nuw nsw i32 %local_6_51, 1
- %tmp22 = icmp ugt i32 %local_6_51, 5
- br i1 %tmp22, label %store.block, label %innermost.loop
-
-exit: ; preds = %store.block
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/loop-remarks-with-hotness.ll b/llvm/test/Transforms/LoopUnroll/loop-remarks-with-hotness.ll
deleted file mode 100644
index eb3d05c08e7..00000000000
--- a/llvm/test/Transforms/LoopUnroll/loop-remarks-with-hotness.ll
+++ /dev/null
@@ -1,28 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -pass-remarks=loop-unroll -pass-remarks-with-hotness -unroll-count=16 2>&1 | FileCheck -check-prefix=COMPLETE-UNROLL %s
-; RUN: opt < %s -S -loop-unroll -pass-remarks=loop-unroll -pass-remarks-with-hotness -unroll-count=4 2>&1 | FileCheck -check-prefix=PARTIAL-UNROLL %s
-
-; COMPLETE-UNROLL: remark: {{.*}}: completely unrolled loop with 16 iterations (hotness: 300)
-; PARTIAL-UNROLL: remark: {{.*}}: unrolled loop by a factor of 4 {{.*}} (hotness: 300)
-
-define i32 @sum() !prof !0 {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %s.06 = phi i32 [ 0, %entry ], [ %add1, %for.body ]
- %i.05 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
- %add = add nsw i32 %i.05, 4
- %call = tail call i32 @baz(i32 %add) #2
- %add1 = add nsw i32 %call, %s.06
- %inc = add nsw i32 %i.05, 1
- %exitcond = icmp eq i32 %inc, 16
- br i1 %exitcond, label %for.end, label %for.body, !prof !1
-
-for.end: ; preds = %for.body
- ret i32 %add1
-}
-
-declare i32 @baz(i32)
-
-!0 = !{!"function_entry_count", i64 3}
-!1 = !{!"branch_weights", i32 1, i32 99}
diff --git a/llvm/test/Transforms/LoopUnroll/loop-remarks.ll b/llvm/test/Transforms/LoopUnroll/loop-remarks.ll
deleted file mode 100644
index cb273f962f0..00000000000
--- a/llvm/test/Transforms/LoopUnroll/loop-remarks.ll
+++ /dev/null
@@ -1,48 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -pass-remarks=loop-unroll -unroll-count=16 2>&1 | FileCheck -check-prefix=COMPLETE-UNROLL %s
-; RUN: opt < %s -S -loop-unroll -pass-remarks=loop-unroll -unroll-count=4 2>&1 | FileCheck -check-prefix=PARTIAL-UNROLL %s
-; RUN: opt < %s -S -loop-unroll -pass-remarks=loop-unroll -unroll-count=4 -unroll-runtime=true -unroll-remainder 2>&1 | FileCheck %s --check-prefix=RUNTIME-UNROLL
-
-; COMPLETE-UNROLL: remark: {{.*}}: completely unrolled loop with 16 iterations
-; PARTIAL-UNROLL: remark: {{.*}}: unrolled loop by a factor of 4
-; RUNTIME-UNROLL: remark: {{.*}}: unrolled loop by a factor of 4
-
-define i32 @sum() {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %s.06 = phi i32 [ 0, %entry ], [ %add1, %for.body ]
- %i.05 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
- %add = add nsw i32 %i.05, 4
- %call = tail call i32 @baz(i32 %add) #2
- %add1 = add nsw i32 %call, %s.06
- %inc = add nsw i32 %i.05, 1
- %exitcond = icmp eq i32 %inc, 16
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %for.body
- ret i32 %add1
-}
-
-; RUNTIME-UNROLL-NOT: remark: {{.*}}: completely unrolled loop with 3 iterations
-; RUNTIME-UNROLL: remark: {{.*}}: unrolled loop by a factor of 4
-
-define i32 @runtime(i32 %n) {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %s.06 = phi i32 [ 0, %entry ], [ %add1, %for.body ]
- %i.05 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
- %add = add nsw i32 %i.05, 4
- %call = tail call i32 @baz(i32 %add) #2
- %add1 = add nsw i32 %call, %s.06
- %inc = add nsw i32 %i.05, 1
- %exitcond = icmp eq i32 %inc, %n
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %for.body
- ret i32 %add1
-}
-
-declare i32 @baz(i32) \ No newline at end of file
diff --git a/llvm/test/Transforms/LoopUnroll/not-rotated.ll b/llvm/test/Transforms/LoopUnroll/not-rotated.ll
deleted file mode 100644
index b4b88e09607..00000000000
--- a/llvm/test/Transforms/LoopUnroll/not-rotated.ll
+++ /dev/null
@@ -1,26 +0,0 @@
-; PR28103
-; Bail out if the two successors are not the header
-; and another bb outside of the loop. This case is not
-; properly handled by LoopUnroll, currently.
-
-; RUN: opt -loop-unroll -verify-dom-info %s
-; REQUIRES: asserts
-
-define void @tinkywinky(i1 %patatino) {
-entry:
- br label %header1
-header1:
- %indvars.iv = phi i64 [ 1, %body2 ], [ 0, %entry ]
- %exitcond = icmp ne i64 %indvars.iv, 1
- br i1 %exitcond, label %body1, label %exit
-body1:
- br i1 %patatino, label %body2, label %sink
-body2:
- br i1 %patatino, label %header1, label %body3
-body3:
- br label %sink
-sink:
- br label %body2
-exit:
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/partial-unroll-const-bounds.ll b/llvm/test/Transforms/LoopUnroll/partial-unroll-const-bounds.ll
deleted file mode 100644
index 3ccf4329a0a..00000000000
--- a/llvm/test/Transforms/LoopUnroll/partial-unroll-const-bounds.ll
+++ /dev/null
@@ -1,37 +0,0 @@
-; RUN: opt < %s -S -unroll-partial-threshold=20 -unroll-threshold=20 -loop-unroll -unroll-allow-partial -unroll-runtime -unroll-allow-remainder -unroll-max-percent-threshold-boost=100 | FileCheck %s
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll' -unroll-partial-threshold=20 -unroll-threshold=20 -unroll-allow-partial -unroll-runtime -unroll-allow-remainder -unroll-max-percent-threshold-boost=100 | FileCheck %s
-;
-; Also check that the simple unroller doesn't allow the partial unrolling.
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(unroll-full)' -unroll-partial-threshold=20 -unroll-threshold=20 -unroll-allow-partial -unroll-runtime -unroll-allow-remainder -unroll-max-percent-threshold-boost=100 | FileCheck %s --check-prefix=CHECK-NO-UNROLL
-
-; The Loop TripCount is 9. However unroll factors 3 or 9 exceed given threshold.
-; The test checks that we choose a smaller, power-of-two, unroll count and do not give up on unrolling.
-
-; CHECK: for.body:
-; CHECK: store
-; CHECK: for.body.1:
-; CHECK: store
-
-; CHECK-NO-UNROLL: for.body:
-; CHECK-NO-UNROLL: store
-; CHECK-NO-UNROLL-NOT: store
-
-define void @foo(i32* nocapture %a, i32* nocapture readonly %b) nounwind uwtable {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ 1, %entry ], [ %indvars.iv.next, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %b, i64 %indvars.iv
- %ld = load i32, i32* %arrayidx, align 4
- %idxprom1 = sext i32 %ld to i64
- %arrayidx2 = getelementptr inbounds i32, i32* %a, i64 %idxprom1
- %st = trunc i64 %indvars.iv to i32
- store i32 %st, i32* %arrayidx2, align 4
- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, 20
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %for.body
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/peel-loop-conditions.ll b/llvm/test/Transforms/LoopUnroll/peel-loop-conditions.ll
deleted file mode 100644
index a9937d9db99..00000000000
--- a/llvm/test/Transforms/LoopUnroll/peel-loop-conditions.ll
+++ /dev/null
@@ -1,645 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -S -loop-unroll -verify-dom-info | FileCheck %s
-
-declare void @f1()
-declare void @f2()
-
-; Check that we can peel off iterations that make conditions true.
-define void @test1(i32 %k) {
-; CHECK-LABEL: @test1(
-; CHECK-NEXT: for.body.lr.ph:
-; CHECK-NEXT: br label [[FOR_BODY_PEEL_BEGIN:%.*]]
-; CHECK: for.body.peel.begin:
-; CHECK-NEXT: br label [[FOR_BODY_PEEL:%.*]]
-; CHECK: for.body.peel:
-; CHECK-NEXT: [[CMP1_PEEL:%.*]] = icmp ult i32 0, 2
-; CHECK-NEXT: br i1 [[CMP1_PEEL]], label [[IF_THEN_PEEL:%.*]], label [[IF_ELSE_PEEL:%.*]]
-; CHECK: if.else.peel:
-; CHECK-NEXT: call void @f2()
-; CHECK-NEXT: br label [[FOR_INC_PEEL:%.*]]
-; CHECK: if.then.peel:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[FOR_INC_PEEL]]
-; CHECK: for.inc.peel:
-; CHECK-NEXT: [[INC_PEEL:%.*]] = add nsw i32 0, 1
-; CHECK-NEXT: [[CMP_PEEL:%.*]] = icmp slt i32 [[INC_PEEL]], [[K:%.*]]
-; CHECK-NEXT: br i1 [[CMP_PEEL]], label [[FOR_BODY_PEEL_NEXT:%.*]], label [[FOR_END:%[^,]*]]
-; Verify that MD_loop metadata is dropped.
-; CHECK-NOT: , !llvm.loop !{{[0-9]*}}
-; CHECK: for.body.peel.next:
-; CHECK-NEXT: br label [[FOR_BODY_PEEL2:%.*]]
-; CHECK: for.body.peel2:
-; CHECK-NEXT: [[CMP1_PEEL3:%.*]] = icmp ult i32 [[INC_PEEL]], 2
-; CHECK-NEXT: br i1 [[CMP1_PEEL3]], label [[IF_THEN_PEEL5:%.*]], label [[IF_ELSE_PEEL4:%.*]]
-; CHECK: if.else.peel4:
-; CHECK-NEXT: call void @f2()
-; CHECK-NEXT: br label [[FOR_INC_PEEL6:%.*]]
-; CHECK: if.then.peel5:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[FOR_INC_PEEL6]]
-; CHECK: for.inc.peel6:
-; CHECK-NEXT: [[INC_PEEL7:%.*]] = add nsw i32 [[INC_PEEL]], 1
-; CHECK-NEXT: [[CMP_PEEL8:%.*]] = icmp slt i32 [[INC_PEEL7]], [[K]]
-; CHECK-NEXT: br i1 [[CMP_PEEL8]], label [[FOR_BODY_PEEL_NEXT1:%.*]], label [[FOR_END]]
-; Verify that MD_loop metadata is dropped.
-; CHECK-NOT: , !llvm.loop !{{[0-9]*}}
-; CHECK: for.body.peel.next1:
-; CHECK-NEXT: br label [[FOR_BODY_PEEL_NEXT9:%.*]]
-; CHECK: for.body.peel.next9:
-; CHECK-NEXT: br label [[FOR_BODY_LR_PH_PEEL_NEWPH:%.*]]
-; CHECK: for.body.lr.ph.peel.newph:
-; CHECK-NEXT: br label [[FOR_BODY:%.*]]
-; CHECK: for.body:
-; CHECK-NEXT: [[I_05:%.*]] = phi i32 [ [[INC_PEEL7]], [[FOR_BODY_LR_PH_PEEL_NEWPH]] ], [ [[INC:%.*]], [[FOR_INC:%.*]] ]
-; CHECK-NEXT: br i1 false, label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
-; CHECK: if.then:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[FOR_INC]]
-; CHECK: if.else:
-; CHECK-NEXT: call void @f2()
-; CHECK-NEXT: br label [[FOR_INC]]
-; CHECK: for.inc:
-; CHECK-NEXT: [[INC]] = add nuw nsw i32 [[I_05]], 1
-; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[INC]], [[K]]
-; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END_LOOPEXIT:%.*]], !llvm.loop !{{.*}}
-; CHECK: for.end.loopexit:
-; CHECK-NEXT: br label [[FOR_END]]
-; CHECK: for.end:
-; CHECK-NEXT: ret void
-;
-for.body.lr.ph:
- br label %for.body
-
-for.body:
- %i.05 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.inc ]
- %cmp1 = icmp ult i32 %i.05, 2
- br i1 %cmp1, label %if.then, label %if.else
-
-if.then:
- call void @f1()
- br label %for.inc
-
-if.else:
- call void @f2()
- br label %for.inc
-
-for.inc:
- %inc = add nsw i32 %i.05, 1
- %cmp = icmp slt i32 %inc, %k
- br i1 %cmp, label %for.body, label %for.end, !llvm.loop !1
-
-for.end:
- ret void
-}
-
-!1 = distinct !{!1}
-
-; Check we peel off the maximum number of iterations that make conditions true.
-define void @test2(i32 %k) {
-; CHECK-LABEL: @test2(
-; CHECK-NEXT: for.body.lr.ph:
-; CHECK-NEXT: br label [[FOR_BODY_PEEL_BEGIN:%.*]]
-; CHECK: for.body.peel.begin:
-; CHECK-NEXT: br label [[FOR_BODY_PEEL:%.*]]
-; CHECK: for.body.peel:
-; CHECK-NEXT: [[CMP1_PEEL:%.*]] = icmp ult i32 0, 2
-; CHECK-NEXT: br i1 [[CMP1_PEEL]], label [[IF_THEN_PEEL:%.*]], label [[IF_ELSE_PEEL:%.*]]
-; CHECK: if.else.peel:
-; CHECK-NEXT: call void @f2()
-; CHECK-NEXT: br label [[IF2_PEEL:%.*]]
-; CHECK: if.then.peel:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[IF2_PEEL]]
-; CHECK: if2.peel:
-; CHECK-NEXT: [[CMP2_PEEL:%.*]] = icmp ult i32 0, 4
-; CHECK-NEXT: br i1 [[CMP2_PEEL]], label [[IF_THEN2_PEEL:%.*]], label [[FOR_INC_PEEL:%.*]]
-; CHECK: if.then2.peel:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[FOR_INC_PEEL]]
-; CHECK: for.inc.peel:
-; CHECK-NEXT: [[INC_PEEL:%.*]] = add nsw i32 0, 1
-; CHECK-NEXT: [[CMP_PEEL:%.*]] = icmp slt i32 [[INC_PEEL]], [[K:%.*]]
-; CHECK-NEXT: br i1 [[CMP_PEEL]], label [[FOR_BODY_PEEL_NEXT:%.*]], label [[FOR_END:%[^,]*]]
-; Verify that MD_loop metadata is dropped.
-; CHECK-NOT: , !llvm.loop !{{[0-9]*}}
-; CHECK: for.body.peel.next:
-; CHECK-NEXT: br label [[FOR_BODY_PEEL2:%.*]]
-; CHECK: for.body.peel2:
-; CHECK-NEXT: [[CMP1_PEEL3:%.*]] = icmp ult i32 [[INC_PEEL]], 2
-; CHECK-NEXT: br i1 [[CMP1_PEEL3]], label [[IF_THEN_PEEL5:%.*]], label [[IF_ELSE_PEEL4:%.*]]
-; CHECK: if.else.peel4:
-; CHECK-NEXT: call void @f2()
-; CHECK-NEXT: br label [[IF2_PEEL6:%.*]]
-; CHECK: if.then.peel5:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[IF2_PEEL6]]
-; CHECK: if2.peel6:
-; CHECK-NEXT: [[CMP2_PEEL7:%.*]] = icmp ult i32 [[INC_PEEL]], 4
-; CHECK-NEXT: br i1 [[CMP2_PEEL7]], label [[IF_THEN2_PEEL8:%.*]], label [[FOR_INC_PEEL9:%.*]]
-; CHECK: if.then2.peel8:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[FOR_INC_PEEL9]]
-; CHECK: for.inc.peel9:
-; CHECK-NEXT: [[INC_PEEL10:%.*]] = add nsw i32 [[INC_PEEL]], 1
-; CHECK-NEXT: [[CMP_PEEL11:%.*]] = icmp slt i32 [[INC_PEEL10]], [[K]]
-; CHECK-NEXT: br i1 [[CMP_PEEL11]], label [[FOR_BODY_PEEL_NEXT1:%.*]], label [[FOR_END]]
-; Verify that MD_loop metadata is dropped.
-; CHECK-NOT: , !llvm.loop !{{[0-9]*}}
-; CHECK: for.body.peel.next1:
-; CHECK-NEXT: br label [[FOR_BODY_PEEL13:%.*]]
-; CHECK: for.body.peel13:
-; CHECK-NEXT: [[CMP1_PEEL14:%.*]] = icmp ult i32 [[INC_PEEL10]], 2
-; CHECK-NEXT: br i1 [[CMP1_PEEL14]], label [[IF_THEN_PEEL16:%.*]], label [[IF_ELSE_PEEL15:%.*]]
-; CHECK: if.else.peel15:
-; CHECK-NEXT: call void @f2()
-; CHECK-NEXT: br label [[IF2_PEEL17:%.*]]
-; CHECK: if.then.peel16:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[IF2_PEEL17]]
-; CHECK: if2.peel17:
-; CHECK-NEXT: [[CMP2_PEEL18:%.*]] = icmp ult i32 [[INC_PEEL10]], 4
-; CHECK-NEXT: br i1 [[CMP2_PEEL18]], label [[IF_THEN2_PEEL19:%.*]], label [[FOR_INC_PEEL20:%.*]]
-; CHECK: if.then2.peel19:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[FOR_INC_PEEL20]]
-; CHECK: for.inc.peel20:
-; CHECK-NEXT: [[INC_PEEL21:%.*]] = add nsw i32 [[INC_PEEL10]], 1
-; CHECK-NEXT: [[CMP_PEEL22:%.*]] = icmp slt i32 [[INC_PEEL21]], [[K]]
-; CHECK-NEXT: br i1 [[CMP_PEEL22]], label [[FOR_BODY_PEEL_NEXT12:%.*]], label [[FOR_END]]
-; Verify that MD_loop metadata is dropped.
-; CHECK-NOT: , !llvm.loop !{{[0-9]*}}
-; CHECK: for.body.peel.next12:
-; CHECK-NEXT: br label [[FOR_BODY_PEEL24:%.*]]
-; CHECK: for.body.peel24:
-; CHECK-NEXT: [[CMP1_PEEL25:%.*]] = icmp ult i32 [[INC_PEEL21]], 2
-; CHECK-NEXT: br i1 [[CMP1_PEEL25]], label [[IF_THEN_PEEL27:%.*]], label [[IF_ELSE_PEEL26:%.*]]
-; CHECK: if.else.peel26:
-; CHECK-NEXT: call void @f2()
-; CHECK-NEXT: br label [[IF2_PEEL28:%.*]]
-; CHECK: if.then.peel27:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[IF2_PEEL28]]
-; CHECK: if2.peel28:
-; CHECK-NEXT: [[CMP2_PEEL29:%.*]] = icmp ult i32 [[INC_PEEL21]], 4
-; CHECK-NEXT: br i1 [[CMP2_PEEL29]], label [[IF_THEN2_PEEL30:%.*]], label [[FOR_INC_PEEL31:%.*]]
-; CHECK: if.then2.peel30:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[FOR_INC_PEEL31]]
-; CHECK: for.inc.peel31:
-; CHECK-NEXT: [[INC_PEEL32:%.*]] = add nsw i32 [[INC_PEEL21]], 1
-; CHECK-NEXT: [[CMP_PEEL33:%.*]] = icmp slt i32 [[INC_PEEL32]], [[K]]
-; CHECK-NEXT: br i1 [[CMP_PEEL33]], label [[FOR_BODY_PEEL_NEXT23:%.*]], label [[FOR_END]]
-; Verify that MD_loop metadata is dropped.
-; CHECK-NOT: , !llvm.loop !{{[0-9]*}}
-; CHECK: for.body.peel.next23:
-; CHECK-NEXT: br label [[FOR_BODY_PEEL_NEXT34:%.*]]
-; CHECK: for.body.peel.next34:
-; CHECK-NEXT: br label [[FOR_BODY_LR_PH_PEEL_NEWPH:%.*]]
-; CHECK: for.body.lr.ph.peel.newph:
-; CHECK-NEXT: br label [[FOR_BODY:%.*]]
-; CHECK: for.body:
-; CHECK-NEXT: [[I_05:%.*]] = phi i32 [ [[INC_PEEL32]], [[FOR_BODY_LR_PH_PEEL_NEWPH]] ], [ [[INC:%.*]], [[FOR_INC:%.*]] ]
-; CHECK-NEXT: br i1 false, label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
-; CHECK: if.then:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[IF2:%.*]]
-; CHECK: if.else:
-; CHECK-NEXT: call void @f2()
-; CHECK-NEXT: br label [[IF2]]
-; CHECK: if2:
-; CHECK-NEXT: br i1 false, label [[IF_THEN2:%.*]], label [[FOR_INC]]
-; CHECK: if.then2:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[FOR_INC]]
-; CHECK: for.inc:
-; CHECK-NEXT: [[INC]] = add nuw nsw i32 [[I_05]], 1
-; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[INC]], [[K]]
-; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END_LOOPEXIT:%.*]], !llvm.loop !{{.*}}
-; CHECK: for.end.loopexit:
-; CHECK-NEXT: br label [[FOR_END]]
-; CHECK: for.end:
-; CHECK-NEXT: ret void
-;
-for.body.lr.ph:
- br label %for.body
-
-for.body:
- %i.05 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.inc ]
- %cmp1 = icmp ult i32 %i.05, 2
- br i1 %cmp1, label %if.then, label %if.else
-
-if.then:
- call void @f1()
- br label %if2
-
-if.else:
- call void @f2()
- br label %if2
-
-if2:
- %cmp2 = icmp ult i32 %i.05, 4
- br i1 %cmp2, label %if.then2, label %for.inc
-
-if.then2:
- call void @f1()
- br label %for.inc
-
-for.inc:
- %inc = add nsw i32 %i.05, 1
- %cmp = icmp slt i32 %inc, %k
- br i1 %cmp, label %for.body, label %for.end, !llvm.loop !2
-
-for.end:
- ret void
-}
-
-!2 = distinct !{!2}
-
-; Check that we can peel off iterations that make a condition false.
-define void @test3(i32 %k) {
-; CHECK-LABEL: @test3(
-; CHECK-NEXT: for.body.lr.ph:
-; CHECK-NEXT: br label [[FOR_BODY_PEEL_BEGIN:%.*]]
-; CHECK: for.body.peel.begin:
-; CHECK-NEXT: br label [[FOR_BODY_PEEL:%.*]]
-; CHECK: for.body.peel:
-; CHECK-NEXT: [[CMP1_PEEL:%.*]] = icmp ugt i32 0, 2
-; CHECK-NEXT: br i1 [[CMP1_PEEL]], label [[IF_THEN_PEEL:%.*]], label [[IF_ELSE_PEEL:%.*]]
-; CHECK: if.else.peel:
-; CHECK-NEXT: call void @f2()
-; CHECK-NEXT: br label [[FOR_INC_PEEL:%.*]]
-; CHECK: if.then.peel:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[FOR_INC_PEEL]]
-; CHECK: for.inc.peel:
-; CHECK-NEXT: [[INC_PEEL:%.*]] = add nsw i32 0, 1
-; CHECK-NEXT: [[CMP_PEEL:%.*]] = icmp slt i32 [[INC_PEEL]], [[K:%.*]]
-; CHECK-NEXT: br i1 [[CMP_PEEL]], label [[FOR_BODY_PEEL_NEXT:%.*]], label [[FOR_END:%[^,]*]]
-; Verify that MD_loop metadata is dropped.
-; CHECK-NOT: , !llvm.loop !{{[0-9]*}}
-; CHECK: for.body.peel.next:
-; CHECK-NEXT: br label [[FOR_BODY_PEEL2:%.*]]
-; CHECK: for.body.peel2:
-; CHECK-NEXT: [[CMP1_PEEL3:%.*]] = icmp ugt i32 [[INC_PEEL]], 2
-; CHECK-NEXT: br i1 [[CMP1_PEEL3]], label [[IF_THEN_PEEL5:%.*]], label [[IF_ELSE_PEEL4:%.*]]
-; CHECK: if.else.peel4:
-; CHECK-NEXT: call void @f2()
-; CHECK-NEXT: br label [[FOR_INC_PEEL6:%.*]]
-; CHECK: if.then.peel5:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[FOR_INC_PEEL6]]
-; CHECK: for.inc.peel6:
-; CHECK-NEXT: [[INC_PEEL7:%.*]] = add nsw i32 [[INC_PEEL]], 1
-; CHECK-NEXT: [[CMP_PEEL8:%.*]] = icmp slt i32 [[INC_PEEL7]], [[K]]
-; CHECK-NEXT: br i1 [[CMP_PEEL8]], label [[FOR_BODY_PEEL_NEXT1:%.*]], label [[FOR_END]]
-; Verify that MD_loop metadata is dropped.
-; CHECK-NOT: , !llvm.loop !{{[0-9]*}}
-; CHECK: for.body.peel.next1:
-; CHECK-NEXT: br label [[FOR_BODY_PEEL10:%.*]]
-; CHECK: for.body.peel10:
-; CHECK-NEXT: [[CMP1_PEEL11:%.*]] = icmp ugt i32 [[INC_PEEL7]], 2
-; CHECK-NEXT: br i1 [[CMP1_PEEL11]], label [[IF_THEN_PEEL13:%.*]], label [[IF_ELSE_PEEL12:%.*]]
-; CHECK: if.else.peel12:
-; CHECK-NEXT: call void @f2()
-; CHECK-NEXT: br label [[FOR_INC_PEEL14:%.*]]
-; CHECK: if.then.peel13:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[FOR_INC_PEEL14]]
-; CHECK: for.inc.peel14:
-; CHECK-NEXT: [[INC_PEEL15:%.*]] = add nsw i32 [[INC_PEEL7]], 1
-; CHECK-NEXT: [[CMP_PEEL16:%.*]] = icmp slt i32 [[INC_PEEL15]], [[K]]
-; CHECK-NEXT: br i1 [[CMP_PEEL16]], label [[FOR_BODY_PEEL_NEXT9:%.*]], label [[FOR_END]]
-; Verify that MD_loop metadata is dropped.
-; CHECK-NOT: , !llvm.loop !{{[0-9]*}}
-; CHECK: for.body.peel.next9:
-; CHECK-NEXT: br label [[FOR_BODY_PEEL_NEXT17:%.*]]
-; CHECK: for.body.peel.next17:
-; CHECK-NEXT: br label [[FOR_BODY_LR_PH_PEEL_NEWPH:%.*]]
-; CHECK: for.body.lr.ph.peel.newph:
-; CHECK-NEXT: br label [[FOR_BODY:%.*]]
-; CHECK: for.body:
-; CHECK-NEXT: [[I_05:%.*]] = phi i32 [ [[INC_PEEL15]], [[FOR_BODY_LR_PH_PEEL_NEWPH]] ], [ [[INC:%.*]], [[FOR_INC:%.*]] ]
-; CHECK-NEXT: br i1 true, label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
-; CHECK: if.then:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[FOR_INC]]
-; CHECK: if.else:
-; CHECK-NEXT: call void @f2()
-; CHECK-NEXT: br label [[FOR_INC]]
-; CHECK: for.inc:
-; CHECK-NEXT: [[INC]] = add nuw nsw i32 [[I_05]], 1
-; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[INC]], [[K]]
-; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END_LOOPEXIT:%.*]], !llvm.loop !{{.*}}
-; CHECK: for.end.loopexit:
-; CHECK-NEXT: br label [[FOR_END]]
-; CHECK: for.end:
-; CHECK-NEXT: ret void
-;
-for.body.lr.ph:
- br label %for.body
-
-for.body:
- %i.05 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.inc ]
- %cmp1 = icmp ugt i32 %i.05, 2
- br i1 %cmp1, label %if.then, label %if.else
-
-if.then:
- call void @f1()
- br label %for.inc
-
-if.else:
- call void @f2()
- br label %for.inc
-
-for.inc:
- %inc = add nsw i32 %i.05, 1
- %cmp = icmp slt i32 %inc, %k
- br i1 %cmp, label %for.body, label %for.end, !llvm.loop !3
-
-for.end:
- ret void
-}
-
-!3 = distinct !{!3}
-
-; Test that we only peel off iterations if it simplifies a condition in the
-; loop body after peeling at most MaxPeelCount iterations.
-define void @test4(i32 %k) {
-; CHECK-LABEL: @test4(
-; CHECK-NEXT: for.body.lr.ph:
-; CHECK-NEXT: br label [[FOR_BODY:%.*]]
-; CHECK: for.body:
-; CHECK-NEXT: [[I_05:%.*]] = phi i32 [ 0, [[FOR_BODY_LR_PH:%.*]] ], [ [[INC:%.*]], [[FOR_INC:%.*]] ]
-; CHECK-NEXT: [[CMP1:%.*]] = icmp ugt i32 [[I_05]], 9999
-; CHECK-NEXT: br i1 [[CMP1]], label [[IF_THEN:%.*]], label [[FOR_INC]]
-; CHECK: if.then:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[FOR_INC]]
-; CHECK: for.inc:
-; CHECK-NEXT: [[INC]] = add nsw i32 [[I_05]], 1
-; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[INC]], [[K:%.*]]
-; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END:%.*]]
-; CHECK: for.end:
-; CHECK-NEXT: ret void
-;
-for.body.lr.ph:
- br label %for.body
-
-for.body:
- %i.05 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.inc ]
- %cmp1 = icmp ugt i32 %i.05, 9999
- br i1 %cmp1, label %if.then, label %for.inc
-
-if.then:
- call void @f1()
- br label %for.inc
-
-for.inc:
- %inc = add nsw i32 %i.05, 1
- %cmp = icmp slt i32 %inc, %k
- br i1 %cmp, label %for.body, label %for.end
-
-for.end:
- ret void
-}
-
-; In this case we cannot peel the inner loop, because the condition involves
-; the outer induction variable.
-define void @test5(i32 %k) {
-; CHECK-LABEL: @test5(
-; CHECK-NEXT: for.body.lr.ph:
-; CHECK-NEXT: br label [[OUTER_HEADER:%.*]]
-; CHECK: outer.header:
-; CHECK-NEXT: [[J:%.*]] = phi i32 [ 0, [[FOR_BODY_LR_PH:%.*]] ], [ [[J_INC:%.*]], [[OUTER_INC:%.*]] ]
-; CHECK-NEXT: br label [[FOR_BODY:%.*]]
-; CHECK: for.body:
-; CHECK-NEXT: [[I_05:%.*]] = phi i32 [ 0, [[OUTER_HEADER]] ], [ [[INC:%.*]], [[FOR_INC:%.*]] ]
-; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i32 [[J]], 2
-; CHECK-NEXT: br i1 [[CMP1]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
-; CHECK: if.then:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[FOR_INC]]
-; CHECK: if.else:
-; CHECK-NEXT: call void @f2()
-; CHECK-NEXT: br label [[FOR_INC]]
-; CHECK: for.inc:
-; CHECK-NEXT: [[INC]] = add nsw i32 [[I_05]], 1
-; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[INC]], [[K:%.*]]
-; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[OUTER_INC]]
-; CHECK: outer.inc:
-; CHECK-NEXT: [[J_INC]] = add nsw i32 [[J]], 1
-; CHECK-NEXT: [[OUTER_CMP:%.*]] = icmp slt i32 [[J_INC]], [[K]]
-; CHECK-NEXT: br i1 [[OUTER_CMP]], label [[OUTER_HEADER]], label [[FOR_END:%.*]]
-; CHECK: for.end:
-; CHECK-NEXT: ret void
-;
-for.body.lr.ph:
- br label %outer.header
-
-outer.header:
- %j = phi i32 [ 0, %for.body.lr.ph ], [ %j.inc, %outer.inc ]
- br label %for.body
-
-for.body:
- %i.05 = phi i32 [ 0, %outer.header ], [ %inc, %for.inc ]
- %cmp1 = icmp ult i32 %j, 2
- br i1 %cmp1, label %if.then, label %if.else
-
-if.then:
- call void @f1()
- br label %for.inc
-
-if.else:
- call void @f2()
- br label %for.inc
-
-for.inc:
- %inc = add nsw i32 %i.05, 1
- %cmp = icmp slt i32 %inc, %k
- br i1 %cmp, label %for.body, label %outer.inc
-
-outer.inc:
- %j.inc = add nsw i32 %j, 1
- %outer.cmp = icmp slt i32 %j.inc, %k
- br i1 %outer.cmp, label %outer.header, label %for.end
-
-
-for.end:
- ret void
-}
-
-; In this test, the condition involves 2 AddRecs. Without evaluating both
-; AddRecs, we cannot prove that the condition becomes known in the loop body
-; after peeling.
-define void @test6(i32 %k) {
-; CHECK-LABEL: @test6(
-; CHECK-NEXT: entry:
-; CHECK-NEXT: br label [[FOR_BODY:%.*]]
-; CHECK: for.body:
-; CHECK-NEXT: [[I_05:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[FOR_INC:%.*]] ]
-; CHECK-NEXT: [[J:%.*]] = phi i32 [ 4, [[ENTRY]] ], [ [[J_INC:%.*]], [[FOR_INC]] ]
-; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i32 [[I_05]], [[J]]
-; CHECK-NEXT: br i1 [[CMP1]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
-; CHECK: if.then:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[FOR_INC]]
-; CHECK: if.else:
-; CHECK-NEXT: call void @f2()
-; CHECK-NEXT: br label [[FOR_INC]]
-; CHECK: for.inc:
-; CHECK-NEXT: [[INC]] = add nsw i32 [[I_05]], 2
-; CHECK-NEXT: [[J_INC]] = add nsw i32 [[J]], 1
-; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[INC]], [[K:%.*]]
-; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END:%.*]]
-; CHECK: for.end:
-; CHECK-NEXT: ret void
-;
-entry:
- br label %for.body
-
-for.body:
- %i.05 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
- %j = phi i32 [ 4, %entry ], [ %j.inc, %for.inc ]
- %cmp1 = icmp ult i32 %i.05, %j
- br i1 %cmp1, label %if.then, label %if.else
-
-if.then:
- call void @f1()
- br label %for.inc
-
-if.else:
- call void @f2()
- br label %for.inc
-
-for.inc:
- %inc = add nsw i32 %i.05, 2
- %j.inc = add nsw i32 %j, 1
- %cmp = icmp slt i32 %inc, %k
- br i1 %cmp, label %for.body, label %for.end
-
-for.end:
- ret void
-}
-
-define void @test7(i32 %k) {
-; FIXME: Could simplify loop body by peeling one additional iteration after
-; i != 3 becomes false
-; CHECK-LABEL: @test7(
-; CHECK-NEXT: for.body.lr.ph:
-; CHECK-NEXT: br label [[FOR_BODY:%.*]]
-; CHECK: for.body:
-; CHECK-NEXT: [[I_05:%.*]] = phi i32 [ 0, [[FOR_BODY_LR_PH:%.*]] ], [ [[INC:%.*]], [[FOR_INC:%.*]] ]
-; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i32 [[I_05]], 3
-; CHECK-NEXT: br i1 [[CMP1]], label [[IF_THEN:%.*]], label [[FOR_INC]]
-; CHECK: if.then:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[FOR_INC]]
-; CHECK: for.inc:
-; CHECK-NEXT: [[INC]] = add nsw i32 [[I_05]], 1
-; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[INC]], [[K:%.*]]
-; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END:%.*]]
-; CHECK: for.end:
-; CHECK-NEXT: ret void
-;
-for.body.lr.ph:
- br label %for.body
-
-for.body:
- %i.05 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.inc ]
- %cmp1 = icmp ne i32 %i.05, 3
- br i1 %cmp1, label %if.then, label %for.inc
-
-if.then:
- call void @f1()
- br label %for.inc
-
-for.inc:
- %inc = add nsw i32 %i.05, 1
- %cmp = icmp slt i32 %inc, %k
- br i1 %cmp, label %for.body, label %for.end
-
-for.end:
- ret void
-}
-
-define void @test8(i32 %k) {
-; FIXME: Could simplify loop body by peeling one additional iteration after
-; i == 3 becomes true.
-; CHECK-LABEL: @test8(
-; CHECK-NEXT: for.body.lr.ph:
-; CHECK-NEXT: br label [[FOR_BODY:%.*]]
-; CHECK: for.body:
-; CHECK-NEXT: [[I_05:%.*]] = phi i32 [ 0, [[FOR_BODY_LR_PH:%.*]] ], [ [[INC:%.*]], [[FOR_INC:%.*]] ]
-; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i32 [[I_05]], 3
-; CHECK-NEXT: br i1 [[CMP1]], label [[IF_THEN:%.*]], label [[FOR_INC]]
-; CHECK: if.then:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[FOR_INC]]
-; CHECK: for.inc:
-; CHECK-NEXT: [[INC]] = add nsw i32 [[I_05]], 1
-; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[INC]], [[K:%.*]]
-; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END:%.*]]
-; CHECK: for.end:
-; CHECK-NEXT: ret void
-;
-for.body.lr.ph:
- br label %for.body
-
-for.body:
- %i.05 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.inc ]
- %cmp1 = icmp eq i32 %i.05, 3
- br i1 %cmp1, label %if.then, label %for.inc
-
-if.then:
- call void @f1()
- br label %for.inc
-
-for.inc:
- %inc = add nsw i32 %i.05, 1
- %cmp = icmp slt i32 %inc, %k
- br i1 %cmp, label %for.body, label %for.end
-
-for.end:
- ret void
-}
-
-; Comparison with non-monotonic predicate due to possible wrapping, loop
-; body cannot be simplified.
-define void @test9(i32 %k) {
-; CHECK-LABEL: @test9(
-; CHECK-NEXT: for.body.lr.ph:
-; CHECK-NEXT: br label [[FOR_BODY:%.*]]
-; CHECK: for.body:
-; CHECK-NEXT: [[I_05:%.*]] = phi i32 [ 0, [[FOR_BODY_LR_PH:%.*]] ], [ [[INC:%.*]], [[FOR_INC:%.*]] ]
-; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[I_05]], 3
-; CHECK-NEXT: br i1 [[CMP1]], label [[IF_THEN:%.*]], label [[FOR_INC]]
-; CHECK: if.then:
-; CHECK-NEXT: call void @f1()
-; CHECK-NEXT: br label [[FOR_INC]]
-; CHECK: for.inc:
-; CHECK-NEXT: [[INC]] = add i32 [[I_05]], 1
-; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[INC]], [[K:%.*]]
-; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END:%.*]]
-; CHECK: for.end:
-; CHECK-NEXT: ret void
-;
-for.body.lr.ph:
- br label %for.body
-
-for.body:
- %i.05 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.inc ]
- %cmp1 = icmp slt i32 %i.05, 3
- br i1 %cmp1, label %if.then, label %for.inc
-
-if.then:
- call void @f1()
- br label %for.inc
-
-for.inc:
- %inc = add i32 %i.05, 1
- %cmp = icmp slt i32 %inc, %k
- br i1 %cmp, label %for.body, label %for.end
-
-for.end:
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/peel-loop-irreducible.ll b/llvm/test/Transforms/LoopUnroll/peel-loop-irreducible.ll
deleted file mode 100644
index 32a7a0732e1..00000000000
--- a/llvm/test/Transforms/LoopUnroll/peel-loop-irreducible.ll
+++ /dev/null
@@ -1,36 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-force-peel-count=1 | FileCheck %s
-
-; Check we don't peel loops where the latch is not the exiting block.
-; CHECK-LABEL: @invariant_backedge_irreducible
-; CHECK: entry:
-; CHECK: br label %header
-; CHECK-NOT: peel
-; CHECK: header:
-; CHECK: br i1 {{.*}} label %latch, label %exiting
-; CHECK: latch:
-; CHECK: br i1 {{.*}} label %header, label %exiting
-; CHECK: exiting:
-; CHECK: br i1 {{.*}} label %latch, label %exit
-
-define i32 @invariant_backedge_irreducible(i32 %a, i32 %b) {
-entry:
- br label %header
-
-header:
- %i = phi i32 [ 0, %entry ], [ %inc, %latch ]
- %cmp.phi = phi i1 [ false, %entry ], [ %cmp, %latch ]
- br i1 %cmp.phi, label %latch, label %exiting
-
-latch:
- %inc = add i32 %i, 1
- %cmp = icmp slt i32 %i, 1000
- br i1 %cmp, label %header, label %exiting
-
-exiting:
- %cmp.exiting = phi i1 [ %cmp.phi, %header ], [ %cmp, %latch ]
- br i1 %cmp.exiting, label %latch, label %exit
-
-exit:
- ret i32 0
-}
-
diff --git a/llvm/test/Transforms/LoopUnroll/peel-loop-negative.ll b/llvm/test/Transforms/LoopUnroll/peel-loop-negative.ll
deleted file mode 100644
index eab609a3002..00000000000
--- a/llvm/test/Transforms/LoopUnroll/peel-loop-negative.ll
+++ /dev/null
@@ -1,28 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-threshold=800 -unroll-peel-max-count=0 | FileCheck %s
-
-; We should not peel this loop even though we can, because the max count is set
-; to zero.
-define i32 @invariant_backedge_neg_1(i32 %a, i32 %b) {
-; CHECK-LABEL: @invariant_backedge_neg_1
-; CHECK-NOT loop.peel{{.*}}:
-; CHECK: loop:
-; CHECK: %i = phi
-; CHECK: %sum = phi
-; CHECK: %plus = phi
-entry:
- br label %loop
-
-loop:
- %i = phi i32 [ 0, %entry ], [ %inc, %loop ]
- %sum = phi i32 [ 0, %entry ], [ %incsum, %loop ]
- %plus = phi i32 [ %a, %entry ], [ %b, %loop ]
-
- %incsum = add i32 %sum, %plus
- %inc = add i32 %i, 1
- %cmp = icmp slt i32 %i, 1000
-
- br i1 %cmp, label %loop, label %exit
-
-exit:
- ret i32 %sum
-}
diff --git a/llvm/test/Transforms/LoopUnroll/peel-loop-not-forced.ll b/llvm/test/Transforms/LoopUnroll/peel-loop-not-forced.ll
deleted file mode 100644
index 468a58277eb..00000000000
--- a/llvm/test/Transforms/LoopUnroll/peel-loop-not-forced.ll
+++ /dev/null
@@ -1,199 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-threshold=30 | FileCheck %s
-; RUN: opt < %s -S -loop-unroll -unroll-threshold=30 -unroll-allow-peeling=false | FileCheck %s --check-prefix=DISABLE
-
-define i32 @invariant_backedge_1(i32 %a, i32 %b) {
-; CHECK-LABEL: @invariant_backedge_1
-; CHECK-NOT: %plus = phi
-; CHECK: loop.peel:
-; CHECK: loop:
-; CHECK: %i = phi
-; CHECK: %sum = phi
-; DISABLE-LABEL: @invariant_backedge_1
-; DISABLE-NOT: loop.peel:
-entry:
- br label %loop
-
-loop:
- %i = phi i32 [ 0, %entry ], [ %inc, %loop ]
- %sum = phi i32 [ 0, %entry ], [ %incsum, %loop ]
- %plus = phi i32 [ %a, %entry ], [ %b, %loop ]
-
- %incsum = add i32 %sum, %plus
- %inc = add i32 %i, 1
- %cmp = icmp slt i32 %i, 1000
-
- br i1 %cmp, label %loop, label %exit
-
-exit:
- ret i32 %sum
-}
-
-define i32 @invariant_backedge_2(i32 %a, i32 %b) {
-; This loop should be peeled twice because it has a Phi which becomes invariant
-; starting from 3rd iteration.
-; CHECK-LABEL: @invariant_backedge_2
-; CHECK: loop.peel{{.*}}:
-; CHECK: loop.peel{{.*}}:
-; CHECK: %i = phi
-; CHECK: %sum = phi
-; CHECK-NOT: %half.inv = phi
-; CHECK-NOT: %plus = phi
-entry:
- br label %loop
-
-loop:
- %i = phi i32 [ 0, %entry ], [ %inc, %loop ]
- %sum = phi i32 [ 0, %entry ], [ %incsum, %loop ]
- %half.inv = phi i32 [ %a, %entry ], [ %b, %loop ]
- %plus = phi i32 [ %a, %entry ], [ %half.inv, %loop ]
-
- %incsum = add i32 %sum, %plus
- %inc = add i32 %i, 1
- %cmp = icmp slt i32 %i, 1000
-
- br i1 %cmp, label %loop, label %exit
-
-exit:
- ret i32 %sum
-}
-
-define i32 @invariant_backedge_3(i32 %a, i32 %b) {
-; This loop should be peeled thrice because it has a Phi which becomes invariant
-; starting from 4th iteration.
-; CHECK-LABEL: @invariant_backedge_3
-; CHECK: loop.peel{{.*}}:
-; CHECK: loop.peel{{.*}}:
-; CHECK: loop.peel{{.*}}:
-; CHECK: %i = phi
-; CHECK: %sum = phi
-; CHECK-NOT: %half.inv = phi
-; CHECK-NOT: %half.inv.2 = phi
-; CHECK-NOT: %plus = phi
-entry:
- br label %loop
-
-loop:
- %i = phi i32 [ 0, %entry ], [ %inc, %loop ]
- %sum = phi i32 [ 0, %entry ], [ %incsum, %loop ]
- %half.inv = phi i32 [ %a, %entry ], [ %b, %loop ]
- %half.inv.2 = phi i32 [ %a, %entry ], [ %half.inv, %loop ]
- %plus = phi i32 [ %a, %entry ], [ %half.inv.2, %loop ]
-
- %incsum = add i32 %sum, %plus
- %inc = add i32 %i, 1
- %cmp = icmp slt i32 %i, 1000
-
- br i1 %cmp, label %loop, label %exit
-
-exit:
- ret i32 %sum
-}
-
-define i32 @invariant_backedge_limited_by_size(i32 %a, i32 %b) {
-; This loop should normally be peeled thrice because it has a Phi which becomes
-; invariant starting from 4th iteration, but the size of the loop only allows
-; us to peel twice because we are restricted to 30 instructions in resulting
-; code. Thus, %plus Phi node should stay in loop even despite its backedge
-; input is an invariant.
-; CHECK-LABEL: @invariant_backedge_limited_by_size
-; CHECK: loop.peel{{.*}}:
-; CHECK: loop.peel{{.*}}:
-; CHECK: %i = phi
-; CHECK: %sum = phi
-; CHECK: %plus = phi i32 [ %a, {{.*}} ], [ %b, %loop ]
-; CHECK-NOT: %half.inv = phi
-; CHECK-NOT: %half.inv.2 = phi
-entry:
- br label %loop
-
-loop:
- %i = phi i32 [ 0, %entry ], [ %inc, %loop ]
- %sum = phi i32 [ 0, %entry ], [ %incsum, %loop ]
- %half.inv = phi i32 [ %a, %entry ], [ %b, %loop ]
- %half.inv.2 = phi i32 [ %a, %entry ], [ %half.inv, %loop ]
- %plus = phi i32 [ %a, %entry ], [ %half.inv.2, %loop ]
-
- %incsum = add i32 %sum, %plus
- %inc = add i32 %i, 1
- %cmp = icmp slt i32 %i, 1000
-
- %incsum2 = add i32 %incsum, %plus
- %incsum3 = add i32 %incsum, %plus
- %incsum4 = add i32 %incsum, %plus
- %incsum5 = add i32 %incsum, %plus
- %incsum6 = add i32 %incsum, %plus
- %incsum7 = add i32 %incsum, %plus
-
- br i1 %cmp, label %loop, label %exit
-
-exit:
- ret i32 %sum
-}
-
-; Peeling should fail due to method size.
-define i32 @invariant_backedge_negative(i32 %a, i32 %b) {
-; CHECK-LABEL: @invariant_backedge_negative
-; CHECK-NOT: loop.peel{{.*}}:
-; CHECK: loop:
-; CHECK: %i = phi
-; CHECK: %sum = phi
-; CHECK: %plus = phi
-entry:
- br label %loop
-
-loop:
- %i = phi i32 [ 0, %entry ], [ %inc, %loop ]
- %sum = phi i32 [ 0, %entry ], [ %incsum2, %loop ]
- %plus = phi i32 [ %a, %entry ], [ %b, %loop ]
-
- %incsum = add i32 %sum, %plus
- %incsum2 = add i32 %incsum, %plus
- %incsum3 = add i32 %incsum, %plus
- %incsum4 = add i32 %incsum, %plus
- %incsum5 = add i32 %incsum, %plus
- %incsum6 = add i32 %incsum, %plus
- %incsum7 = add i32 %incsum, %plus
- %incsum8 = add i32 %incsum, %plus
- %incsum9 = add i32 %incsum, %plus
- %incsum10 = add i32 %incsum, %plus
- %incsum11 = add i32 %incsum, %plus
- %incsum12 = add i32 %incsum, %plus
- %incsum13 = add i32 %incsum, %plus
- %incsum14 = add i32 %incsum, %plus
- %incsum15 = add i32 %incsum, %plus
- %inc = add i32 %i, 1
- %cmp = icmp slt i32 %i, 1000
-
- br i1 %cmp, label %loop, label %exit
-
-exit:
- ret i32 %sum
-}
-
-define i32 @cycled_phis(i32 %a, i32 %b) {
-; Make sure that we do not crash working with cycled Phis and don't peel it.
-; TODO: Actually this loop should be partially unrolled with factor 2.
-; CHECK-LABEL: @cycled_phis
-; CHECK-NOT: loop.peel{{.*}}:
-; CHECK: loop:
-; CHECK: %i = phi
-; CHECK: %phi.a = phi
-; CHECK: %phi.b = phi
-; CHECK: %sum = phi
-entry:
- br label %loop
-
-loop:
- %i = phi i32 [ 0, %entry ], [ %inc, %loop ]
- %phi.a = phi i32 [ %a, %entry ], [ %phi.b, %loop ]
- %phi.b = phi i32 [ %b, %entry ], [ %phi.a, %loop ]
- %sum = phi i32 [ 0, %entry], [ %incsum, %loop ]
- %incsum = add i32 %sum, %phi.a
- %inc = add i32 %i, 1
- %cmp = icmp slt i32 %i, 1000
-
- br i1 %cmp, label %loop, label %exit
-
-exit:
- ret i32 %sum
-}
diff --git a/llvm/test/Transforms/LoopUnroll/peel-loop-pgo.ll b/llvm/test/Transforms/LoopUnroll/peel-loop-pgo.ll
deleted file mode 100644
index 361a2ca71c3..00000000000
--- a/llvm/test/Transforms/LoopUnroll/peel-loop-pgo.ll
+++ /dev/null
@@ -1,110 +0,0 @@
-; RUN: opt < %s -S -debug-only=loop-unroll -loop-unroll 2>&1 | FileCheck %s
-; RUN: opt < %s -S -debug-only=loop-unroll -passes='require<profile-summary>,function(require<opt-remark-emit>,unroll)' 2>&1 | FileCheck %s
-; Confirm that peeling is disabled if the number of counts required to reach
-; the hot percentile is above the threshold.
-; RUN: opt < %s -S -profile-summary-huge-working-set-size-threshold=9 -debug-only=loop-unroll -passes='require<profile-summary>,function(require<opt-remark-emit>,unroll)' 2>&1 | FileCheck %s --check-prefix=NOPEEL
-; REQUIRES: asserts
-
-; Make sure we use the profile information correctly to peel-off 3 iterations
-; from the loop, and update the branch weights for the peeled loop properly.
-
-; CHECK: Loop Unroll: F[basic]
-; CHECK: PEELING loop %for.body with iteration count 3!
-; CHECK: Loop Unroll: F[optsize]
-; CHECK-NOT: PEELING
-
-; Confirm that no peeling occurs when we are performing full unrolling.
-; RUN: opt < %s -S -debug-only=loop-unroll -passes='require<opt-remark-emit>,loop(unroll-full)' 2>&1 | FileCheck %s --check-prefix=NOPEEL
-; NOPEEL-NOT: PEELING
-
-; CHECK-LABEL: @basic
-; CHECK: br i1 %{{.*}}, label %[[NEXT0:.*]], label %for.cond.for.end_crit_edge, !prof !15
-; CHECK: [[NEXT0]]:
-; CHECK: br i1 %{{.*}}, label %[[NEXT1:.*]], label %for.cond.for.end_crit_edge, !prof !16
-; CHECK: [[NEXT1]]:
-; CHECK: br i1 %{{.*}}, label %[[NEXT2:.*]], label %for.cond.for.end_crit_edge, !prof !17
-; CHECK: [[NEXT2]]:
-; CHECK: br i1 %{{.*}}, label %for.body, label %{{.*}}, !prof !18
-
-define void @basic(i32* %p, i32 %k) #0 !prof !15 {
-entry:
- %cmp3 = icmp slt i32 0, %k
- br i1 %cmp3, label %for.body.lr.ph, label %for.end
-
-for.body.lr.ph: ; preds = %entry
- br label %for.body
-
-for.body: ; preds = %for.body.lr.ph, %for.body
- %i.05 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
- %p.addr.04 = phi i32* [ %p, %for.body.lr.ph ], [ %incdec.ptr, %for.body ]
- %incdec.ptr = getelementptr inbounds i32, i32* %p.addr.04, i32 1
- store i32 %i.05, i32* %p.addr.04, align 4
- %inc = add nsw i32 %i.05, 1
- %cmp = icmp slt i32 %inc, %k
- br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge, !prof !16
-
-for.cond.for.end_crit_edge: ; preds = %for.body
- br label %for.end
-
-for.end: ; preds = %for.cond.for.end_crit_edge, %entry
- ret void
-}
-
-; We don't want to peel loops when optimizing for size.
-; CHECK-LABEL: @optsize
-; CHECK: for.body.lr.ph:
-; CHECK-NEXT: br label %for.body
-; CHECK: for.body:
-; CHECK-NOT: br
-; CHECK: br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge
-define void @optsize(i32* %p, i32 %k) #1 !prof !15 {
-entry:
- %cmp3 = icmp slt i32 0, %k
- br i1 %cmp3, label %for.body.lr.ph, label %for.end
-
-for.body.lr.ph: ; preds = %entry
- br label %for.body
-
-for.body: ; preds = %for.body.lr.ph, %for.body
- %i.05 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
- %p.addr.04 = phi i32* [ %p, %for.body.lr.ph ], [ %incdec.ptr, %for.body ]
- %incdec.ptr = getelementptr inbounds i32, i32* %p.addr.04, i32 1
- store i32 %i.05, i32* %p.addr.04, align 4
- %inc = add nsw i32 %i.05, 1
- %cmp = icmp slt i32 %inc, %k
- br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge, !prof !16
-
-for.cond.for.end_crit_edge: ; preds = %for.body
- br label %for.end
-
-for.end: ; preds = %for.cond.for.end_crit_edge, %entry
- ret void
-}
-
-attributes #0 = { nounwind }
-attributes #1 = { nounwind optsize }
-
-!llvm.module.flags = !{!1}
-
-!1 = !{i32 1, !"ProfileSummary", !2}
-!2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
-!3 = !{!"ProfileFormat", !"InstrProf"}
-!4 = !{!"TotalCount", i64 10}
-!5 = !{!"MaxCount", i64 3}
-!6 = !{!"MaxInternalCount", i64 1}
-!7 = !{!"MaxFunctionCount", i64 3}
-!8 = !{!"NumCounts", i64 2}
-!9 = !{!"NumFunctions", i64 2}
-!10 = !{!"DetailedSummary", !11}
-!11 = !{!12, !13, !14}
-!12 = !{i32 10000, i64 3, i32 2}
-!13 = !{i32 999000, i64 1, i32 10}
-!14 = !{i32 999999, i64 1, i32 10}
-!15 = !{!"function_entry_count", i64 1}
-!16 = !{!"branch_weights", i32 3001, i32 1001}
-
-;CHECK: !15 = !{!"branch_weights", i32 900, i32 101}
-;CHECK: !16 = !{!"branch_weights", i32 540, i32 360}
-;CHECK: !17 = !{!"branch_weights", i32 162, i32 378}
-;CHECK: !18 = !{!"branch_weights", i32 1399, i32 162}
-
diff --git a/llvm/test/Transforms/LoopUnroll/peel-loop-scev-invalidate.ll b/llvm/test/Transforms/LoopUnroll/peel-loop-scev-invalidate.ll
deleted file mode 100644
index c44da31cebd..00000000000
--- a/llvm/test/Transforms/LoopUnroll/peel-loop-scev-invalidate.ll
+++ /dev/null
@@ -1,42 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -S -loop-unroll -unroll-force-peel-count=1 -verify-scev -verify-dom-info | FileCheck %s
-
-
-define void @test1(i32 %k) {
-; CHECK-LABEL: @test1(
-; CHECK-NEXT: entry:
-; CHECK-NEXT: br label [[FOR_BODY_PEEL_BEGIN:%.*]]
-; CHECK: for.body.peel.begin:
-; CHECK-NEXT: br label [[FOR_BODY_PEEL:%.*]]
-; CHECK: for.body.peel:
-; CHECK-NEXT: [[INC_PEEL:%.*]] = add nsw i32 0, 1
-; CHECK-NEXT: [[CMP_PEEL:%.*]] = icmp ult i32 0, [[K:%.*]]
-; CHECK-NEXT: br i1 [[CMP_PEEL]], label [[FOR_BODY_PEEL_NEXT:%.*]], label [[FOR_END:%.*]]
-; CHECK: for.body.peel.next:
-; CHECK-NEXT: br label [[FOR_BODY_PEEL_NEXT1:%.*]]
-; CHECK: for.body.peel.next1:
-; CHECK-NEXT: br label [[ENTRY_PEEL_NEWPH:%.*]]
-; CHECK: entry.peel.newph:
-; CHECK-NEXT: br label [[FOR_BODY:%.*]]
-; CHECK: for.body:
-; CHECK-NEXT: [[I_05:%.*]] = phi i32 [ [[INC_PEEL]], [[ENTRY_PEEL_NEWPH]] ], [ [[INC:%.*]], [[FOR_BODY]] ]
-; CHECK-NEXT: [[INC]] = add nuw nsw i32 [[I_05]], 1
-; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[I_05]], [[K]]
-; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END_LOOPEXIT:%.*]], !llvm.loop !0
-; CHECK: for.end.loopexit:
-; CHECK-NEXT: br label [[FOR_END]]
-; CHECK: for.end:
-; CHECK-NEXT: ret void
-;
-entry:
- br label %for.body
-
-for.body:
- %i.05 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
- %inc = add nsw i32 %i.05, 1
- %cmp = icmp ult i32 %i.05, %k
- br i1 %cmp, label %for.body, label %for.end
-
-for.end:
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/peel-loop.ll b/llvm/test/Transforms/LoopUnroll/peel-loop.ll
deleted file mode 100644
index eb3d29cb494..00000000000
--- a/llvm/test/Transforms/LoopUnroll/peel-loop.ll
+++ /dev/null
@@ -1,115 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-force-peel-count=3 -verify-dom-info -simplifycfg -instcombine | FileCheck %s
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll,simplify-cfg,instcombine' -unroll-force-peel-count=3 -verify-dom-info | FileCheck %s
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll<peeling;no-runtime>,simplify-cfg,instcombine' -unroll-force-peel-count=3 -verify-dom-info | FileCheck %s
-
-; Basic loop peeling - check that we can peel-off the first 3 loop iterations
-; when explicitly requested.
-; CHECK-LABEL: @basic
-; CHECK: %[[CMP0:.*]] = icmp sgt i32 %k, 0
-; CHECK: br i1 %[[CMP0]], label %[[NEXT0:.*]], label %for.end
-; CHECK: [[NEXT0]]:
-; CHECK: store i32 0, i32* %p, align 4
-; CHECK: %[[CMP1:.*]] = icmp eq i32 %k, 1
-; CHECK: br i1 %[[CMP1]], label %for.end, label %[[NEXT1:[^,]*]]
-; Verify that MD_loop metadata is dropped.
-; CHECK-NOT: , !llvm.loop !{{[0-9]*}}
-; CHECK: [[NEXT1]]:
-; CHECK: %[[INC1:.*]] = getelementptr inbounds i32, i32* %p, i64 1
-; CHECK: store i32 1, i32* %[[INC1]], align 4
-; CHECK: %[[CMP2:.*]] = icmp sgt i32 %k, 2
-; CHECK: br i1 %[[CMP2]], label %[[NEXT2:.*]], label %for.end
-; Verify that MD_loop metadata is dropped.
-; CHECK-NOT: , !llvm.loop !{{[0-9]*}}
-; CHECK: [[NEXT2]]:
-; CHECK: %[[INC2:.*]] = getelementptr inbounds i32, i32* %p, i64 2
-; CHECK: store i32 2, i32* %[[INC2]], align 4
-; CHECK: %[[CMP3:.*]] = icmp eq i32 %k, 3
-; CHECK: br i1 %[[CMP3]], label %for.end, label %[[LOOP_PH:[^,]*]]
-; Verify that MD_loop metadata is dropped.
-; CHECK-NOT: , !llvm.loop !{{[0-9]*}}
-; CHECK: br i1 %[[CMP4:.*]], label %[[LOOP_PH]], label %for.end, !llvm.loop !{{.*}}
-; CHECK: for.end:
-; CHECK: ret void
-
-define void @basic(i32* %p, i32 %k) #0 {
-entry:
- %cmp3 = icmp slt i32 0, %k
- br i1 %cmp3, label %for.body.lr.ph, label %for.end
-
-for.body.lr.ph: ; preds = %entry
- br label %for.body
-
-for.body: ; preds = %for.body.lr.ph, %for.body
- %i.05 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
- %p.addr.04 = phi i32* [ %p, %for.body.lr.ph ], [ %incdec.ptr, %for.body ]
- %incdec.ptr = getelementptr inbounds i32, i32* %p.addr.04, i32 1
- store i32 %i.05, i32* %p.addr.04, align 4
- %inc = add nsw i32 %i.05, 1
- %cmp = icmp slt i32 %inc, %k
- br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge, !llvm.loop !1
-
-for.cond.for.end_crit_edge: ; preds = %for.body
- br label %for.end
-
-for.end: ; preds = %for.cond.for.end_crit_edge, %entry
- ret void
-}
-
-!1 = distinct !{!1}
-
-; Make sure peeling works correctly when a value defined in a loop is used
-; in later code - we need to correctly plumb the phi depending on which
-; iteration is actually used.
-; CHECK-LABEL: @output
-; CHECK: %[[CMP0:.*]] = icmp sgt i32 %k, 0
-; CHECK: br i1 %[[CMP0]], label %[[NEXT0:.*]], label %for.end
-; CHECK: [[NEXT0]]:
-; CHECK: store i32 0, i32* %p, align 4
-; CHECK: %[[CMP1:.*]] = icmp eq i32 %k, 1
-; CHECK: br i1 %[[CMP1]], label %for.end, label %[[NEXT1:[^,]*]]
-; Verify that MD_loop metadata is dropped.
-; CHECK-NOT: , !llvm.loop !{{[0-9]*}}
-; CHECK: [[NEXT1]]:
-; CHECK: %[[INC1:.*]] = getelementptr inbounds i32, i32* %p, i64 1
-; CHECK: store i32 1, i32* %[[INC1]], align 4
-; CHECK: %[[CMP2:.*]] = icmp sgt i32 %k, 2
-; CHECK: br i1 %[[CMP2]], label %[[NEXT2:.*]], label %for.end
-; Verify that MD_loop metadata is dropped.
-; CHECK-NOT: , !llvm.loop !{{[0-9]*}}
-; CHECK: [[NEXT2]]:
-; CHECK: %[[INC2:.*]] = getelementptr inbounds i32, i32* %p, i64 2
-; CHECK: store i32 2, i32* %[[INC2]], align 4
-; CHECK: %[[CMP3:.*]] = icmp eq i32 %k, 3
-; CHECK: br i1 %[[CMP3]], label %for.end, label %[[LOOP_PH:[^,]*]]
-; Verify that MD_loop metadata is dropped.
-; CHECK-NOT: , !llvm.loop !{{[0-9]*}}
-; CHECK: br i1 %[[CMP4:.*]], label %[[LOOP_PH]], label %for.end, !llvm.loop !{{.*}}
-; CHECK: for.end:
-; CHECK: %ret = phi i32 [ 0, %entry ], [ 1, %[[NEXT0]] ], [ 2, %[[NEXT1]] ], [ 3, %[[NEXT2]] ], [ %inc, %for.body ]
-; CHECK: ret i32 %ret
-define i32 @output(i32* %p, i32 %k) #0 {
-entry:
- %cmp3 = icmp slt i32 0, %k
- br i1 %cmp3, label %for.body.lr.ph, label %for.end
-
-for.body.lr.ph: ; preds = %entry
- br label %for.body
-
-for.body: ; preds = %for.body.lr.ph, %for.body
- %i.05 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
- %p.addr.04 = phi i32* [ %p, %for.body.lr.ph ], [ %incdec.ptr, %for.body ]
- %incdec.ptr = getelementptr inbounds i32, i32* %p.addr.04, i32 1
- store i32 %i.05, i32* %p.addr.04, align 4
- %inc = add nsw i32 %i.05, 1
- %cmp = icmp slt i32 %inc, %k
- br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge, !llvm.loop !2
-
-for.cond.for.end_crit_edge: ; preds = %for.body
- br label %for.end
-
-for.end: ; preds = %for.cond.for.end_crit_edge, %entry
- %ret = phi i32 [ 0, %entry], [ %inc, %for.cond.for.end_crit_edge ]
- ret i32 %ret
-}
-
-!2 = distinct !{!2}
diff --git a/llvm/test/Transforms/LoopUnroll/peel-loop2.ll b/llvm/test/Transforms/LoopUnroll/peel-loop2.ll
deleted file mode 100644
index 99e90797e19..00000000000
--- a/llvm/test/Transforms/LoopUnroll/peel-loop2.ll
+++ /dev/null
@@ -1,61 +0,0 @@
-; RUN: opt -S -loop-unroll -unroll-force-peel-count=1 -verify-dom-info <%s
-
-; Check if loop composed of several BBs is peeled correctly.
-
-declare void @funcb()
-@Comma = external global i8
-define void @funca(i8* readnone %b, i8* readnone %e) {
-entry:
- %cmp2 = icmp eq i8* %b, %e
- br i1 %cmp2, label %for.end, label %for.body.preheader
-
-for.body.preheader:
- br label %for.body
-
-for.body:
- %b.addr.03 = phi i8* [ %incdec.ptr, %for.inc ], [ %b, %for.body.preheader ]
- %0 = load i8, i8* @Comma
- %tobool = icmp eq i8 %0, 0
- br i1 %tobool, label %for.inc, label %if.then
-
-if.then:
- tail call void @funcb()
- store i8 1, i8* @Comma
- br label %for.inc
-
-for.inc:
- %incdec.ptr = getelementptr inbounds i8, i8* %b.addr.03, i64 1
- %cmp = icmp eq i8* %incdec.ptr, %e
- br i1 %cmp, label %for.end, label %for.body
-
-for.end:
- ret void
-}
-
-; CHECK_LABEL: @funca
-
-; Peeled iteration
-; CHECK: %[[REG1:[0-9]+]] = load i8, i8* @Comma
-; CHECK: %[[REG2:.*]] = icmp eq i8 %[[REG1]], 0
-; CHECK: br i1 %[[REG2]], label %{{.*}}, label %[[IFTHEN:.*]]
-; CHECK: [[IFTHEN]]:
-; CHECK: call void @funcb()
-; CHECK: store i8 1, i8* @Comma
-; CHECK: br label %[[FORINC]]
-; CHECK: [[FORINC]]:
-; CHECK: %[[REG3:.*]] = getelementptr inbounds i8, i8* %b, i64 1
-; CHECK: %[[REG4:.*]] = icmp eq i8* %[[REG3]], %e
-; CHECK: br i1 %[[REG4]]
-
-; main body
-; CHECK: %[[REG1b:.*]] = load i8, i8* @Comma
-; CHECK: %[[REG2b:.*]] = icmp eq i8 %[[REG1b]], 0
-; CHECK: br i1 %[[REG2b]], label %{{.*}}, label %[[IFTHENb:.*]]
-; CHECK: [[IFTHENb]]:
-; CHECK: call void @funcb()
-; CHECK: store i8 1, i8* @Comma
-; CHECK: br label %[[FORINCb]]
-; CHECK: [[FORINCb]]:
-; CHECK: %[[REG3b:.*]] = getelementptr inbounds i8, i8* %b, i64 1
-; CHECK: %[[REG4b:.*]] = icmp eq i8* %[[REG3b]], %e
-; CHECK: br i1 %[[REG4b]]
diff --git a/llvm/test/Transforms/LoopUnroll/pr10813.ll b/llvm/test/Transforms/LoopUnroll/pr10813.ll
deleted file mode 100644
index 7daefc2f788..00000000000
--- a/llvm/test/Transforms/LoopUnroll/pr10813.ll
+++ /dev/null
@@ -1,29 +0,0 @@
-; RUN: opt < %s -loop-unroll -disable-output
-
-define void @"f_fu___REFUf[]REFUf[]Uf"() nounwind {
-allocas:
- br i1 undef, label %cif_mask_all, label %cif_mixed_test_all
-
-cif_mask_all: ; preds = %allocas
- unreachable
-
-cif_mixed_test_all: ; preds = %allocas
- br label %pl_loop.i964
-
-pl_loop.i964: ; preds = %pl_loopend.i973, %cif_mixed_test_all
- %0 = phi i32 [ %pl_nextlane.i971, %pl_loopend.i973 ], [ 0, %cif_mixed_test_all ]
- br i1 undef, label %pl_dolane.i970, label %pl_loopend.i973
-
-pl_dolane.i970: ; preds = %pl_loop.i964
- %storeval.i.i969 = extractelement <4 x i8> <i8 0, i8 1, i8 2, i8 3>, i32 %0
- store i8 %storeval.i.i969, i8* undef, align 1
- br label %pl_loopend.i973
-
-pl_loopend.i973: ; preds = %pl_dolane.i970, %pl_loop.i964
- %pl_nextlane.i971 = add i32 %0, 1
- %exitcond5 = icmp ne i32 %pl_nextlane.i971, 5
- br i1 %exitcond5, label %pl_loop.i964, label %__scatter_base_offsets_i8.exit974
-
-__scatter_base_offsets_i8.exit974: ; preds = %pl_loopend.i973
- unreachable
-}
diff --git a/llvm/test/Transforms/LoopUnroll/pr11361.ll b/llvm/test/Transforms/LoopUnroll/pr11361.ll
deleted file mode 100644
index 62de2f728d2..00000000000
--- a/llvm/test/Transforms/LoopUnroll/pr11361.ll
+++ /dev/null
@@ -1,42 +0,0 @@
-; RUN: opt -loop-unroll -disable-output < %s
-; PR11361
-
-; This tests for an iterator invalidation issue.
-
-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-unknown-linux-gnu"
-
-define void @func_1() nounwind uwtable {
-entry:
- br label %for.cond8.preheader
-
-for.cond8.preheader: ; preds = %for.inc15, %entry
- %l_1264.04 = phi i32 [ 0, %entry ], [ %add.i, %for.inc15 ]
- %l_1330.0.03 = phi i80 [ undef, %entry ], [ %ins.lcssa, %for.inc15 ]
- br label %for.body9
-
-for.body9: ; preds = %for.body9, %for.cond8.preheader
- %l_1330.0.12 = phi i80 [ %l_1330.0.03, %for.cond8.preheader ], [ %ins, %for.body9 ]
- %storemerge1 = phi i32 [ 7, %for.cond8.preheader ], [ %sub, %for.body9 ]
- %tmp = lshr i80 %l_1330.0.12, 8
- %tmp1 = trunc i80 %tmp to i8
- %inc12 = add i8 %tmp1, 1
- %tmp2 = zext i8 %inc12 to i80
- %tmp3 = shl nuw nsw i80 %tmp2, 8
- %mask = and i80 %l_1330.0.12, -65281
- %ins = or i80 %tmp3, %mask
- %sub = add nsw i32 %storemerge1, -1
- %tobool = icmp eq i32 %sub, 0
- br i1 %tobool, label %for.inc15, label %for.body9
-
-for.inc15: ; preds = %for.body9
- %ins.lcssa = phi i80 [ %ins, %for.body9 ]
- %sext = shl i32 %l_1264.04, 24
- %conv.i = ashr exact i32 %sext, 24
- %add.i = add nsw i32 %conv.i, 1
- %cmp = icmp slt i32 %add.i, 3
- br i1 %cmp, label %for.cond8.preheader, label %for.end16
-
-for.end16: ; preds = %for.inc15
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/pr14167.ll b/llvm/test/Transforms/LoopUnroll/pr14167.ll
deleted file mode 100644
index 9aac70115d9..00000000000
--- a/llvm/test/Transforms/LoopUnroll/pr14167.ll
+++ /dev/null
@@ -1,44 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-runtime | 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-v128:128:128-n32:64"
-target triple = "powerpc64-bgq-linux"
-
-define void @test1() nounwind {
-; Ensure that we don't crash when the trip count == -1.
-; CHECK-LABEL: @test1(
-entry:
- br label %for.cond2.preheader
-
-for.cond2.preheader: ; preds = %for.end, %entry
- br i1 false, label %middle.block, label %vector.ph
-
-vector.ph: ; preds = %for.cond2.preheader
- br label %vector.body
-
-vector.body: ; preds = %vector.body, %vector.ph
- br i1 undef, label %middle.block.loopexit, label %vector.body
-
-middle.block.loopexit: ; preds = %vector.body
- br label %middle.block
-
-middle.block: ; preds = %middle.block.loopexit, %for.cond2.preheader
- br i1 true, label %for.end, label %scalar.preheader
-
-scalar.preheader: ; preds = %middle.block
- br label %for.body4
-
-for.body4: ; preds = %for.body4, %scalar.preheader
- %indvars.iv = phi i64 [ 16000, %scalar.preheader ], [ %indvars.iv.next, %for.body4 ]
- %indvars.iv.next = add i64 %indvars.iv, 1
- %lftr.wideiv = trunc i64 %indvars.iv.next to i32
- %exitcond = icmp ne i32 %lftr.wideiv, 16000
- br i1 %exitcond, label %for.body4, label %for.end.loopexit
-
-for.end.loopexit: ; preds = %for.body4
- br label %for.end
-
-for.end: ; preds = %for.end.loopexit, %middle.block
- br i1 undef, label %for.cond2.preheader, label %for.end15
-
-for.end15: ; preds = %for.end
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/pr18861.ll b/llvm/test/Transforms/LoopUnroll/pr18861.ll
deleted file mode 100644
index c01eef1d0e5..00000000000
--- a/llvm/test/Transforms/LoopUnroll/pr18861.ll
+++ /dev/null
@@ -1,86 +0,0 @@
-; RUN: opt < %s -loop-unroll -indvars -disable-output
-
-@b = external global i32, align 4
-
-; Test that LoopUnroll does not break LCSSA form.
-;
-; In this function we have a following CFG:
-; ( entry )
-; |
-; v
-; ( outer.header ) <--
-; | \
-; v |
-; --> ( inner.header ) |
-; / / \ |
-; \ / \ |
-; \ v v /
-; ( inner.latch ) ( outer.latch )
-; |
-; v
-; ( exit )
-;
-; When the inner loop is unrolled, we inner.latch block has only one
-; predecessor and one successor, so it can be merged with exit block.
-; During the merge, however, we remove an LCSSA definition for
-; %storemerge1.lcssa, breaking LCSSA form for the outer loop.
-
-; Function Attrs: nounwind uwtable
-define void @fn1() #0 {
-entry:
- br label %outer.header
-
-outer.header: ; preds = %outer.latch, %entry
- %storemerge1 = phi i32 [ 0, %entry ], [ %inc9, %outer.latch ]
- br label %inner.header
-
-inner.header: ; preds = %inner.latch, %outer.header
- %storemerge = phi i32 [ %add, %inner.latch ], [ 0, %outer.header ]
- %cmp = icmp slt i32 %storemerge, 1
- br i1 %cmp, label %inner.latch, label %outer.latch
-
-inner.latch: ; preds = %inner.header
- %tobool4 = icmp eq i32 %storemerge, 0
- %add = add nsw i32 %storemerge, 1
- br i1 %tobool4, label %inner.header, label %exit
-
-exit: ; preds = %inner.latch
- %storemerge1.lcssa = phi i32 [ %storemerge1, %inner.latch ]
- store i32 %storemerge1.lcssa, i32* @b, align 4
- ret void
-
-outer.latch: ; preds = %inner.header
- %inc9 = add nsw i32 %storemerge1, 1
- br label %outer.header
-}
-
-; This case is similar to the previous one, and has the same CFG.
-; The difference is that loop unrolling doesn't remove any LCSSA definition,
-; yet breaks LCSSA form for the outer loop. It happens because before unrolling
-; block inner.latch was inside outer loop (and consequently, didn't require
-; LCSSA definition for %x), but after unrolling it occurs out of the outer
-; loop, so we need to insert an LCSSA definition to keep LCSSA.
-
-; Function Attrs: nounwind uwtable
-define void @fn2() {
-entry:
- br label %outer.header
-
-outer.header:
- br label %inner.header
-
-inner.header:
- %x = load i32, i32* undef, align 4
- br i1 true, label %outer.latch, label %inner.latch
-
-inner.latch:
- %inc6 = add nsw i32 %x, 1
- store i32 %inc6, i32* undef, align 4
- br i1 false, label %inner.header, label %exit
-
-exit:
- ret void
-
-outer.latch:
- br label %outer.header
-}
diff --git a/llvm/test/Transforms/LoopUnroll/pr27157.ll b/llvm/test/Transforms/LoopUnroll/pr27157.ll
deleted file mode 100644
index 917bcf1f944..00000000000
--- a/llvm/test/Transforms/LoopUnroll/pr27157.ll
+++ /dev/null
@@ -1,53 +0,0 @@
-; RUN: opt -loop-unroll -debug-only=loop-unroll -disable-output < %s
-; REQUIRES: asserts
-; Compile this test with debug flag on to verify domtree right after loop unrolling.
-target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64"
-
-; PR27157
-define void @foo() {
-entry:
- br label %loop_header
-loop_header:
- %iv = phi i64 [ 0, %entry ], [ %iv_next, %loop_latch ]
- br i1 undef, label %loop_latch, label %loop_exiting_bb1
-loop_exiting_bb1:
- br i1 false, label %loop_exiting_bb2, label %exit1.loopexit
-loop_exiting_bb2:
- br i1 false, label %loop_latch, label %bb
-bb:
- br label %exit1
-loop_latch:
- %iv_next = add nuw nsw i64 %iv, 1
- %cmp = icmp ne i64 %iv_next, 2
- br i1 %cmp, label %loop_header, label %exit2
-exit1.loopexit:
- br label %exit1
-exit1:
- ret void
-exit2:
- ret void
-}
-
-define void @foo2() {
-entry:
- br label %loop.header
-loop.header:
- %iv = phi i32 [ 0, %entry ], [ %iv.inc, %latch ]
- %iv.inc = add i32 %iv, 1
- br i1 undef, label %diamond, label %latch
-diamond:
- br i1 undef, label %left, label %right
-left:
- br i1 undef, label %exit, label %merge
-right:
- br i1 undef, label %exit, label %merge
-merge:
- br label %latch
-latch:
- %end.cond = icmp eq i32 %iv, 1
- br i1 %end.cond, label %exit1, label %loop.header
-exit:
- ret void
-exit1:
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/pr28132.ll b/llvm/test/Transforms/LoopUnroll/pr28132.ll
deleted file mode 100644
index dc2c0b88023..00000000000
--- a/llvm/test/Transforms/LoopUnroll/pr28132.ll
+++ /dev/null
@@ -1,77 +0,0 @@
-; RUN: opt -loop-unroll -S < %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 void @fn1(i8*)
-
-declare i1 @fn2(i8*, i8*)
-
-define void @fn4() personality i32 (...)* @__CxxFrameHandler3 {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.inc, %entry
- %i.05 = phi i8 [ 0, %entry ], [ %inc, %for.inc ]
- store i8 undef, i8* undef, align 4
- invoke void @fn1(i8* undef)
- to label %call.i.noexc unwind label %ehcleanup
-
-call.i.noexc: ; preds = %for.body
- %call1.i2 = invoke i1 @fn2(i8* undef, i8* undef)
- to label %call1.i.noexc unwind label %ehcleanup
-
-call1.i.noexc: ; preds = %call.i.noexc
- br i1 undef, label %if.then.i, label %if.end4.i
-
-if.then.i: ; preds = %call1.i.noexc
- %tmp1 = load i8, i8* undef, align 4
- %tobool.i = icmp eq i8 undef, undef
- br i1 undef, label %if.end4.i, label %if.then2.i
-
-if.then2.i: ; preds = %if.then.i
- %call3.i3 = invoke i1 @fn2(i8* undef, i8* null)
- to label %call3.i.noexc unwind label %ehcleanup
-
-call3.i.noexc: ; preds = %if.then2.i
- br label %if.end4.i
-
-if.end4.i: ; preds = %call3.i.noexc, %if.then.i, %call1.i.noexc
- %tmp2 = load i8, i8* undef, align 4
- br label %if.then6.i
-
-if.then6.i: ; preds = %if.end4.i
- %call7.i4 = invoke i1 @fn2(i8* undef, i8* null)
- to label %call7.i.noexc unwind label %ehcleanup
-
-call7.i.noexc: ; preds = %if.then6.i
- br label %fn3
-
-fn3: ; preds = %call7.i.noexc
- %tmp3 = load i8, i8* undef, align 4
- %inc.i = add nsw i8 undef, undef
- store i8 undef, i8* undef, align 4
- br label %for.inc
-
-for.inc: ; preds = %fn3
- %inc = add nsw i8 %i.05, 1
- %cmp = icmp slt i8 %inc, 6
- br i1 %cmp, label %for.body, label %for.end
-
-for.end: ; preds = %for.inc
- invoke void @throw()
- to label %unreachable unwind label %ehcleanup
-
-ehcleanup: ; preds = %for.end, %if.then6.i, %if.then2.i, %call.i.noexc, %for.body
- %cp = cleanuppad within none []
- cleanupret from %cp unwind to caller
-
-; CHECK: cleanuppad
-; CHECK-NOT: cleanuppad
-
-unreachable: ; preds = %for.end
- unreachable
-}
-
-declare i32 @__CxxFrameHandler3(...)
-
-declare void @throw()
diff --git a/llvm/test/Transforms/LoopUnroll/pr31718.ll b/llvm/test/Transforms/LoopUnroll/pr31718.ll
deleted file mode 100644
index 014ef7e501e..00000000000
--- a/llvm/test/Transforms/LoopUnroll/pr31718.ll
+++ /dev/null
@@ -1,55 +0,0 @@
-; RUN: opt -loop-unroll -verify-loop-lcssa -S < %s | FileCheck %s
-
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
-@b = external local_unnamed_addr global i32, align 4
-
-; CHECK-LABEL: @main
-; CHECK: exit.loopexit:
-; CHECK: {{.*}} = phi i32 [ %d.0, %h3 ]
-; CHECK: br label %exit
-; CHECK: exit.loopexit1:
-; CHECK: {{.*}} = phi i32 [ %d.0, %h3.1 ]
-; CHECK: br label %exit
-
-define void @main() local_unnamed_addr #0 {
-ph1:
- br label %h1
-
-h1:
- %d.0 = phi i32 [ %1, %latch1 ], [ undef, %ph1 ]
- br label %ph2
-
-ph2:
- br label %h2
-
-h2:
- %0 = phi i32 [ 0, %ph2 ], [ %inc, %latch2 ]
- br label %h3
-
-h3:
- br i1 undef, label %latch3, label %exit
-
-latch3:
- br i1 false, label %exit3, label %h3
-
-exit3:
- br label %latch2
-
-latch2:
- %inc = add nuw nsw i32 %0, 1
- %cmp = icmp slt i32 %inc, 2
- br i1 %cmp, label %h2, label %exit2
-
-exit2:
- br i1 undef, label %latch1, label %ph2
-
-latch1: ; preds = %exit2
- %1 = load i32, i32* @b, align 4
- br label %h1
-
-exit:
- %d.0.lcssa = phi i32 [ %d.0, %h3 ]
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/pr33437.ll b/llvm/test/Transforms/LoopUnroll/pr33437.ll
deleted file mode 100644
index 210875b6ca4..00000000000
--- a/llvm/test/Transforms/LoopUnroll/pr33437.ll
+++ /dev/null
@@ -1,43 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -S -loop-unroll -unroll-peel-count=1 < %s | FileCheck %s
-
-declare zeroext i8 @patatino()
-
-define fastcc void @tinky() {
-; CHECK-LABEL: @tinky(
-; CHECK-NEXT: entry:
-; CHECK-NEXT: br label [[NEXT:%.*]]
-; CHECK: loopexit:
-; CHECK-NEXT: ret void
-; CHECK: next:
-; CHECK-NEXT: br label [[LOOP_PEEL_BEGIN:%.*]]
-; CHECK: loop.peel.begin:
-; CHECK-NEXT: br label [[LOOP_PEEL:%.*]]
-; CHECK: loop.peel:
-; CHECK-NEXT: [[CALL593_PEEL:%.*]] = tail call zeroext i8 @patatino()
-; CHECK-NEXT: br i1 false, label [[LOOP_PEEL_NEXT:%.*]], label [[LOOPEXIT:%.*]]
-; CHECK: loop.peel.next:
-; CHECK-NEXT: br label [[LOOP_PEEL_NEXT1:%.*]]
-; CHECK: loop.peel.next1:
-; CHECK-NEXT: br label [[NEXT_PEEL_NEWPH:%.*]]
-; CHECK: next.peel.newph:
-; CHECK-NEXT: br label [[LOOP:%.*]]
-; CHECK: loop:
-; CHECK-NEXT: [[CALL593:%.*]] = tail call zeroext i8 @patatino()
-; CHECK-NEXT: br label [[LOOPEXIT]]
-;
-entry:
- br label %next
-
-loopexit:
- ret void
-
-next:
- br label %loop
-
-loop:
- %a = phi i8 [ undef, %next ], [ %call593, %loop ]
- %b = phi i32 [ 0, %next ], [ 1, %loop ]
- %call593 = tail call zeroext i8 @patatino()
- br i1 false, label %loop, label %loopexit
-}
diff --git a/llvm/test/Transforms/LoopUnroll/rebuild_lcssa.ll b/llvm/test/Transforms/LoopUnroll/rebuild_lcssa.ll
deleted file mode 100644
index 98a8b91a0e6..00000000000
--- a/llvm/test/Transforms/LoopUnroll/rebuild_lcssa.ll
+++ /dev/null
@@ -1,190 +0,0 @@
-; RUN: opt < %s -loop-unroll -S | FileCheck %s
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-
-; This test shows how unrolling an inner loop could break LCSSA for an outer
-; loop, and there is no cheap way to recover it.
-;
-; In this case the inner loop, L3, is being unrolled. It only runs one
-; iteration, so unrolling basically means replacing
-; br i1 true, label %exit, label %L3_header
-; with
-; br label %exit
-;
-; However, this change messes up the loops structure: for instance, block
-; L3_body no longer belongs to L2. It becomes an exit block for L2, so LCSSA
-; phis for definitions in L2 should now be placed there. In particular, we need
-; to insert such a definition for %y1.
-
-; CHECK-LABEL: @foo1
-define void @foo1() {
-entry:
- br label %L1_header
-
-L1_header:
- br label %L2_header
-
-L2_header:
- %y1 = phi i64 [ undef, %L1_header ], [ %x.lcssa, %L2_latch ]
- br label %L3_header
-
-L3_header:
- %y2 = phi i64 [ 0, %L3_latch ], [ %y1, %L2_header ]
- %x = add i64 undef, -1
- br i1 true, label %L2_latch, label %L3_body
-
-L2_latch:
- %x.lcssa = phi i64 [ %x, %L3_header ]
- br label %L2_header
-
-; CHECK: L3_body:
-; CHECK-NEXT: %y1.lcssa = phi i64 [ %y1, %L3_header ]
-L3_body:
- store i64 %y1, i64* undef
- br i1 false, label %L3_latch, label %L1_latch
-
-L3_latch:
- br i1 true, label %exit, label %L3_header
-
-L1_latch:
- %y.lcssa = phi i64 [ %y2, %L3_body ]
- br label %L1_header
-
-exit:
- ret void
-}
-
-; Additional tests for some corner cases.
-;
-; CHECK-LABEL: @foo2
-define void @foo2() {
-entry:
- br label %L1_header
-
-L1_header:
- br label %L2_header
-
-L2_header:
- %a = phi i64 [ undef, %L1_header ], [ %dec_us, %L3_header ]
- br label %L3_header
-
-L3_header:
- %b = phi i64 [ 0, %L3_latch ], [ %a, %L2_header ]
- %dec_us = add i64 undef, -1
- br i1 true, label %L2_header, label %L3_break_to_L1
-
-; CHECK: L3_break_to_L1:
-; CHECK-NEXT: %a.lcssa = phi i64 [ %a, %L3_header ]
-L3_break_to_L1:
- br i1 false, label %L3_latch, label %L1_latch
-
-L1_latch:
- %b_lcssa = phi i64 [ %b, %L3_break_to_L1 ]
- br label %L1_header
-
-L3_latch:
- br i1 true, label %Exit, label %L3_header
-
-Exit:
- ret void
-}
-
-; CHECK-LABEL: @foo3
-define void @foo3() {
-entry:
- br label %L1_header
-
-L1_header:
- %a = phi i8* [ %b, %L1_latch ], [ null, %entry ]
- br i1 undef, label %L2_header, label %L1_latch
-
-L2_header:
- br i1 undef, label %L2_latch, label %L1_latch
-
-; CHECK: L2_latch:
-; CHECK-NEXT: %a.lcssa = phi i8* [ %a, %L2_header ]
-L2_latch:
- br i1 true, label %L2_exit, label %L2_header
-
-L1_latch:
- %b = phi i8* [ undef, %L1_header ], [ null, %L2_header ]
- br label %L1_header
-
-L2_exit:
- %a_lcssa1 = phi i8* [ %a, %L2_latch ]
- br label %Exit
-
-Exit:
- %a_lcssa2 = phi i8* [ %a_lcssa1, %L2_exit ]
- ret void
-}
-
-; PR26688
-; CHECK-LABEL: @foo4
-define i8 @foo4() {
-entry:
- br label %L1_header
-
-L1_header:
- %x = icmp eq i32 1, 0
- br label %L2_header
-
-L2_header:
- br label %L3_header
-
-L3_header:
- br i1 true, label %L2_header, label %L3_exiting
-
-L3_exiting:
- br i1 true, label %L3_body, label %L1_latch
-
-; CHECK: L3_body:
-; CHECK-NEXT: %x.lcssa = phi i1
-L3_body:
- br i1 %x, label %L3_latch, label %L3_latch
-
-L3_latch:
- br i1 false, label %L3_header, label %exit
-
-L1_latch:
- br label %L1_header
-
-exit:
- ret i8 0
-}
-
-; CHECK-LABEL: @foo5
-define void @foo5() {
-entry:
- br label %outer
-
-outer:
- br label %inner1
-
-; CHECK: inner1:
-; CHECK-NOT: br i1 true
-; CHECK: br label %inner2_indirect_exit
-inner1:
- br i1 true, label %inner2_indirect_exit.preheader, label %inner1
-
-inner2_indirect_exit.preheader:
- br label %inner2_indirect_exit
-
-inner2_indirect_exit:
- %a = phi i32 [ %b, %inner2_latch ], [ undef, %inner2_indirect_exit.preheader ]
- indirectbr i8* undef, [label %inner2_latch, label %inner3, label %outer_latch]
-
-inner2_latch:
- %b = load i32, i32* undef, align 8
- br label %inner2_indirect_exit
-
-inner3:
- %a.lcssa = phi i32 [ %a.lcssa, %inner3 ], [ %a, %inner2_indirect_exit ]
- br i1 true, label %outer_latch.loopexit, label %inner3
-
-outer_latch.loopexit:
- %a.lcssa.lcssa = phi i32 [ %a.lcssa, %inner3 ]
- br label %outer_latch
-
-outer_latch:
- br label %outer
-}
diff --git a/llvm/test/Transforms/LoopUnroll/revisit.ll b/llvm/test/Transforms/LoopUnroll/revisit.ll
deleted file mode 100644
index 6420396e9ff..00000000000
--- a/llvm/test/Transforms/LoopUnroll/revisit.ll
+++ /dev/null
@@ -1,156 +0,0 @@
-; This test checks that nested loops are revisited in various scenarios when
-; unrolling. Note that if we ever start doing outer loop peeling a test case
-; for that should be added here that will look essentially like a hybrid of the
-; current two cases.
-;
-; RUN: opt < %s -disable-output -debug-pass-manager 2>&1 \
-; RUN: -passes='require<opt-remark-emit>,loop(unroll-full)' \
-; RUN: | FileCheck %s
-;
-; Also run in a special mode that visits children.
-; RUN: opt < %s -disable-output -debug-pass-manager -unroll-revisit-child-loops 2>&1 \
-; RUN: -passes='require<opt-remark-emit>,loop(unroll-full)' \
-; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-CHILDREN
-
-; Basic test is fully unrolled and we revisit the post-unroll new sibling
-; loops, including the ones that used to be child loops.
-define void @full_unroll(i1* %ptr) {
-; CHECK-LABEL: FunctionToLoopPassAdaptor{{.*}} on full_unroll
-; CHECK-NOT: LoopFullUnrollPass
-
-entry:
- br label %l0
-
-l0:
- %cond.0 = load volatile i1, i1* %ptr
- br i1 %cond.0, label %l0.0.ph, label %exit
-
-l0.0.ph:
- br label %l0.0
-
-l0.0:
- %iv = phi i32 [ %iv.next, %l0.0.latch ], [ 0, %l0.0.ph ]
- %iv.next = add i32 %iv, 1
- br label %l0.0.0.ph
-
-l0.0.0.ph:
- br label %l0.0.0
-
-l0.0.0:
- %cond.0.0.0 = load volatile i1, i1* %ptr
- br i1 %cond.0.0.0, label %l0.0.0, label %l0.0.1.ph
-; CHECK: LoopFullUnrollPass on Loop at depth 3 containing: %l0.0.0<header>
-; CHECK-NOT: LoopFullUnrollPass
-
-l0.0.1.ph:
- br label %l0.0.1
-
-l0.0.1:
- %cond.0.0.1 = load volatile i1, i1* %ptr
- br i1 %cond.0.0.1, label %l0.0.1, label %l0.0.latch
-; CHECK: LoopFullUnrollPass on Loop at depth 3 containing: %l0.0.1<header>
-; CHECK-NOT: LoopFullUnrollPass
-
-l0.0.latch:
- %cmp = icmp slt i32 %iv.next, 2
- br i1 %cmp, label %l0.0, label %l0.latch
-; CHECK: LoopFullUnrollPass on Loop at depth 2 containing: %l0.0
-; CHECK-NOT: LoopFullUnrollPass
-;
-; Unrolling occurs, so we visit what were the inner loops twice over. First we
-; visit their clones, and then we visit the original loops re-parented.
-; CHECK: LoopFullUnrollPass on Loop at depth 2 containing: %l0.0.1.1<header>
-; CHECK-NOT: LoopFullUnrollPass
-; CHECK: LoopFullUnrollPass on Loop at depth 2 containing: %l0.0.0.1<header>
-; CHECK-NOT: LoopFullUnrollPass
-; CHECK: LoopFullUnrollPass on Loop at depth 2 containing: %l0.0.1<header>
-; CHECK-NOT: LoopFullUnrollPass
-; CHECK: LoopFullUnrollPass on Loop at depth 2 containing: %l0.0.0<header>
-; CHECK-NOT: LoopFullUnrollPass
-
-l0.latch:
- br label %l0
-; CHECK: LoopFullUnrollPass on Loop at depth 1 containing: %l0<header>
-; CHECK-NOT: LoopFullUnrollPass
-
-exit:
- ret void
-}
-
-; Now we test forced runtime partial unrolling with metadata. Here we end up
-; duplicating child loops without changing their structure and so they aren't by
-; default visited, but will be visited with a special parameter.
-define void @partial_unroll(i32 %count, i1* %ptr) {
-; CHECK-LABEL: FunctionToLoopPassAdaptor{{.*}} on partial_unroll
-; CHECK-NOT: LoopFullUnrollPass
-
-entry:
- br label %l0
-
-l0:
- %cond.0 = load volatile i1, i1* %ptr
- br i1 %cond.0, label %l0.0.ph, label %exit
-
-l0.0.ph:
- br label %l0.0
-
-l0.0:
- %iv = phi i32 [ %iv.next, %l0.0.latch ], [ 0, %l0.0.ph ]
- %iv.next = add i32 %iv, 1
- br label %l0.0.0.ph
-
-l0.0.0.ph:
- br label %l0.0.0
-
-l0.0.0:
- %cond.0.0.0 = load volatile i1, i1* %ptr
- br i1 %cond.0.0.0, label %l0.0.0, label %l0.0.1.ph
-; CHECK: LoopFullUnrollPass on Loop at depth 3 containing: %l0.0.0<header>
-; CHECK-NOT: LoopFullUnrollPass
-
-l0.0.1.ph:
- br label %l0.0.1
-
-l0.0.1:
- %cond.0.0.1 = load volatile i1, i1* %ptr
- br i1 %cond.0.0.1, label %l0.0.1, label %l0.0.latch
-; CHECK: LoopFullUnrollPass on Loop at depth 3 containing: %l0.0.1<header>
-; CHECK-NOT: LoopFullUnrollPass
-
-l0.0.latch:
- %cmp = icmp slt i32 %iv.next, %count
- br i1 %cmp, label %l0.0, label %l0.latch, !llvm.loop !1
-; CHECK: LoopFullUnrollPass on Loop at depth 2 containing: %l0.0
-; CHECK-NOT: LoopFullUnrollPass
-;
-; Partial unrolling occurs which introduces both new child loops and new sibling
-; loops. We only visit the child loops in a special mode, not by default.
-; CHECK-CHILDREN: LoopFullUnrollPass on Loop at depth 3 containing: %l0.0.0<header>
-; CHECK-CHILDREN-NOT: LoopFullUnrollPass
-; CHECK-CHILDREN: LoopFullUnrollPass on Loop at depth 3 containing: %l0.0.1<header>
-; CHECK-CHILDREN-NOT: LoopFullUnrollPass
-; CHECK-CHILDREN: LoopFullUnrollPass on Loop at depth 3 containing: %l0.0.0.1<header>
-; CHECK-CHILDREN-NOT: LoopFullUnrollPass
-; CHECK-CHILDREN: LoopFullUnrollPass on Loop at depth 3 containing: %l0.0.1.1<header>
-; CHECK-CHILDREN-NOT: LoopFullUnrollPass
-;
-; When we revisit children, we also revisit the current loop.
-; CHECK-CHILDREN: LoopFullUnrollPass on Loop at depth 2 containing: %l0.0<header>
-; CHECK-CHILDREN-NOT: LoopFullUnrollPass
-;
-; Revisit the children of the outer loop that are part of the epilogue.
-;
-; CHECK: LoopFullUnrollPass on Loop at depth 2 containing: %l0.0.0.epil<header>
-; CHECK-NOT: LoopFullUnrollPass
-; CHECK: LoopFullUnrollPass on Loop at depth 2 containing: %l0.0.1.epil<header>
-; CHECK-NOT: LoopFullUnrollPass
-l0.latch:
- br label %l0
-; CHECK: LoopFullUnrollPass on Loop at depth 1 containing: %l0<header>
-; CHECK-NOT: LoopFullUnrollPass
-
-exit:
- ret void
-}
-!1 = !{!1, !2}
-!2 = !{!"llvm.loop.unroll.count", i32 2}
diff --git a/llvm/test/Transforms/LoopUnroll/runtime-epilog-debuginfo.ll b/llvm/test/Transforms/LoopUnroll/runtime-epilog-debuginfo.ll
deleted file mode 100644
index dc6adfb8e24..00000000000
--- a/llvm/test/Transforms/LoopUnroll/runtime-epilog-debuginfo.ll
+++ /dev/null
@@ -1,128 +0,0 @@
-; RUN: opt -loop-unroll -unroll-runtime -unroll-runtime-epilog -S %s | FileCheck %s
-
-; Test that epilogue is tagged with the same debug information as original loop body rather than original loop exit.
-
-; CHECK: for.body.i:
-; CHECK: br i1 {{.*}}, label %lee1.exit.loopexit.unr-lcssa.loopexit, label %for.body.i, !dbg ![[LOOP_LOC:[0-9]+]]
-; CHECK: lee1.exit.loopexit.unr-lcssa.loopexit:
-; CHECK: br label %lee1.exit.loopexit.unr-lcssa, !dbg ![[LOOP_LOC]]
-; CHECK: lee1.exit.loopexit.unr-lcssa:
-; CHECK: %lcmp.mod = icmp ne i32 %xtraiter, 0, !dbg ![[LOOP_LOC]]
-; CHECK: br i1 %lcmp.mod, label %for.body.i.epil.preheader, label %lee1.exit.loopexit, !dbg ![[LOOP_LOC]]
-; CHECK: for.body.i.epil.preheader:
-; CHECK: br label %for.body.i.epil, !dbg ![[LOOP_LOC]]
-; CHECK: lee1.exit.loopexit:
-; CHECK: br label %lee1.exit, !dbg ![[EXIT_LOC:[0-9]+]]
-
-; CHECK-DAG: ![[LOOP_LOC]] = !DILocation(line: 5, column: 3, scope: !{{.*}}, inlinedAt: !{{.*}})
-; CHECK-DAG: ![[EXIT_LOC]] = !DILocation(line: 11, column: 12, scope: !{{.*}}, inlinedAt: !{{.*}})
-
-; Function Attrs: nounwind readnone
-define i32 @goo(i32 %a, i32 %b) local_unnamed_addr #0 !dbg !8 {
-entry:
- tail call void @llvm.dbg.value(metadata i32 %a, i64 0, metadata !13, metadata !15), !dbg !16
- tail call void @llvm.dbg.value(metadata i32 %b, i64 0, metadata !14, metadata !15), !dbg !17
- tail call void @llvm.dbg.value(metadata i32 %a, i64 0, metadata !18, metadata !15), !dbg !26
- tail call void @llvm.dbg.value(metadata i32 %b, i64 0, metadata !21, metadata !15), !dbg !28
- tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !22, metadata !15), !dbg !29
- tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !23, metadata !15), !dbg !30
- tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !23, metadata !15), !dbg !30
- tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !22, metadata !15), !dbg !29
- %cmp7.i = icmp eq i32 %b, 0, !dbg !31
- br i1 %cmp7.i, label %lee1.exit, label %for.body.i.preheader, !dbg !33
-
-for.body.i.preheader: ; preds = %entry
- br label %for.body.i, !dbg !34
-
-for.body.i: ; preds = %for.body.i.preheader, %for.body.i
- %i.09.i = phi i32 [ %inc.i, %for.body.i ], [ 0, %for.body.i.preheader ]
- %t.08.i = phi i32 [ %add1.i, %for.body.i ], [ 0, %for.body.i.preheader ]
- %div.i = sdiv i32 %t.08.i, 2, !dbg !34
- %add.i = add i32 %t.08.i, %a, !dbg !35
- %add1.i = add i32 %add.i, %div.i, !dbg !36
- tail call void @llvm.dbg.value(metadata i32 %add1.i, i64 0, metadata !22, metadata !15), !dbg !29
- %inc.i = add nuw i32 %i.09.i, 1, !dbg !37
- tail call void @llvm.dbg.value(metadata i32 %inc.i, i64 0, metadata !23, metadata !15), !dbg !30
- tail call void @llvm.dbg.value(metadata i32 %inc.i, i64 0, metadata !23, metadata !15), !dbg !30
- tail call void @llvm.dbg.value(metadata i32 %add1.i, i64 0, metadata !22, metadata !15), !dbg !29
- %exitcond.i = icmp eq i32 %inc.i, %b, !dbg !31
- br i1 %exitcond.i, label %lee1.exit.loopexit, label %for.body.i, !dbg !33, !llvm.loop !38
-
-lee1.exit.loopexit: ; preds = %for.body.i
- %add1.i.lcssa = phi i32 [ %add1.i, %for.body.i ]
- br label %lee1.exit, !dbg !41
-
-lee1.exit: ; preds = %lee1.exit.loopexit, %entry
- %t.0.lcssa.i = phi i32 [ 0, %entry ], [ %add1.i.lcssa, %lee1.exit.loopexit ]
- tail call void @llvm.dbg.value(metadata i32 %a, i64 0, metadata !44, metadata !15), !dbg !47
- tail call void @llvm.dbg.value(metadata i32 %b, i64 0, metadata !45, metadata !15), !dbg !48
- %add.i4 = add nsw i32 %b, %a, !dbg !41
- %sub.i = sub nsw i32 %a, %b, !dbg !49
- %mul.i = mul nsw i32 %add.i4, %sub.i, !dbg !50
- %add = add nsw i32 %t.0.lcssa.i, %mul.i, !dbg !51
- ret i32 %add, !dbg !52
-}
-
-; Function Attrs: nounwind readnone
-declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1
-
-attributes #0 = { nounwind readnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "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"="arm7tdmi" "target-features"="+neon,+strict-align,+vfp3,-crypto,-d16,-fp-armv8,-fp-only-sp,-fp16,-vfp4" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #1 = { nounwind readnone }
-
-!llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!3, !4, !5, !6}
-!llvm.ident = !{!7}
-
-!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "Snapdragon LLVM ARM Compiler 4.0.5 (based on llvm.org 4.0+)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
-!1 = !DIFile(filename: "t.c", directory: "/prj/llvm-arm/scratch1/zhaoshiz/bugs/debug-symbol")
-!2 = !{}
-!3 = !{i32 2, !"Dwarf Version", i32 4}
-!4 = !{i32 2, !"Debug Info Version", i32 3}
-!5 = !{i32 1, !"wchar_size", i32 4}
-!6 = !{i32 1, !"min_enum_size", i32 4}
-!7 = !{!"Snapdragon LLVM ARM Compiler 4.0.5 (based on llvm.org 4.0+)"}
-!8 = distinct !DISubprogram(name: "goo", scope: !1, file: !1, line: 23, type: !9, isLocal: false, isDefinition: true, scopeLine: 23, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !12)
-!9 = !DISubroutineType(types: !10)
-!10 = !{!11, !11, !11}
-!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
-!12 = !{!13, !14}
-!13 = !DILocalVariable(name: "a", arg: 1, scope: !8, file: !1, line: 23, type: !11)
-!14 = !DILocalVariable(name: "b", arg: 2, scope: !8, file: !1, line: 23, type: !11)
-!15 = !DIExpression()
-!16 = !DILocation(line: 23, column: 14, scope: !8)
-!17 = !DILocation(line: 23, column: 21, scope: !8)
-!18 = !DILocalVariable(name: "a", arg: 1, scope: !19, file: !1, line: 3, type: !11)
-!19 = distinct !DISubprogram(name: "lee1", scope: !1, file: !1, line: 3, type: !9, isLocal: true, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !20)
-!20 = !{!18, !21, !22, !23}
-!21 = !DILocalVariable(name: "b", arg: 2, scope: !19, file: !1, line: 3, type: !11)
-!22 = !DILocalVariable(name: "t", scope: !19, file: !1, line: 4, type: !11)
-!23 = !DILocalVariable(name: "i", scope: !24, file: !1, line: 5, type: !25)
-!24 = distinct !DILexicalBlock(scope: !19, file: !1, line: 5, column: 3)
-!25 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned)
-!26 = !DILocation(line: 3, column: 22, scope: !19, inlinedAt: !27)
-!27 = distinct !DILocation(line: 24, column: 27, scope: !8)
-!28 = !DILocation(line: 3, column: 29, scope: !19, inlinedAt: !27)
-!29 = !DILocation(line: 4, column: 7, scope: !19, inlinedAt: !27)
-!30 = !DILocation(line: 5, column: 17, scope: !24, inlinedAt: !27)
-!31 = !DILocation(line: 5, column: 23, scope: !32, inlinedAt: !27)
-!32 = distinct !DILexicalBlock(scope: !24, file: !1, line: 5, column: 3)
-!33 = !DILocation(line: 5, column: 3, scope: !24, inlinedAt: !27)
-!34 = !DILocation(line: 6, column: 13, scope: !32, inlinedAt: !27)
-!35 = !DILocation(line: 6, column: 11, scope: !32, inlinedAt: !27)
-!36 = !DILocation(line: 6, column: 7, scope: !32, inlinedAt: !27)
-!37 = !DILocation(line: 5, column: 28, scope: !32, inlinedAt: !27)
-!38 = distinct !{!38, !39, !40}
-!39 = !DILocation(line: 5, column: 3, scope: !24)
-!40 = !DILocation(line: 6, column: 14, scope: !24)
-!41 = !DILocation(line: 11, column: 12, scope: !42, inlinedAt: !46)
-!42 = distinct !DISubprogram(name: "lee2", scope: !1, file: !1, line: 10, type: !9, isLocal: true, isDefinition: true, scopeLine: 10, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !43)
-!43 = !{!44, !45}
-!44 = !DILocalVariable(name: "a", arg: 1, scope: !42, file: !1, line: 10, type: !11)
-!45 = !DILocalVariable(name: "b", arg: 2, scope: !42, file: !1, line: 10, type: !11)
-!46 = distinct !DILocation(line: 24, column: 40, scope: !8)
-!47 = !DILocation(line: 10, column: 22, scope: !42, inlinedAt: !46)
-!48 = !DILocation(line: 10, column: 29, scope: !42, inlinedAt: !46)
-!49 = !DILocation(line: 11, column: 20, scope: !42, inlinedAt: !46)
-!50 = !DILocation(line: 11, column: 16, scope: !42, inlinedAt: !46)
-!51 = !DILocation(line: 24, column: 38, scope: !8)
-!52 = !DILocation(line: 24, column: 3, scope: !8)
diff --git a/llvm/test/Transforms/LoopUnroll/runtime-li.ll b/llvm/test/Transforms/LoopUnroll/runtime-li.ll
deleted file mode 100644
index 5494c8e9da7..00000000000
--- a/llvm/test/Transforms/LoopUnroll/runtime-li.ll
+++ /dev/null
@@ -1,36 +0,0 @@
-; RUN: opt -S -loop-unroll -unroll-runtime -unroll-count=2 -verify-loop-info -pass-remarks=loop-unroll < %s 2>&1 | FileCheck %s
-
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
-; Verify that runtime-unrolling a top-level loop that has nested loops does not
-; make the unroller produce invalid loop-info.
-; CHECK: remark: {{.*}}: unrolled loop by a factor of 2 with run-time trip count
-; CHECK: @widget
-; CHECK: ret void
-define void @widget(double* %arg, double* %arg1, double* %p, i64* %q1, i64* %q2) local_unnamed_addr {
-entry:
- br label %header.outer
-
-header.outer: ; preds = %latch.outer, %entry
- %tmp = phi double* [ %tmp8, %latch.outer ], [ %arg, %entry ]
- br label %header.inner
-
-header.inner: ; preds = %latch.inner, %header.outer
- br i1 undef, label %latch.inner, label %latch.outer
-
-latch.inner: ; preds = %header.inner
- %tmp5 = load i64, i64* %q1, align 8
- store i64 %tmp5, i64* %q2, align 8
- %tmp6 = icmp eq double* %p, %arg
- br label %header.inner
-
-latch.outer: ; preds = %header.inner
- store double 0.0, double* %p, align 8
- %tmp8 = getelementptr inbounds double, double* %tmp, i64 1
- %tmp9 = icmp eq double* %tmp8, %arg1
- br i1 %tmp9, label %exit, label %header.outer
-
-exit: ; preds = %latch.outer
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/runtime-loop-multiexit-dom-verify.ll b/llvm/test/Transforms/LoopUnroll/runtime-loop-multiexit-dom-verify.ll
deleted file mode 100644
index b3c0039dc15..00000000000
--- a/llvm/test/Transforms/LoopUnroll/runtime-loop-multiexit-dom-verify.ll
+++ /dev/null
@@ -1,275 +0,0 @@
-; RUN: opt < %s -loop-unroll -unroll-runtime=true -unroll-runtime-epilog=false -unroll-runtime-multi-exit=true -unroll-count=4 -verify-dom-info -S | FileCheck %s
-
-; REQUIRES: asserts
-; The tests below are for verifying dom tree after runtime unrolling
-; with multiple exit/exiting blocks.
-
-; We explicitly set the unroll count so that expensiveTripCount computation is allowed.
-
-; mergedexit block has edges from loop exit blocks.
-define i64 @test1() {
-; CHECK-LABEL: test1(
-; CHECK-LABEL: headerexit:
-; CHECK-NEXT: %addphi = phi i64 [ %add.iv, %header ], [ %add.iv.1, %header.1 ], [ %add.iv.2, %header.2 ], [ %add.iv.3, %header.3 ]
-; CHECK-NEXT: br label %mergedexit
-; CHECK-LABEL: latchexit:
-; CHECK-NEXT: %shftphi = phi i64 [ %shft, %latch ], [ %shft.1, %latch.1 ], [ %shft.2, %latch.2 ], [ %shft.3, %latch.3 ]
-; CHECK-NEXT: br label %mergedexit
-; CHECK-LABEL: mergedexit:
-; CHECK-NEXT: %retval = phi i64 [ %addphi, %headerexit ], [ %shftphi, %latchexit ]
-; CHECK-NEXT: ret i64 %retval
-entry:
- br label %preheader
-
-preheader: ; preds = %bb
- %trip = zext i32 undef to i64
- br label %header
-
-header: ; preds = %latch, %preheader
- %iv = phi i64 [ 2, %preheader ], [ %add.iv, %latch ]
- %add.iv = add nuw nsw i64 %iv, 2
- %cmp1 = icmp ult i64 %add.iv, %trip
- br i1 %cmp1, label %latch, label %headerexit
-
-latch: ; preds = %header
- %shft = ashr i64 %add.iv, 1
- %cmp2 = icmp ult i64 %shft, %trip
- br i1 %cmp2, label %header, label %latchexit
-
-headerexit: ; preds = %header
- %addphi = phi i64 [ %add.iv, %header ]
- br label %mergedexit
-
-latchexit: ; preds = %latch
- %shftphi = phi i64 [ %shft, %latch ]
- br label %mergedexit
-
-mergedexit: ; preds = %latchexit, %headerexit
- %retval = phi i64 [ %addphi, %headerexit ], [ %shftphi, %latchexit ]
- ret i64 %retval
-}
-
-; mergedexit has edges from loop exit blocks and a block outside the loop.
-define void @test2(i1 %cond, i32 %n) {
-; CHECK-LABEL: header.1:
-; CHECK-NEXT: %add.iv.1 = add nuw nsw i64 %add.iv, 2
-; CHECK: br i1 %cmp1.1, label %latch.1, label %headerexit
-; CHECK-LABEL: latch.3:
-; CHECK: %cmp2.3 = icmp ult i64 %shft.3, %trip
-; CHECK-NEXT: br i1 %cmp2.3, label %header, label %latchexit, !llvm.loop
-entry:
- br i1 %cond, label %preheader, label %mergedexit
-
-preheader: ; preds = %entry
- %trip = zext i32 %n to i64
- br label %header
-
-header: ; preds = %latch, %preheader
- %iv = phi i64 [ 2, %preheader ], [ %add.iv, %latch ]
- %add.iv = add nuw nsw i64 %iv, 2
- %cmp1 = icmp ult i64 %add.iv, %trip
- br i1 %cmp1, label %latch, label %headerexit
-
-latch: ; preds = %header
- %shft = ashr i64 %add.iv, 1
- %cmp2 = icmp ult i64 %shft, %trip
- br i1 %cmp2, label %header, label %latchexit
-
-headerexit: ; preds = %header
- br label %mergedexit
-
-latchexit: ; preds = %latch
- br label %mergedexit
-
-mergedexit: ; preds = %latchexit, %headerexit, %entry
- ret void
-}
-
-
-; exitsucc is from loop exit block only.
-define i64 @test3(i32 %n) {
-; CHECK-LABEL: test3(
-; CHECK-LABEL: headerexit:
-; CHECK-NEXT: br label %exitsucc
-; CHECK-LABEL: latchexit:
-; CHECK-NEXT: %shftphi = phi i64 [ %shft, %latch ], [ %shft.1, %latch.1 ], [ %shft.2, %latch.2 ], [ %shft.3, %latch.3 ]
-; CHECK-NEXT: ret i64 %shftphi
-; CHECK-LABEL: exitsucc:
-; CHECK-NEXT: ret i64 96
-entry:
- br label %preheader
-
-preheader: ; preds = %bb
- %trip = zext i32 %n to i64
- br label %header
-
-header: ; preds = %latch, %preheader
- %iv = phi i64 [ 2, %preheader ], [ %add.iv, %latch ]
- %add.iv = add nuw nsw i64 %iv, 2
- %cmp1 = icmp ult i64 %add.iv, %trip
- br i1 %cmp1, label %latch, label %headerexit
-
-latch: ; preds = %header
- %shft = ashr i64 %add.iv, 1
- %cmp2 = icmp ult i64 %shft, %trip
- br i1 %cmp2, label %header, label %latchexit
-
-headerexit: ; preds = %header
- br label %exitsucc
-
-latchexit: ; preds = %latch
- %shftphi = phi i64 [ %shft, %latch ]
- ret i64 %shftphi
-
-exitsucc: ; preds = %headerexit
- ret i64 96
-}
-
-; exit block (%default) has an exiting block and another exit block as predecessors.
-define void @test4(i16 %c3) {
-; CHECK-LABEL: test4
-
-; CHECK-LABEL: exiting.prol:
-; CHECK-NEXT: switch i16 %c3, label %default.loopexit.loopexit1 [
-
-; CHECK-LABEL: exiting:
-; CHECK-NEXT: switch i16 %c3, label %default.loopexit.loopexit [
-
-; CHECK-LABEL: default.loopexit.loopexit:
-; CHECK-NEXT: br label %default.loopexit
-
-; CHECK-LABEL: default.loopexit.loopexit1:
-; CHECK-NEXT: br label %default.loopexit
-
-; CHECK-LABEL: default.loopexit:
-; CHECK-NEXT: br label %default
-preheader:
- %c1 = zext i32 undef to i64
- br label %header
-
-header: ; preds = %latch, %preheader
- %indvars.iv = phi i64 [ 0, %preheader ], [ %indvars.iv.next, %latch ]
- br label %exiting
-
-exiting: ; preds = %header
- switch i16 %c3, label %default [
- i16 45, label %otherexit
- i16 95, label %latch
- ]
-
-latch: ; preds = %exiting
- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
- %c2 = icmp ult i64 %indvars.iv.next, %c1
- br i1 %c2, label %header, label %latchexit
-
-latchexit: ; preds = %latch
- ret void
-
-default: ; preds = %otherexit, %exiting
- ret void
-
-otherexit: ; preds = %exiting
- br label %default
-}
-
-; exit block (%exitB) has an exiting block and another exit block as predecessors.
-; exiting block comes from inner loop.
-define void @test5() {
-; CHECK-LABEL: test5
-; CHECK-LABEL: bb1:
-; CHECK-NEXT: br i1 false, label %outerH.prol.preheader, label %outerH.prol.loopexit
-
-; CHECK-LABEL: outerH.prol.preheader:
-; CHECK-NEXT: br label %outerH.prol
-
-; CHECK-LABEL: outerH.prol:
-; CHECK-NEXT: %tmp4.prol = phi i32 [ %tmp6.prol, %outerLatch.prol ], [ undef, %outerH.prol.preheader ]
-; CHECK-NEXT: %prol.iter = phi i32 [ 0, %outerH.prol.preheader ], [ %prol.iter.sub, %outerLatch.prol ]
-; CHECK-NEXT: br label %innerH.prol
-bb:
- %tmp = icmp sgt i32 undef, 79
- br i1 %tmp, label %outerLatchExit, label %bb1
-
-bb1: ; preds = %bb
- br label %outerH
-
-outerH: ; preds = %outerLatch, %bb1
- %tmp4 = phi i32 [ %tmp6, %outerLatch ], [ undef, %bb1 ]
- br label %innerH
-
-innerH: ; preds = %innerLatch, %outerH
- br i1 undef, label %innerexiting, label %otherexitB
-
-innerexiting: ; preds = %innerH
- br i1 undef, label %innerLatch, label %exitB
-
-innerLatch: ; preds = %innerexiting
- %tmp13 = fcmp olt double undef, 2.000000e+00
- br i1 %tmp13, label %innerH, label %outerLatch
-
-outerLatch: ; preds = %innerLatch
- %tmp6 = add i32 %tmp4, 1
- %tmp7 = icmp sgt i32 %tmp6, 79
- br i1 %tmp7, label %outerLatchExit, label %outerH
-
-outerLatchExit: ; preds = %outerLatch, %bb
- ret void
-
-exitB: ; preds = %innerexiting, %otherexitB
- ret void
-
-otherexitB: ; preds = %innerH
- br label %exitB
-
-}
-
-; Blocks reachable from exits (not_zero44) have the IDom as the block within the loop (Header).
-; Update the IDom to the preheader.
-define void @test6() {
-; CHECK-LABEL: test6
-; CHECK-LABEL: header.prol.preheader:
-; CHECK-NEXT: br label %header.prol
-
-; CHECK-LABEL: header.prol:
-; CHECK-NEXT: %indvars.iv.prol = phi i64 [ undef, %header.prol.preheader ], [ %indvars.iv.next.prol, %latch.prol ]
-; CHECK-NEXT: %prol.iter = phi i64 [ 1, %header.prol.preheader ], [ %prol.iter.sub, %latch.prol ]
-; CHECK-NEXT: br i1 false, label %latch.prol, label %otherexit.loopexit1
-
-; CHECK-LABEL: header.prol.loopexit.unr-lcssa:
-; CHECK-NEXT: %indvars.iv.unr.ph = phi i64 [ %indvars.iv.next.prol, %latch.prol ]
-; CHECK-NEXT: br label %header.prol.loopexit
-
-; CHECK-LABEL: header.prol.loopexit:
-; CHECK-NEXT: %indvars.iv.unr = phi i64 [ undef, %entry ], [ %indvars.iv.unr.ph, %header.prol.loopexit.unr-lcssa ]
-; CHECK-NEXT: br i1 true, label %latchexit, label %entry.new
-
-; CHECK-LABEL: entry.new:
-; CHECK-NEXT: br label %header
-entry:
- br label %header
-
-header: ; preds = %latch, %entry
- %indvars.iv = phi i64 [ undef, %entry ], [ %indvars.iv.next, %latch ]
- br i1 undef, label %latch, label %otherexit
-
-latch: ; preds = %header
- %indvars.iv.next = add nsw i64 %indvars.iv, 2
- %0 = icmp slt i64 %indvars.iv.next, 616
- br i1 %0, label %header, label %latchexit
-
-latchexit: ; preds = %latch
- br label %latchexitsucc
-
-otherexit: ; preds = %header
- br label %otherexitsucc
-
-otherexitsucc: ; preds = %otherexit
- br label %not_zero44
-
-not_zero44: ; preds = %latchexitsucc, %otherexitsucc
- unreachable
-
-latchexitsucc: ; preds = %latchexit
- br label %not_zero44
-}
-
diff --git a/llvm/test/Transforms/LoopUnroll/runtime-loop-multiple-exits.ll b/llvm/test/Transforms/LoopUnroll/runtime-loop-multiple-exits.ll
deleted file mode 100644
index 397e907a8e9..00000000000
--- a/llvm/test/Transforms/LoopUnroll/runtime-loop-multiple-exits.ll
+++ /dev/null
@@ -1,646 +0,0 @@
-; RUN: opt < %s -loop-unroll -unroll-runtime=true -unroll-runtime-epilog=true -unroll-runtime-multi-exit=true -verify-loop-lcssa -verify-dom-info -verify-loop-info -S | FileCheck %s -check-prefix=EPILOG-NO-IC
-; RUN: opt < %s -loop-unroll -unroll-runtime=true -unroll-runtime-epilog=true -unroll-runtime-multi-exit=true -verify-loop-lcssa -verify-dom-info -verify-loop-info -instcombine -S | FileCheck %s -check-prefix=EPILOG
-; RUN: opt < %s -loop-unroll -unroll-runtime -unroll-count=2 -unroll-runtime-epilog=true -unroll-runtime-multi-exit=true -verify-loop-lcssa -verify-dom-info -verify-loop-info -instcombine
-; RUN: opt < %s -loop-unroll -unroll-runtime=true -unroll-runtime-epilog=false -unroll-runtime-multi-exit=true -verify-loop-lcssa -verify-dom-info -verify-loop-info -instcombine -S | FileCheck %s -check-prefix=PROLOG
-; RUN: opt < %s -loop-unroll -unroll-runtime -unroll-runtime-epilog=false -unroll-count=2 -unroll-runtime-multi-exit=true -verify-loop-lcssa -verify-dom-info -verify-loop-info -instcombine
-
-; REQUIRES: asserts
-
-; the third and fifth RUNs generate an epilog/prolog remainder block for all the test
-; cases below (it does not generate a loop).
-
-; test with three exiting and three exit blocks.
-; none of the exit blocks have successors
-define void @test1(i64 %trip, i1 %cond) {
-; EPILOG: test1(
-; EPILOG-NEXT: entry:
-; EPILOG-NEXT: [[TMP0:%.*]] = add i64 [[TRIP:%.*]], -1
-; EPILOG-NEXT: [[XTRAITER:%.*]] = and i64 [[TRIP]], 7
-; EPILOG-NEXT: [[TMP1:%.*]] = icmp ult i64 [[TMP0]], 7
-; EPILOG-NEXT: br i1 [[TMP1]], label %exit2.loopexit.unr-lcssa, label [[ENTRY_NEW:%.*]]
-; EPILOG: entry.new:
-; EPILOG-NEXT: [[UNROLL_ITER:%.*]] = sub i64 [[TRIP]], [[XTRAITER]]
-; EPILOG-NEXT: br label [[LOOP_HEADER:%.*]]
-; EPILOG: loop_latch.epil:
-; EPILOG-NEXT: %epil.iter.sub = add i64 %epil.iter, -1
-; EPILOG-NEXT: %epil.iter.cmp = icmp eq i64 %epil.iter.sub, 0
-; EPILOG-NEXT: br i1 %epil.iter.cmp, label %exit2.loopexit.epilog-lcssa, label %loop_header.epil
-; EPILOG: loop_latch.7:
-; EPILOG-NEXT: %niter.nsub.7 = add i64 %niter, -8
-; EPILOG-NEXT: %niter.ncmp.7 = icmp eq i64 %niter.nsub.7, 0
-; EPILOG-NEXT: br i1 %niter.ncmp.7, label %exit2.loopexit.unr-lcssa.loopexit, label %loop_header
-
-; PROLOG: test1(
-; PROLOG-NEXT: entry:
-; PROLOG-NEXT: [[TMP0:%.*]] = add i64 [[TRIP:%.*]], -1
-; PROLOG-NEXT: [[XTRAITER:%.*]] = and i64 [[TRIP]], 7
-; PROLOG-NEXT: [[TMP1:%.*]] = icmp eq i64 [[XTRAITER]], 0
-; PROLOG-NEXT: br i1 [[TMP1]], label %loop_header.prol.loopexit, label %loop_header.prol.preheader
-; PROLOG: loop_header.prol:
-; PROLOG-NEXT: %iv.prol = phi i64 [ 0, %loop_header.prol.preheader ], [ %iv_next.prol, %loop_latch.prol ]
-; PROLOG-NEXT: %prol.iter = phi i64 [ [[XTRAITER]], %loop_header.prol.preheader ], [ %prol.iter.sub, %loop_latch.prol ]
-; PROLOG-NEXT: br i1 %cond, label %loop_latch.prol, label %loop_exiting_bb1.prol
-; PROLOG: loop_latch.prol:
-; PROLOG-NEXT: %iv_next.prol = add i64 %iv.prol, 1
-; PROLOG-NEXT: %prol.iter.sub = add i64 %prol.iter, -1
-; PROLOG-NEXT: %prol.iter.cmp = icmp eq i64 %prol.iter.sub, 0
-; PROLOG-NEXT: br i1 %prol.iter.cmp, label %loop_header.prol.loopexit.unr-lcssa, label %loop_header.prol
-; PROLOG: loop_latch.7:
-; PROLOG-NEXT: %iv_next.7 = add i64 %iv, 8
-; PROLOG-NEXT: %cmp.7 = icmp eq i64 %iv_next.7, %trip
-; PROLOG-NEXT: br i1 %cmp.7, label %exit2.loopexit.unr-lcssa, label %loop_header
-entry:
- br label %loop_header
-
-loop_header:
- %iv = phi i64 [ 0, %entry ], [ %iv_next, %loop_latch ]
- br i1 %cond, label %loop_latch, label %loop_exiting_bb1
-
-loop_exiting_bb1:
- br i1 false, label %loop_exiting_bb2, label %exit1
-
-loop_exiting_bb2:
- br i1 false, label %loop_latch, label %exit3
-
-exit3:
- ret void
-
-loop_latch:
- %iv_next = add i64 %iv, 1
- %cmp = icmp ne i64 %iv_next, %trip
- br i1 %cmp, label %loop_header, label %exit2.loopexit
-
-exit1:
- ret void
-
-exit2.loopexit:
- ret void
-}
-
-
-; test with three exiting and two exit blocks.
-; The non-latch exit block has 2 unique predecessors.
-; There are 2 values passed to the exit blocks that are calculated at every iteration.
-; %sum.02 and %add. Both of these are incoming values for phi from every exiting
-; unrolled block.
-define i32 @test2(i32* nocapture %a, i64 %n) {
-; EPILOG: test2(
-; EPILOG: for.exit2.loopexit:
-; EPILOG-NEXT: %retval.ph = phi i32 [ 42, %for.exiting_block ], [ %sum.02, %header ], [ %add, %for.body ], [ 42, %for.exiting_block.1 ], [ %add.1, %for.body.1 ], [ 42, %for.exiting_block.2 ], [ %add.2, %for.body.2 ], [ 42, %for.exiting_block.3 ],
-; EPILOG-NEXT: br label %for.exit2
-; EPILOG: for.exit2.loopexit2:
-; EPILOG-NEXT: %retval.ph3 = phi i32 [ 42, %for.exiting_block.epil ], [ %sum.02.epil, %header.epil ]
-; EPILOG-NEXT: br label %for.exit2
-; EPILOG: for.exit2:
-; EPILOG-NEXT: %retval = phi i32 [ %retval.ph, %for.exit2.loopexit ], [ %retval.ph3, %for.exit2.loopexit2 ]
-; EPILOG-NEXT: ret i32 %retval
-; EPILOG: %niter.nsub.7 = add i64 %niter, -8
-
-; PROLOG: test2(
-; PROLOG: for.exit2.loopexit:
-; PROLOG-NEXT: %retval.ph = phi i32 [ 42, %for.exiting_block ], [ %sum.02, %header ], [ %add, %for.body ], [ 42, %for.exiting_block.1 ], [ %add.1, %for.body.1 ], [ 42, %for.exiting_block.2 ], [ %add.2, %for.body.2 ], [ 42, %for.exiting_block.3 ],
-; PROLOG-NEXT: br label %for.exit2
-; PROLOG: for.exit2.loopexit1:
-; PROLOG-NEXT: %retval.ph2 = phi i32 [ 42, %for.exiting_block.prol ], [ %sum.02.prol, %header.prol ]
-; PROLOG-NEXT: br label %for.exit2
-; PROLOG: for.exit2:
-; PROLOG-NEXT: %retval = phi i32 [ %retval.ph, %for.exit2.loopexit ], [ %retval.ph2, %for.exit2.loopexit1 ]
-; PROLOG-NEXT: ret i32 %retval
-; PROLOG: %indvars.iv.next.7 = add i64 %indvars.iv, 8
-
-entry:
- br label %header
-
-header:
- %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
- %sum.02 = phi i32 [ %add, %for.body ], [ 0, %entry ]
- br i1 false, label %for.exit2, label %for.exiting_block
-
-for.exiting_block:
- %cmp = icmp eq i64 %n, 42
- br i1 %cmp, label %for.exit2, label %for.body
-
-for.body:
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %add = add nsw i32 %0, %sum.02
- %indvars.iv.next = add i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, %n
- br i1 %exitcond, label %for.end, label %header
-
-for.end: ; preds = %for.body
- %sum.0.lcssa = phi i32 [ %add, %for.body ]
- ret i32 %sum.0.lcssa
-
-for.exit2:
- %retval = phi i32 [ %sum.02, %header ], [ 42, %for.exiting_block ]
- ret i32 %retval
-}
-
-; test with two exiting and three exit blocks.
-; the non-latch exiting block has a switch.
-define void @test3(i64 %trip, i64 %add) {
-; EPILOG: test3(
-; EPILOG-NEXT: entry:
-; EPILOG-NEXT: [[TMP0:%.*]] = add i64 [[TRIP:%.*]], -1
-; EPILOG-NEXT: [[XTRAITER:%.*]] = and i64 [[TRIP]], 7
-; EPILOG-NEXT: [[TMP1:%.*]] = icmp ult i64 [[TMP0]], 7
-; EPILOG-NEXT: br i1 [[TMP1]], label %exit2.loopexit.unr-lcssa, label [[ENTRY_NEW:%.*]]
-; EPILOG: entry.new:
-; EPILOG-NEXT: %unroll_iter = sub i64 [[TRIP]], [[XTRAITER]]
-; EPILOG-NEXT: br label [[LOOP_HEADER:%.*]]
-; EPILOG: loop_header:
-; EPILOG-NEXT: %sum = phi i64 [ 0, %entry.new ], [ %sum.next.7, %loop_latch.7 ]
-; EPILOG-NEXT: %niter = phi i64 [ %unroll_iter, %entry.new ], [ %niter.nsub.7, %loop_latch.7 ]
-; EPILOG: loop_exiting_bb1.7:
-; EPILOG-NEXT: switch i64 %sum.next.6, label %loop_latch.7
-; EPILOG: loop_latch.7:
-; EPILOG-NEXT: %sum.next.7 = add i64 %sum.next.6, %add
-; EPILOG-NEXT: %niter.nsub.7 = add i64 %niter, -8
-; EPILOG-NEXT: %niter.ncmp.7 = icmp eq i64 %niter.nsub.7, 0
-; EPILOG-NEXT: br i1 %niter.ncmp.7, label %exit2.loopexit.unr-lcssa.loopexit, label %loop_header
-
-; PROLOG: test3(
-; PROLOG-NEXT: entry:
-; PROLOG-NEXT: [[TMP0:%.*]] = add i64 [[TRIP:%.*]], -1
-; PROLOG-NEXT: [[XTRAITER:%.*]] = and i64 [[TRIP]], 7
-; PROLOG-NEXT: [[TMP1:%.*]] = icmp eq i64 [[XTRAITER]], 0
-; PROLOG-NEXT: br i1 [[TMP1]], label %loop_header.prol.loopexit, label %loop_header.prol.preheader
-; PROLOG: loop_header:
-; PROLOG-NEXT: %iv = phi i64 [ %iv.unr, %entry.new ], [ %iv_next.7, %loop_latch.7 ]
-; PROLOG-NEXT: %sum = phi i64 [ %sum.unr, %entry.new ], [ %sum.next.7, %loop_latch.7 ]
-; PROLOG: loop_exiting_bb1.7:
-; PROLOG-NEXT: switch i64 %sum.next.6, label %loop_latch.7
-; PROLOG: loop_latch.7:
-; PROLOG-NEXT: %iv_next.7 = add nsw i64 %iv, 8
-; PROLOG-NEXT: %sum.next.7 = add i64 %sum.next.6, %add
-; PROLOG-NEXT: %cmp.7 = icmp eq i64 %iv_next.7, %trip
-; PROLOG-NEXT: br i1 %cmp.7, label %exit2.loopexit.unr-lcssa, label %loop_header
-entry:
- br label %loop_header
-
-loop_header:
- %iv = phi i64 [ 0, %entry ], [ %iv_next, %loop_latch ]
- %sum = phi i64 [ 0, %entry ], [ %sum.next, %loop_latch ]
- br i1 undef, label %loop_latch, label %loop_exiting_bb1
-
-loop_exiting_bb1:
- switch i64 %sum, label %loop_latch [
- i64 24, label %exit1
- i64 42, label %exit3
- ]
-
-exit3:
- ret void
-
-loop_latch:
- %iv_next = add nuw nsw i64 %iv, 1
- %sum.next = add i64 %sum, %add
- %cmp = icmp ne i64 %iv_next, %trip
- br i1 %cmp, label %loop_header, label %exit2.loopexit
-
-exit1:
- ret void
-
-exit2.loopexit:
- ret void
-}
-
-; FIXME: Support multiple exiting blocks to the same latch exit block.
-; Three exiting blocks where header and latch exit to same LatchExit.
-define i32 @hdr_latch_same_exit(i32* nocapture %a, i64 %n, i1 %cond) {
-; EPILOG: hdr_latch_same_exit(
-; EPILOG-NOT: .unr
-; EPILOG-NOT: .epil
-
-; PROLOG: hdr_latch_same_exit(
-; PROLOG-NOT: .unr
-; PROLOG-NOT: .prol
-entry:
- br label %header
-
-header:
- %indvars.iv = phi i64 [ %indvars.iv.next, %latch ], [ 0, %entry ]
- %sum.02 = phi i32 [ %add, %latch ], [ 0, %entry ]
- br i1 %cond, label %latchExit, label %for.exiting_block
-
-for.exiting_block:
- %cmp = icmp eq i64 %n, 42
- br i1 %cmp, label %for.exit2, label %latch
-
-latch: ; preds = %latch, %entry
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %add = add nsw i32 %0, %sum.02
- %indvars.iv.next = add i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, %n
- br i1 %exitcond, label %latchExit, label %header
-
-latchExit: ; preds = %latch, %entry
- %result = phi i32 [ 0, %header ], [ %add, %latch ]
- ret i32 %result
-
-for.exit2:
- ret i32 42
-}
-
-; Two exiting blocks to latch where the exiting blocks are Latch and a
-; non-header
-; FIXME: We should unroll this loop.
-define i32 @otherblock_latch_same_exit(i32* nocapture %a, i64 %n, i1 %cond) {
-; EPILOG: otherblock_latch_same_exit(
-; EPILOG-NOT: .unr
-; EPILOG-NOT: .epil
-
-; PROLOG: otherblock_latch_same_exit(
-; PROLOG-NOT: .unr
-; PROLOG-NOT: .prol
-entry:
- br label %header
-
-header:
- %indvars.iv = phi i64 [ %indvars.iv.next, %latch ], [ 0, %entry ]
- %sum.02 = phi i32 [ %add, %latch ], [ 0, %entry ]
- br i1 %cond, label %for.exit2, label %for.exiting_block
-
-for.exiting_block:
- %cmp = icmp eq i64 %n, 42
- br i1 %cmp, label %latchExit, label %latch
-
-latch: ; preds = %latch, %entry
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %add = add nsw i32 %0, %sum.02
- %indvars.iv.next = add i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, %n
- br i1 %exitcond, label %latchExit, label %header
-
-latchExit: ; preds = %latch, %entry
- %result = phi i32 [ 2, %for.exiting_block ], [ %add, %latch ]
- ret i32 %result
-
-for.exit2:
- ret i32 42
-}
-
-; Two exiting blocks to latch where the exiting blocks are Latch and a
-; non-header
-; Same as above test except the incoming value for latch Phi is from the header
-; FIXME: We should be able to runtime unroll.
-define i32 @otherblock_latch_same_exit2(i32* nocapture %a, i64 %n, i1 %cond) {
-; EPILOG: otherblock_latch_same_exit2(
-; EPILOG-NOT: .unr
-; EPILOG-NOT: .epil
-
-; PROLOG: otherblock_latch_same_exit2(
-; PROLOG-NOT: .unr
-; PROLOG-NOT: .prol
-entry:
- br label %header
-
-header:
- %indvars.iv = phi i64 [ %indvars.iv.next, %latch ], [ 0, %entry ]
- %sum.02 = phi i32 [ %add, %latch ], [ 0, %entry ]
- br i1 %cond, label %for.exit2, label %for.exiting_block
-
-for.exiting_block:
- %cmp = icmp eq i64 %n, 42
- br i1 %cmp, label %latchExit, label %latch
-
-latch: ; preds = %latch, %entry
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %add = add nsw i32 %0, %sum.02
- %indvars.iv.next = add i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, %n
- br i1 %exitcond, label %latchExit, label %header
-
-latchExit: ; preds = %latch, %entry
- %result = phi i32 [ %sum.02, %for.exiting_block ], [ %add, %latch ]
- ret i32 %result
-
-for.exit2:
- ret i32 42
-}
-
-; Two exiting blocks to latch where the exiting blocks are Latch and a
-; non-header
-; Same as above test except the incoming value for cloned latch Phi is from the
-; for.exiting_block.
-; FIXME: We should be able to runtime unroll.
-define i32 @otherblock_latch_same_exit3(i32* nocapture %a, i64 %n, i1 %cond) {
-; EPILOG: otherblock_latch_same_exit3(
-; EPILOG-NOT: .unr
-; EPILOG-NOT: .epil
-
-; PROLOG: otherblock_latch_same_exit3(
-; PROLOG-NOT: .unr
-; PROLOG-NOT: .prol
-entry:
- br label %header
-
-header:
- %indvars.iv = phi i64 [ %indvars.iv.next, %latch ], [ 0, %entry ]
- %sum.02 = phi i32 [ %add, %latch ], [ 0, %entry ]
- br i1 %cond, label %for.exit2, label %for.exiting_block
-
-for.exiting_block:
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %add = add nsw i32 %0, %sum.02
- %cmp = icmp eq i64 %n, 42
- br i1 %cmp, label %latchExit, label %latch
-
-latch: ; preds = %latch, %entry
- %indvars.iv.next = add i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, %n
- br i1 %exitcond, label %latchExit, label %header
-
-latchExit: ; preds = %latch, %entry
- %result = phi i32 [ %sum.02, %for.exiting_block ], [ %add, %latch ]
- ret i32 %result
-
-for.exit2:
- ret i32 42
-}
-
-; FIXME: Support multiple exiting blocks to the unique exit block (LatchExit).
-; Only 2 blocks in loop: header and latch where both exit to same LatchExit.
-define void @unique_exit(i32 %arg) {
-; EPILOG: unique_exit(
-; EPILOG-NOT: .unr
-; EPILOG-NOT: .epil
-
-; PROLOG: unique_exit(
-; PROLOG-NOT: .unr
-; PROLOG-NOT: .prol
-entry:
- %tmp = icmp sgt i32 undef, %arg
- br i1 %tmp, label %preheader, label %returnblock
-
-preheader: ; preds = %entry
- br label %header
-
-header: ; preds = %preheader, %latch
- %tmp4 = phi i32 [ %inc, %latch ], [ %arg, %preheader ]
- %inc = add nsw i32 %tmp4, 1
- br i1 true, label %latchExit, label %latch
-
-latch: ; preds = %header
- %cmp = icmp slt i32 %inc, undef
- br i1 %cmp, label %header, label %latchExit
-
-latchExit: ; preds = %header, %latch
- %tmp2.ph = phi i32 [ %tmp4, %header ], [ -1, %latch ]
- br label %returnblock
-
-returnblock: ; preds = %latchExit, %entry
- %tmp2 = phi i32 [ -1, %entry ], [ %tmp2.ph, %latchExit ]
- ret void
-}
-
-; two exiting and two exit blocks.
-; the non-latch exiting block has duplicate edges to the non-latch exit block.
-define i64 @test5(i64 %trip, i64 %add, i1 %cond) {
-; EPILOG: test5(
-; EPILOG: exit1.loopexit:
-; EPILOG-NEXT: %result.ph = phi i64 [ %ivy, %loop_exiting ], [ %ivy, %loop_exiting ], [ %ivy.1, %loop_exiting.1 ], [ %ivy.1, %loop_exiting.1 ], [ %ivy.2, %loop_exiting.2 ],
-; EPILOG-NEXT: br label %exit1
-; EPILOG: exit1.loopexit2:
-; EPILOG-NEXT: %ivy.epil = add i64 %iv.epil, %add
-; EPILOG-NEXT: br label %exit1
-; EPILOG: exit1:
-; EPILOG-NEXT: %result = phi i64 [ %result.ph, %exit1.loopexit ], [ %ivy.epil, %exit1.loopexit2 ]
-; EPILOG-NEXT: ret i64 %result
-; EPILOG: loop_latch.7:
-; EPILOG: %niter.nsub.7 = add i64 %niter, -8
-
-; PROLOG: test5(
-; PROLOG: exit1.loopexit:
-; PROLOG-NEXT: %result.ph = phi i64 [ %ivy, %loop_exiting ], [ %ivy, %loop_exiting ], [ %ivy.1, %loop_exiting.1 ], [ %ivy.1, %loop_exiting.1 ], [ %ivy.2, %loop_exiting.2 ],
-; PROLOG-NEXT: br label %exit1
-; PROLOG: exit1.loopexit1:
-; PROLOG-NEXT: %ivy.prol = add i64 %iv.prol, %add
-; PROLOG-NEXT: br label %exit1
-; PROLOG: exit1:
-; PROLOG-NEXT: %result = phi i64 [ %result.ph, %exit1.loopexit ], [ %ivy.prol, %exit1.loopexit1 ]
-; PROLOG-NEXT: ret i64 %result
-; PROLOG: loop_latch.7:
-; PROLOG: %iv_next.7 = add nsw i64 %iv, 8
-entry:
- br label %loop_header
-
-loop_header:
- %iv = phi i64 [ 0, %entry ], [ %iv_next, %loop_latch ]
- %sum = phi i64 [ 0, %entry ], [ %sum.next, %loop_latch ]
- br i1 %cond, label %loop_latch, label %loop_exiting
-
-loop_exiting:
- %ivy = add i64 %iv, %add
- switch i64 %sum, label %loop_latch [
- i64 24, label %exit1
- i64 42, label %exit1
- ]
-
-loop_latch:
- %iv_next = add nuw nsw i64 %iv, 1
- %sum.next = add i64 %sum, %add
- %cmp = icmp ne i64 %iv_next, %trip
- br i1 %cmp, label %loop_header, label %latchexit
-
-exit1:
- %result = phi i64 [ %ivy, %loop_exiting ], [ %ivy, %loop_exiting ]
- ret i64 %result
-
-latchexit:
- ret i64 %sum.next
-}
-
-; test when exit blocks have successors.
-define i32 @test6(i32* nocapture %a, i64 %n, i1 %cond, i32 %x) {
-; EPILOG: test6(
-; EPILOG: for.exit2.loopexit:
-; EPILOG-NEXT: %retval.ph = phi i32 [ 42, %for.exiting_block ], [ %sum.02, %header ], [ %add, %latch ], [ 42, %for.exiting_block.1 ], [ %add.1, %latch.1 ], [ 42, %for.exiting_block.2 ], [ %add.2, %latch.2 ],
-; EPILOG-NEXT: br label %for.exit2
-; EPILOG: for.exit2.loopexit2:
-; EPILOG-NEXT: %retval.ph3 = phi i32 [ 42, %for.exiting_block.epil ], [ %sum.02.epil, %header.epil ]
-; EPILOG-NEXT: br label %for.exit2
-; EPILOG: for.exit2:
-; EPILOG-NEXT: %retval = phi i32 [ %retval.ph, %for.exit2.loopexit ], [ %retval.ph3, %for.exit2.loopexit2 ]
-; EPILOG-NEXT: br i1 %cond, label %exit_true, label %exit_false
-; EPILOG: latch.7:
-; EPILOG: %niter.nsub.7 = add i64 %niter, -8
-
-; PROLOG: test6(
-; PROLOG: for.exit2.loopexit:
-; PROLOG-NEXT: %retval.ph = phi i32 [ 42, %for.exiting_block ], [ %sum.02, %header ], [ %add, %latch ], [ 42, %for.exiting_block.1 ], [ %add.1, %latch.1 ], [ 42, %for.exiting_block.2 ], [ %add.2, %latch.2 ],
-; PROLOG-NEXT: br label %for.exit2
-; PROLOG: for.exit2.loopexit1:
-; PROLOG-NEXT: %retval.ph2 = phi i32 [ 42, %for.exiting_block.prol ], [ %sum.02.prol, %header.prol ]
-; PROLOG-NEXT: br label %for.exit2
-; PROLOG: for.exit2:
-; PROLOG-NEXT: %retval = phi i32 [ %retval.ph, %for.exit2.loopexit ], [ %retval.ph2, %for.exit2.loopexit1 ]
-; PROLOG-NEXT: br i1 %cond, label %exit_true, label %exit_false
-; PROLOG: latch.7:
-; PROLOG: %indvars.iv.next.7 = add i64 %indvars.iv, 8
-entry:
- br label %header
-
-header:
- %indvars.iv = phi i64 [ %indvars.iv.next, %latch ], [ 0, %entry ]
- %sum.02 = phi i32 [ %add, %latch ], [ 0, %entry ]
- br i1 false, label %for.exit2, label %for.exiting_block
-
-for.exiting_block:
- %cmp = icmp eq i64 %n, 42
- br i1 %cmp, label %for.exit2, label %latch
-
-latch:
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %load = load i32, i32* %arrayidx, align 4
- %add = add nsw i32 %load, %sum.02
- %indvars.iv.next = add i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, %n
- br i1 %exitcond, label %latch_exit, label %header
-
-latch_exit:
- %sum.0.lcssa = phi i32 [ %add, %latch ]
- ret i32 %sum.0.lcssa
-
-for.exit2:
- %retval = phi i32 [ %sum.02, %header ], [ 42, %for.exiting_block ]
- %addx = add i32 %retval, %x
- br i1 %cond, label %exit_true, label %exit_false
-
-exit_true:
- ret i32 %retval
-
-exit_false:
- ret i32 %addx
-}
-
-; test when value in exit block does not have VMap.
-define i32 @test7(i32 %arg, i32 %arg1, i32 %arg2) {
-; EPILOG-NO-IC: test7(
-; EPILOG-NO-IC: loopexit1.loopexit:
-; EPILOG-NO-IC-NEXT: %sext3.ph = phi i32 [ %shft, %header ], [ %shft, %latch ], [ %shft, %latch.1 ], [ %shft, %latch.2 ], [ %shft, %latch.3 ], [ %shft, %latch.4 ], [ %shft, %latch.5 ], [ %shft, %latch.6 ]
-; EPILOG-NO-IC-NEXT: br label %loopexit1
-; EPILOG-NO-IC: loopexit1.loopexit1:
-; EPILOG-NO-IC-NEXT: %sext3.ph2 = phi i32 [ %shft, %header.epil ]
-; EPILOG-NO-IC-NEXT: br label %loopexit1
-; EPILOG-NO-IC: loopexit1:
-; EPILOG-NO-IC-NEXT: %sext3 = phi i32 [ %sext3.ph, %loopexit1.loopexit ], [ %sext3.ph2, %loopexit1.loopexit1 ]
-bb:
- %tmp = icmp slt i32 undef, 2
- %sext = sext i32 undef to i64
- %shft = ashr exact i32 %arg, 16
- br i1 %tmp, label %loopexit2, label %preheader
-
-preheader: ; preds = %bb2
- br label %header
-
-header: ; preds = %latch, %preheader
- %tmp6 = phi i64 [ 1, %preheader ], [ %add, %latch ]
- br i1 false, label %loopexit1, label %latch
-
-latch: ; preds = %header
- %add = add nuw nsw i64 %tmp6, 1
- %tmp9 = icmp slt i64 %add, %sext
- br i1 %tmp9, label %header, label %latchexit
-
-latchexit: ; preds = %latch
- unreachable
-
-loopexit2: ; preds = %bb2
- ret i32 %shft
-
-loopexit1: ; preds = %header
- %sext3 = phi i32 [ %shft, %header ]
- ret i32 %sext3
-}
-
-; Nested loop and inner loop is unrolled
-; FIXME: we cannot unroll with epilog remainder currently, because
-; the outer loop does not contain the epilog preheader and epilog exit (while
-; infact it should). This causes us to choke up on LCSSA form being incorrect in
-; outer loop. However, the exit block where LCSSA fails, is infact still within
-; the outer loop. For now, we just bail out in presence of outer loop and epilog
-; loop is generated.
-; The outer loop header is the preheader for the inner loop and the inner header
-; branches back to the outer loop.
-define void @test8() {
-; EPILOG: test8(
-; EPILOG-NOT: niter
-
-; PROLOG: test8(
-; PROLOG: outerloop:
-; PROLOG-NEXT: phi i64 [ 3, %bb ], [ 0, %outerloop.loopexit ]
-; PROLOG: %lcmp.mod = icmp eq i64
-; PROLOG-NEXT: br i1 %lcmp.mod, label %innerH.prol.loopexit, label %innerH.prol.preheader
-; PROLOG: latch.6:
-; PROLOG-NEXT: %tmp4.7 = add nsw i64 %tmp3, 8
-; PROLOG-NEXT: br i1 false, label %outerloop.loopexit.loopexit, label %latch.7
-; PROLOG: latch.7
-; PROLOG-NEXT: %tmp6.7 = icmp ult i64 %tmp4.7, 100
-; PROLOG-NEXT: br i1 %tmp6.7, label %innerH, label %exit.unr-lcssa
-bb:
- br label %outerloop
-
-outerloop: ; preds = %innerH, %bb
- %tmp = phi i64 [ 3, %bb ], [ 0, %innerH ]
- br label %innerH
-
-innerH: ; preds = %latch, %outerloop
- %tmp3 = phi i64 [ %tmp4, %latch ], [ %tmp, %outerloop ]
- %tmp4 = add nuw nsw i64 %tmp3, 1
- br i1 false, label %outerloop, label %latch
-
-latch: ; preds = %innerH
- %tmp6 = icmp ult i64 %tmp4, 100
- br i1 %tmp6, label %innerH, label %exit
-
-exit: ; preds = %latch
- ret void
-}
-
-declare i8 addrspace(1)* @foo(i32)
-; inner loop prolog unrolled
-; a value from outer loop is used in exit block of inner loop.
-; Don't create VMap entries for such values (%trip).
-define i8 addrspace(1)* @test9(i8* nocapture readonly %arg, i32 %n) {
-; PROLOG: test9(
-; PROLOG: header.prol:
-; PROLOG-NEXT: %phi.prol = phi i64 [ 0, %header.prol.preheader ], [ %iv.next.prol, %latch.prol ]
-; PROLOG: latch.prol:
-; PROLOG-NOT: trip
-; PROLOG: br i1 %prol.iter.cmp, label %header.prol.loopexit.unr-lcssa, label %header.prol
-bb:
- br label %outerloopHdr
-
-outerloopHdr: ; preds = %outerLatch, %bb
- %trip = add i32 %n, -1
- %outercnd = icmp slt i32 0, %trip
- br i1 %outercnd, label %preheader, label %outerLatch
-
-preheader: ; preds = %outerloopHdr
- %tmp4 = zext i32 0 to i64
- br label %header
-
-header: ; preds = %latch, %preheader
- %phi = phi i64 [ %tmp4, %preheader ], [ %iv.next, %latch ]
- %tmp7 = trunc i64 %phi to i32
- br i1 true, label %latch, label %innerexit
-
-innerexit: ; preds = %header
- %tmp9 = call i8 addrspace(1)* @foo(i32 %trip)
- ret i8 addrspace(1)* %tmp9
-
-latch: ; preds = %header
- %tmp11 = add nsw i32 %tmp7, 1
- %innercnd = icmp slt i32 %tmp11, %trip
- %iv.next = add nuw nsw i64 %phi, 1
- br i1 %innercnd, label %header, label %outerLatch
-
-outerLatch: ; preds = %latch, %outerloopHdr
- br label %outerloopHdr
-}
diff --git a/llvm/test/Transforms/LoopUnroll/runtime-loop-non-exiting-latch.ll b/llvm/test/Transforms/LoopUnroll/runtime-loop-non-exiting-latch.ll
deleted file mode 100644
index 6915981375a..00000000000
--- a/llvm/test/Transforms/LoopUnroll/runtime-loop-non-exiting-latch.ll
+++ /dev/null
@@ -1,27 +0,0 @@
-; REQUIRES: asserts
-; RUN: opt < %s -S -loop-unroll -unroll-runtime=true -unroll-allow-remainder=true -unroll-count=4
-
-; Make sure that the runtime unroll does not break with a non-exiting latch.
-define i32 @test(i32* %a, i32* %b, i32* %c, i64 %n) {
-entry:
- br label %while.cond
-
-while.cond: ; preds = %while.body, %entry
- %i.0 = phi i64 [ 0, %entry ], [ %inc, %while.body ]
- %cmp = icmp slt i64 %i.0, %n
- br i1 %cmp, label %while.body, label %while.end
-
-while.body: ; preds = %while.cond
- %arrayidx = getelementptr inbounds i32, i32* %b, i64 %i.0
- %0 = load i32, i32* %arrayidx
- %arrayidx1 = getelementptr inbounds i32, i32* %c, i64 %i.0
- %1 = load i32, i32* %arrayidx1
- %mul = mul nsw i32 %0, %1
- %arrayidx2 = getelementptr inbounds i32, i32* %a, i64 %i.0
- store i32 %mul, i32* %arrayidx2
- %inc = add nsw i64 %i.0, 1
- br label %while.cond
-
-while.end: ; preds = %while.cond
- ret i32 0
-}
diff --git a/llvm/test/Transforms/LoopUnroll/runtime-loop.ll b/llvm/test/Transforms/LoopUnroll/runtime-loop.ll
deleted file mode 100644
index 19072855d25..00000000000
--- a/llvm/test/Transforms/LoopUnroll/runtime-loop.ll
+++ /dev/null
@@ -1,285 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-runtime=true -unroll-runtime-epilog=true | FileCheck %s -check-prefixes=EPILOG,COMMON
-; RUN: opt < %s -S -loop-unroll -unroll-runtime=true -unroll-runtime-epilog=false | FileCheck %s -check-prefixes=PROLOG,COMMON
-;
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll' -unroll-runtime=true -unroll-runtime-epilog=true | FileCheck %s -check-prefixes=EPILOG,COMMON
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll' -unroll-runtime=true -unroll-runtime-epilog=false | FileCheck %s -check-prefixes=PROLOG,COMMON
-;
-; Restricted versions of unroll (unroll<peeling;noruntime>, unroll-full) should not be doing runtime unrolling
-; even if it is globally enabled through -unroll-runtime option
-;
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll<peeling;no-runtime>' -unroll-runtime=true -unroll-runtime-epilog=true | FileCheck %s -check-prefixes=NOEPILOG,COMMON
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll<peeling;no-runtime>' -unroll-runtime=true -unroll-runtime-epilog=false | FileCheck %s -check-prefixes=NOPROLOG,COMMON
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(unroll-full)' -unroll-runtime=true -unroll-runtime-epilog=true | FileCheck %s -check-prefixes=NOEPILOG,COMMON
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(unroll-full)' -unroll-runtime=true -unroll-runtime-epilog=false | FileCheck %s -check-prefixes=NOPROLOG,COMMON
-
-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"
-
-; Tests for unrolling loops with run-time trip counts
-
-; COMMON-LABEL: @test(
-
-; EPILOG: %xtraiter = and i32 %n
-; EPILOG: %lcmp.mod = icmp ne i32 %xtraiter, 0
-; EPILOG: br i1 %lcmp.mod, label %for.body.epil.preheader, label %for.end.loopexit
-
-; NOEPILOG-NOT: %xtraiter = and i32 %n
-
-; PROLOG: %xtraiter = and i32 %n
-; PROLOG: %lcmp.mod = icmp ne i32 %xtraiter, 0
-; PROLOG: br i1 %lcmp.mod, label %for.body.prol.preheader, label %for.body.prol.loopexit
-
-; NOPROLOG-NOT: %xtraiter = and i32 %n
-
-; EPILOG: for.body.epil:
-; EPILOG: %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.body.epil.preheader ]
-; EPILOG: %epil.iter.sub = sub i32 %epil.iter, 1
-; EPILOG: %epil.iter.cmp = icmp ne i32 %epil.iter.sub, 0
-; EPILOG: br i1 %epil.iter.cmp, label %for.body.epil, label %for.end.loopexit.epilog-lcssa, !llvm.loop !0
-
-; NOEPILOG: for.body:
-; NOEPILOG-NOT: for.body.epil:
-
-; PROLOG: for.body.prol:
-; PROLOG: %indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ 0, %for.body.prol.preheader ]
-; PROLOG: %prol.iter.sub = sub i32 %prol.iter, 1
-; PROLOG: %prol.iter.cmp = icmp ne i32 %prol.iter.sub, 0
-; PROLOG: br i1 %prol.iter.cmp, label %for.body.prol, label %for.body.prol.loopexit.unr-lcssa, !llvm.loop !0
-
-; NOPROLOG: for.body:
-; NOPROLOG-NOT: for.body.prol:
-
-
-define i32 @test(i32* nocapture %a, i32 %n) nounwind uwtable readonly {
-entry:
- %cmp1 = icmp eq i32 %n, 0
- br i1 %cmp1, label %for.end, label %for.body
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
- %sum.02 = phi i32 [ %add, %for.body ], [ 0, %entry ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %add = add nsw i32 %0, %sum.02
- %indvars.iv.next = add i64 %indvars.iv, 1
- %lftr.wideiv = trunc i64 %indvars.iv.next to i32
- %exitcond = icmp eq i32 %lftr.wideiv, %n
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %for.body, %entry
- %sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
- ret i32 %sum.0.lcssa
-}
-
-
-; Still try to completely unroll loops with compile-time trip counts
-; even if the -unroll-runtime is specified
-
-; COMMON-LABEL: @test1(
-; COMMON: for.body:
-; COMMON-NOT: for.body.epil:
-; COMMON-NOT: for.body.prol:
-
-define i32 @test1(i32* nocapture %a) nounwind uwtable readonly {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %sum.01 = phi i32 [ 0, %entry ], [ %add, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %add = add nsw i32 %0, %sum.01
- %indvars.iv.next = add i64 %indvars.iv, 1
- %lftr.wideiv = trunc i64 %indvars.iv.next to i32
- %exitcond = icmp eq i32 %lftr.wideiv, 5
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %for.body
- ret i32 %add
-}
-
-; This is test 2007-05-09-UnknownTripCount.ll which can be unrolled now
-; if the -unroll-runtime option is turned on
-
-; COMMON-LABEL: @foo(
-; EPILOG: bb72.2:
-; PROLOG: bb72.2:
-; NOEPILOG-NOT: bb72.2:
-; NOPROLOG-NOT: bb72.2:
-
-define void @foo(i32 %trips) {
-entry:
- br label %cond_true.outer
-
-cond_true.outer:
- %indvar1.ph = phi i32 [ 0, %entry ], [ %indvar.next2, %bb72 ]
- br label %bb72
-
-bb72:
- %indvar.next2 = add i32 %indvar1.ph, 1
- %exitcond3 = icmp eq i32 %indvar.next2, %trips
- br i1 %exitcond3, label %cond_true138, label %cond_true.outer
-
-cond_true138:
- ret void
-}
-
-
-; Test run-time unrolling for a loop that counts down by -2.
-
-; COMMON-LABEL: @down(
-; EPILOG: for.body.epil:
-; EPILOG: br i1 %epil.iter.cmp, label %for.body.epil, label %for.cond.for.end_crit_edge.epilog-lcssa
-
-; NOEPILOG: for.body:
-; NOEPILOG-NOT: for.body.epil:
-
-; PROLOG: for.body.prol:
-; PROLOG: br i1 %prol.iter.cmp, label %for.body.prol, label %for.body.prol.loopexit
-
-; NOPROLOG: for.body:
-; NOPROLOG-NOT: for.body.prol:
-
-define zeroext i16 @down(i16* nocapture %p, i32 %len) nounwind uwtable readonly {
-entry:
- %cmp2 = icmp eq i32 %len, 0
- br i1 %cmp2, label %for.end, label %for.body
-
-for.body: ; preds = %for.body, %entry
- %p.addr.05 = phi i16* [ %incdec.ptr, %for.body ], [ %p, %entry ]
- %len.addr.04 = phi i32 [ %sub, %for.body ], [ %len, %entry ]
- %res.03 = phi i32 [ %add, %for.body ], [ 0, %entry ]
- %incdec.ptr = getelementptr inbounds i16, i16* %p.addr.05, i64 1
- %0 = load i16, i16* %p.addr.05, align 2
- %conv = zext i16 %0 to i32
- %add = add i32 %conv, %res.03
- %sub = add nsw i32 %len.addr.04, -2
- %cmp = icmp eq i32 %sub, 0
- br i1 %cmp, label %for.cond.for.end_crit_edge, label %for.body
-
-for.cond.for.end_crit_edge: ; preds = %for.body
- %phitmp = trunc i32 %add to i16
- br label %for.end
-
-for.end: ; preds = %for.cond.for.end_crit_edge, %entry
- %res.0.lcssa = phi i16 [ %phitmp, %for.cond.for.end_crit_edge ], [ 0, %entry ]
- ret i16 %res.0.lcssa
-}
-
-; Test run-time unrolling disable metadata.
-; COMMON-LABEL: @test2(
-
-; EPILOG: for.body:
-; EPILOG-NOT: for.body.epil:
-
-; NOEPILOG: for.body:
-; NOEPILOG-NOT: for.body.epil:
-
-; PROLOG: for.body:
-; PROLOG-NOT: for.body.prol:
-
-; NOPROLOG: for.body:
-; NOPROLOG-NOT: for.body.prol:
-
-define zeroext i16 @test2(i16* nocapture %p, i32 %len) nounwind uwtable readonly {
-entry:
- %cmp2 = icmp eq i32 %len, 0
- br i1 %cmp2, label %for.end, label %for.body
-
-for.body: ; preds = %for.body, %entry
- %p.addr.05 = phi i16* [ %incdec.ptr, %for.body ], [ %p, %entry ]
- %len.addr.04 = phi i32 [ %sub, %for.body ], [ %len, %entry ]
- %res.03 = phi i32 [ %add, %for.body ], [ 0, %entry ]
- %incdec.ptr = getelementptr inbounds i16, i16* %p.addr.05, i64 1
- %0 = load i16, i16* %p.addr.05, align 2
- %conv = zext i16 %0 to i32
- %add = add i32 %conv, %res.03
- %sub = add nsw i32 %len.addr.04, -2
- %cmp = icmp eq i32 %sub, 0
- br i1 %cmp, label %for.cond.for.end_crit_edge, label %for.body, !llvm.loop !0
-
-for.cond.for.end_crit_edge: ; preds = %for.body
- %phitmp = trunc i32 %add to i16
- br label %for.end
-
-for.end: ; preds = %for.cond.for.end_crit_edge, %entry
- %res.0.lcssa = phi i16 [ %phitmp, %for.cond.for.end_crit_edge ], [ 0, %entry ]
- ret i16 %res.0.lcssa
-}
-
-; dont unroll loop with multiple exit/exiting blocks, unless
-; -runtime-unroll-multi-exit=true
-; single exit, multiple exiting blocks.
-define void @unique_exit(i32 %arg) {
-; COMMON-LABEL: @unique_exit(
-; COMMON-NOT: .unr
-
-entry:
- %tmp = icmp sgt i32 undef, %arg
- br i1 %tmp, label %preheader, label %returnblock
-
-preheader: ; preds = %entry
- br label %header
-
-LoopExit: ; preds = %header, %latch
- %tmp2.ph = phi i32 [ %tmp4, %header ], [ -1, %latch ]
- br label %returnblock
-
-returnblock: ; preds = %LoopExit, %entry
- %tmp2 = phi i32 [ -1, %entry ], [ %tmp2.ph, %LoopExit ]
- ret void
-
-header: ; preds = %preheader, %latch
- %tmp4 = phi i32 [ %inc, %latch ], [ %arg, %preheader ]
- %inc = add nsw i32 %tmp4, 1
- br i1 true, label %LoopExit, label %latch
-
-latch: ; preds = %header
- %cmp = icmp slt i32 %inc, undef
- br i1 %cmp, label %header, label %LoopExit
-}
-
-; multiple exit blocks. don't unroll
-define void @multi_exit(i64 %trip, i1 %cond) {
-; COMMON-LABEL: @multi_exit(
-; COMMON-NOT: .unr
-
-entry:
- br label %loop_header
-
-loop_header:
- %iv = phi i64 [ 0, %entry ], [ %iv_next, %loop_latch ]
- br i1 %cond, label %loop_latch, label %loop_exiting_bb1
-
-loop_exiting_bb1:
- br i1 false, label %loop_exiting_bb2, label %exit1
-
-loop_exiting_bb2:
- br i1 false, label %loop_latch, label %exit3
-
-exit3:
- ret void
-
-loop_latch:
- %iv_next = add i64 %iv, 1
- %cmp = icmp ne i64 %iv_next, %trip
- br i1 %cmp, label %loop_header, label %exit2.loopexit
-
-exit1:
- ret void
-
-exit2.loopexit:
- ret void
-}
-
-!0 = distinct !{!0, !1}
-!1 = !{!"llvm.loop.unroll.runtime.disable"}
-
-; need to use LABEL here to separate function IR matching from metadata matching
-; COMMON-LABEL: {{^}}!0 =
-
-; EPILOG-SAME: distinct !{!0, !1}
-; EPILOG: !1 = !{!"llvm.loop.unroll.disable"}
-
-; PROLOG-SAME: distinct !{!0, !1}
-; PROLOG: !1 = !{!"llvm.loop.unroll.disable"}
diff --git a/llvm/test/Transforms/LoopUnroll/runtime-loop1.ll b/llvm/test/Transforms/LoopUnroll/runtime-loop1.ll
deleted file mode 100644
index fb42443f326..00000000000
--- a/llvm/test/Transforms/LoopUnroll/runtime-loop1.ll
+++ /dev/null
@@ -1,77 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-runtime -unroll-count=2 -unroll-runtime-epilog=true | FileCheck %s -check-prefix=EPILOG
-; RUN: opt < %s -S -loop-unroll -unroll-runtime -unroll-count=2 -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG
-
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll' -unroll-runtime -unroll-count=2 -unroll-runtime-epilog=true | FileCheck %s -check-prefix=EPILOG
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll' -unroll-runtime -unroll-count=2 -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG
-
-; This tests that setting the unroll count works
-
-
-; EPILOG: for.body.preheader:
-; EPILOG: br i1 %1, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new, !dbg [[PH_LOC:![0-9]+]]
-; EPILOG: for.body:
-; EPILOG: br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa.loopexit, label %for.body, !dbg [[BODY_LOC:![0-9]+]]
-; EPILOG-NOT: br i1 %niter.ncmp.2, label %for.end.loopexit{{.*}}, label %for.body
-; EPILOG: for.body.epil.preheader:
-; EPILOG: br label %for.body.epil, !dbg [[BODY_LOC]]
-; EPILOG: for.body.epil:
-; EPILOG: br label %for.end.loopexit.epilog-lcssa, !dbg [[BODY_LOC]]
-; EPILOG: for.end.loopexit:
-; EPILOG: br label %for.end, !dbg [[EXIT_LOC:![0-9]+]]
-
-; EPILOG-DAG: [[PH_LOC]] = !DILocation(line: 101, column: 1, scope: !{{.*}})
-; EPILOG-DAG: [[BODY_LOC]] = !DILocation(line: 102, column: 1, scope: !{{.*}})
-; EPILOG-DAG: [[EXIT_LOC]] = !DILocation(line: 103, column: 1, scope: !{{.*}})
-
-; PROLOG: for.body.preheader:
-; PROLOG: br {{.*}} label %for.body.prol.preheader, label %for.body.prol.loopexit, !dbg [[PH_LOC:![0-9]+]]
-; PROLOG: for.body.prol:
-; PROLOG: br label %for.body.prol.loopexit, !dbg [[BODY_LOC:![0-9]+]]
-; PROLOG: for.body.prol.loopexit:
-; PROLOG: br {{.*}} label %for.end.loopexit, label %for.body.preheader.new, !dbg [[PH_LOC]]
-; PROLOG: for.body:
-; PROLOG: br i1 %exitcond.1, label %for.end.loopexit.unr-lcssa, label %for.body, !dbg [[BODY_LOC]]
-; PROLOG-NOT: br i1 %exitcond.4, label %for.end.loopexit{{.*}}, label %for.body
-
-; PROLOG-DAG: [[PH_LOC]] = !DILocation(line: 101, column: 1, scope: !{{.*}})
-; PROLOG-DAG: [[BODY_LOC]] = !DILocation(line: 102, column: 1, scope: !{{.*}})
-
-define i32 @test(i32* nocapture %a, i32 %n) nounwind uwtable readonly !dbg !6 {
-entry:
- %cmp1 = icmp eq i32 %n, 0, !dbg !7
- br i1 %cmp1, label %for.end, label %for.body, !dbg !7
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
- %sum.02 = phi i32 [ %add, %for.body ], [ 0, %entry ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv, !dbg !8
- %0 = load i32, i32* %arrayidx, align 4, !dbg !8
- %add = add nsw i32 %0, %sum.02, !dbg !8
- %indvars.iv.next = add i64 %indvars.iv, 1, !dbg !9
- %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !9
- %exitcond = icmp eq i32 %lftr.wideiv, %n, !dbg !9
- br i1 %exitcond, label %for.end, label %for.body, !dbg !9
-
-for.end: ; preds = %for.body, %entry
- %sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
- ret i32 %sum.0.lcssa, !dbg !10
-}
-
-!llvm.module.flags = !{!0, !1, !2}
-!llvm.dbg.cu = !{!11}
-!0 = !{i32 2, !"Dwarf Version", i32 4}
-!1 = !{i32 2, !"Debug Info Version", i32 3}
-!2 = !{i32 1, !"PIC Level", i32 2}
-
-!3 = !{}
-!4 = !DISubroutineType(types: !3)
-!5 = !DIFile(filename: "test.cpp", directory: "/tmp")
-!6 = distinct !DISubprogram(name: "test", scope: !5, file: !5, line: 99, type: !4, isLocal: false, isDefinition: true, scopeLine: 100, flags: DIFlagPrototyped, isOptimized: false, unit: !11, retainedNodes: !3)
-!7 = !DILocation(line: 100, column: 1, scope: !6)
-!8 = !DILocation(line: 101, column: 1, scope: !6)
-!9 = !DILocation(line: 102, column: 1, scope: !6)
-!10 = !DILocation(line: 103, column: 1, scope: !6)
-!11 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang",
- file: !5,
- isOptimized: true, flags: "-O2",
- splitDebugFilename: "abc.debug", emissionKind: 2)
diff --git a/llvm/test/Transforms/LoopUnroll/runtime-loop2.ll b/llvm/test/Transforms/LoopUnroll/runtime-loop2.ll
deleted file mode 100644
index 5a35d528a78..00000000000
--- a/llvm/test/Transforms/LoopUnroll/runtime-loop2.ll
+++ /dev/null
@@ -1,39 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-threshold=25 -unroll-partial-threshold=25 -unroll-runtime -unroll-runtime-epilog=true -unroll-count=8 | FileCheck %s -check-prefix=EPILOG
-; RUN: opt < %s -S -loop-unroll -unroll-threshold=25 -unroll-partial-threshold=25 -unroll-runtime -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG
-
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll' -unroll-threshold=25 -unroll-partial-threshold=25 -unroll-runtime -unroll-runtime-epilog=true -unroll-count=8 | FileCheck %s -check-prefix=EPILOG
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll' -unroll-threshold=25 -unroll-partial-threshold=25 -unroll-runtime -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG
-
-; Choose a smaller, power-of-two, unroll count if the loop is too large.
-; This test makes sure we're not unrolling 'odd' counts
-
-; EPILOG: for.body:
-; EPILOG: br i1 %niter.ncmp.3, label %for.end.loopexit.unr-lcssa.loopexit{{.*}}, label %for.body
-; EPILOG-NOT: br i1 %niter.ncmp.4, label %for.end.loopexit.unr-lcssa.loopexit{{.*}}, label %for.body
-; EPILOG: for.body.epil:
-
-; PROLOG: for.body.prol:
-; PROLOG: for.body:
-; PROLOG: br i1 %exitcond.3, label %for.end.loopexit{{.*}}, label %for.body
-; PROLOG-NOT: br i1 %exitcond.4, label %for.end.loopexit{{.*}}, label %for.body
-
-define i32 @test(i32* nocapture %a, i32 %n) nounwind uwtable readonly {
-entry:
- %cmp1 = icmp eq i32 %n, 0
- br i1 %cmp1, label %for.end, label %for.body
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
- %sum.02 = phi i32 [ %add, %for.body ], [ 0, %entry ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %add = add nsw i32 %0, %sum.02
- %indvars.iv.next = add i64 %indvars.iv, 1
- %lftr.wideiv = trunc i64 %indvars.iv.next to i32
- %exitcond = icmp eq i32 %lftr.wideiv, %n
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %for.body, %entry
- %sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
- ret i32 %sum.0.lcssa
-}
diff --git a/llvm/test/Transforms/LoopUnroll/runtime-loop3.ll b/llvm/test/Transforms/LoopUnroll/runtime-loop3.ll
deleted file mode 100644
index 26790bcb95e..00000000000
--- a/llvm/test/Transforms/LoopUnroll/runtime-loop3.ll
+++ /dev/null
@@ -1,46 +0,0 @@
-; REQUIRES: asserts
-; RUN: opt < %s -disable-output -stats -loop-unroll -unroll-runtime -unroll-partial-threshold=200 -unroll-threshold=400 -info-output-file - | FileCheck %s --check-prefix=STATS
-; RUN: opt < %s -disable-output -stats -passes='require<opt-remark-emit>,unroll' -unroll-runtime -unroll-partial-threshold=200 -unroll-threshold=400 -info-output-file - | FileCheck %s --check-prefix=STATS
-
-; Test that nested loops can be unrolled. We need to increase threshold to do it
-
-; STATS: 2 loop-unroll - Number of loops unrolled (completely or otherwise)
-
-define i32 @nested(i32* nocapture %a, i32 %n, i32 %m) nounwind uwtable readonly {
-entry:
- %cmp11 = icmp sgt i32 %n, 0
- br i1 %cmp11, label %for.cond1.preheader.lr.ph, label %for.end7
-
-for.cond1.preheader.lr.ph: ; preds = %entry
- %cmp28 = icmp sgt i32 %m, 0
- br label %for.cond1.preheader
-
-for.cond1.preheader: ; preds = %for.inc5, %for.cond1.preheader.lr.ph
- %indvars.iv16 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next17, %for.inc5 ]
- %sum.012 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %sum.1.lcssa, %for.inc5 ]
- br i1 %cmp28, label %for.body3, label %for.inc5
-
-for.body3: ; preds = %for.cond1.preheader, %for.body3
- %indvars.iv = phi i64 [ %indvars.iv.next, %for.body3 ], [ 0, %for.cond1.preheader ]
- %sum.19 = phi i32 [ %add4, %for.body3 ], [ %sum.012, %for.cond1.preheader ]
- %0 = add nsw i64 %indvars.iv, %indvars.iv16
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %0
- %1 = load i32, i32* %arrayidx, align 4
- %add4 = add nsw i32 %1, %sum.19
- %indvars.iv.next = add i64 %indvars.iv, 1
- %lftr.wideiv = trunc i64 %indvars.iv.next to i32
- %exitcond = icmp eq i32 %lftr.wideiv, %m
- br i1 %exitcond, label %for.inc5, label %for.body3
-
-for.inc5: ; preds = %for.body3, %for.cond1.preheader
- %sum.1.lcssa = phi i32 [ %sum.012, %for.cond1.preheader ], [ %add4, %for.body3 ]
- %indvars.iv.next17 = add i64 %indvars.iv16, 1
- %lftr.wideiv18 = trunc i64 %indvars.iv.next17 to i32
- %exitcond19 = icmp eq i32 %lftr.wideiv18, %n
- br i1 %exitcond19, label %for.end7, label %for.cond1.preheader
-
-for.end7: ; preds = %for.inc5, %entry
- %sum.0.lcssa = phi i32 [ 0, %entry ], [ %sum.1.lcssa, %for.inc5 ]
- ret i32 %sum.0.lcssa
-}
-
diff --git a/llvm/test/Transforms/LoopUnroll/runtime-loop4.ll b/llvm/test/Transforms/LoopUnroll/runtime-loop4.ll
deleted file mode 100644
index 4a9104eb00d..00000000000
--- a/llvm/test/Transforms/LoopUnroll/runtime-loop4.ll
+++ /dev/null
@@ -1,52 +0,0 @@
-; RUN: opt < %s -S -O2 -unroll-runtime=true -unroll-runtime-epilog=true | FileCheck %s -check-prefix=EPILOG
-; RUN: opt < %s -S -O2 -unroll-runtime=true -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG
-
-; Check runtime unrolling prologue can be promoted by LICM pass.
-
-; EPILOG: entry:
-; EPILOG: %xtraiter
-; EPILOG: %lcmp.mod
-; EPILOG: loop1:
-; EPILOG: br i1 %lcmp.mod
-; EPILOG: loop2.epil:
-
-; PROLOG: entry:
-; PROLOG: %xtraiter
-; PROLOG: %lcmp.mod
-; PROLOG: loop1:
-; PROLOG: br i1 %lcmp.mod
-; PROLOG: loop2.prol:
-
-define void @unroll(i32 %iter, i32* %addr1, i32* %addr2) nounwind {
-entry:
- br label %loop1
-
-loop1:
- %iv1 = phi i32 [ 0, %entry ], [ %inc1, %loop1.latch ]
- %offset1 = getelementptr i32, i32* %addr1, i32 %iv1
- store i32 %iv1, i32* %offset1, align 4
- br label %loop2.header
-
-loop2.header:
- %e = icmp uge i32 %iter, 1
- br i1 %e, label %loop2, label %exit2
-
-loop2:
- %iv2 = phi i32 [ 0, %loop2.header ], [ %inc2, %loop2 ]
- %offset2 = getelementptr i32, i32* %addr2, i32 %iv2
- store i32 %iv2, i32* %offset2, align 4
- %inc2 = add i32 %iv2, 1
- %exitcnd2 = icmp uge i32 %inc2, %iter
- br i1 %exitcnd2, label %exit2, label %loop2
-
-exit2:
- br label %loop1.latch
-
-loop1.latch:
- %inc1 = add i32 %iv1, 1
- %exitcnd1 = icmp uge i32 %inc1, 1024
- br i1 %exitcnd1, label %exit, label %loop1
-
-exit:
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/runtime-loop5.ll b/llvm/test/Transforms/LoopUnroll/runtime-loop5.ll
deleted file mode 100644
index ebb9a85600b..00000000000
--- a/llvm/test/Transforms/LoopUnroll/runtime-loop5.ll
+++ /dev/null
@@ -1,49 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-runtime=true -unroll-count=16 | FileCheck --check-prefix=UNROLL-16 %s
-; RUN: opt < %s -S -loop-unroll -unroll-runtime=true -unroll-count=4 | FileCheck --check-prefix=UNROLL-4 %s
-
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll' -unroll-runtime=true -unroll-count=16 | FileCheck --check-prefix=UNROLL-16 %s
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll' -unroll-runtime=true -unroll-count=4 | FileCheck --check-prefix=UNROLL-4 %s
-
-; Given that the trip-count of this loop is a 3-bit value, we cannot
-; safely unroll it with a count of anything more than 8.
-
-define i3 @test(i3* %a, i3 %n) {
-; UNROLL-16-LABEL: @test(
-; UNROLL-4-LABEL: @test(
-entry:
- %cmp1 = icmp eq i3 %n, 0
- br i1 %cmp1, label %for.end, label %for.body
-
-for.body: ; preds = %for.body, %entry
-; UNROLL-16-LABEL: for.body:
-; UNROLL-4-LABEL: for.body:
- %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
- %sum.02 = phi i3 [ %add, %for.body ], [ 0, %entry ]
- %arrayidx = getelementptr inbounds i3, i3* %a, i64 %indvars.iv
-
-; UNROLL-16-LABEL: for.body
-; UNROLL-16-LABEL: getelementptr
-; UNROLL-16-LABEL-NOT: getelementptr
-
-; UNROLL-4-LABEL: getelementptr
-; UNROLL-4-LABEL: getelementptr
-; UNROLL-4-LABEL: getelementptr
-; UNROLL-4-LABEL: getelementptr
-
- %0 = load i3, i3* %arrayidx
- %add = add nsw i3 %0, %sum.02
- %indvars.iv.next = add i64 %indvars.iv, 1
- %lftr.wideiv = trunc i64 %indvars.iv.next to i3
- %exitcond = icmp eq i3 %lftr.wideiv, %n
- br i1 %exitcond, label %for.end, label %for.body
-
-; UNROLL-16-LABEL: for.end
-; UNROLL-4-LABEL: for.end
-
-; UNROLL-16-NOT: for.body.epil:
-; UNROLL-4: for.body.epil:
-
-for.end: ; preds = %for.body, %entry
- %sum.0.lcssa = phi i3 [ 0, %entry ], [ %add, %for.body ]
- ret i3 %sum.0.lcssa
-}
diff --git a/llvm/test/Transforms/LoopUnroll/runtime-multiexit-heuristic.ll b/llvm/test/Transforms/LoopUnroll/runtime-multiexit-heuristic.ll
deleted file mode 100644
index b9aa906ccdc..00000000000
--- a/llvm/test/Transforms/LoopUnroll/runtime-multiexit-heuristic.ll
+++ /dev/null
@@ -1,94 +0,0 @@
-; RUN: opt < %s -loop-unroll -unroll-runtime=true -verify-dom-info -verify-loop-info -instcombine -S | FileCheck %s
-; RUN: opt < %s -loop-unroll -unroll-runtime=true -verify-dom-info -unroll-runtime-multi-exit=false -verify-loop-info -S | FileCheck %s -check-prefix=NOUNROLL
-
-; this tests when unrolling multiple exit loop occurs by default (i.e. without specifying -unroll-runtime-multi-exit)
-
-; the second exit block is a deopt block. The loop has one exiting block other than the latch.
-define i32 @test1(i32* nocapture %a, i64 %n) {
-; CHECK-LABEL: test1(
-; CHECK-LABEL: header.epil:
-; CHECK-NEXT: %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %latch.epil ], [ %indvars.iv.unr, %header.epil.preheader ]
-; CHECK-LABEL: otherexit.loopexit:
-; CHECK-NEXT: %sum.02.lcssa.ph = phi i32 [ %sum.02, %for.exiting_block ], [ %add, %for.exiting_block.1 ], [ %add.1, %for.exiting_block.2 ], [ %add.2, %for.exiting_block.3 ], [ %add.3, %for.exiting_block.4 ], [ %add.4, %for.exiting_block.5 ], [ %add.5, %for.exiting_block.6 ],
-; CHECK-NEXT: br label %otherexit
-; CHECK-LABEL: otherexit.loopexit3:
-; CHECK-NEXT: br label %otherexit
-; CHECK-LABEL: otherexit:
-; CHECK-NEXT: %sum.02.lcssa = phi i32 [ %sum.02.lcssa.ph, %otherexit.loopexit ], [ %sum.02.epil, %otherexit.loopexit3 ]
-; CHECK-NEXT: %rval = call i32 (...) @llvm.experimental.deoptimize.i32() [ "deopt"(i32 %sum.02.lcssa) ]
-; CHECK-NEXT: ret i32 %rval
-; CHECK-LABEL: latch.7:
-; CHECK: add i64 %indvars.iv, 8
-
-; NOUNROLL: test1(
-; NOUNROLL-NOT: .epil
-; NOUNROLL-NOT: .prol
-; NOUNROLL: otherexit:
-; NOUNROLL-NEXT: %sum.02.lcssa = phi i32 [ %sum.02, %for.exiting_block ]
-; NOUNROLL-NEXT: %rval = call i32 (...) @llvm.experimental.deoptimize.i32() [ "deopt"(i32 %sum.02.lcssa) ]
-entry:
- br label %header
-
-header:
- %indvars.iv = phi i64 [ %indvars.iv.next, %latch ], [ 0, %entry ]
- %sum.02 = phi i32 [ %add, %latch ], [ 0, %entry ]
- br label %for.exiting_block
-
-for.exiting_block:
- %cmp = icmp eq i64 %n, 42
- br i1 %cmp, label %otherexit, label %latch
-
-latch:
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %add = add nsw i32 %0, %sum.02
- %indvars.iv.next = add i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, %n
- br i1 %exitcond, label %latchexit, label %header
-
-latchexit: ; preds = %latch
- %sum.0.lcssa = phi i32 [ %add, %latch ]
- ret i32 %sum.0.lcssa
-
-otherexit:
- %rval = call i32(...) @llvm.experimental.deoptimize.i32() [ "deopt"(i32 %sum.02) ]
- ret i32 %rval
-}
-
-; the exit block is not a deopt block.
-define i32 @test2(i32* nocapture %a, i64 %n) {
-; CHECK-LABEL: test2(
-; CHECK-NOT: .epil
-; CHECK-NOT: .prol
-; CHECK-LABEL: otherexit:
-; CHECK-NEXT: ret i32 %sum.02
-
-entry:
- br label %header
-
-header:
- %indvars.iv = phi i64 [ %indvars.iv.next, %latch ], [ 0, %entry ]
- %sum.02 = phi i32 [ %add, %latch ], [ 0, %entry ]
- br label %for.exiting_block
-
-for.exiting_block:
- %cmp = icmp eq i64 %n, 42
- br i1 %cmp, label %otherexit, label %latch
-
-latch:
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %add = add nsw i32 %0, %sum.02
- %indvars.iv.next = add i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, %n
- br i1 %exitcond, label %latchexit, label %header
-
-latchexit: ; preds = %latch
- %sum.0.lcssa = phi i32 [ %add, %latch ]
- ret i32 %sum.0.lcssa
-
-otherexit:
- %rval = phi i32 [%sum.02, %for.exiting_block ]
- ret i32 %rval
-}
-declare i32 @llvm.experimental.deoptimize.i32(...)
diff --git a/llvm/test/Transforms/LoopUnroll/runtime-unroll-remainder.ll b/llvm/test/Transforms/LoopUnroll/runtime-unroll-remainder.ll
deleted file mode 100644
index b85e09bc3bc..00000000000
--- a/llvm/test/Transforms/LoopUnroll/runtime-unroll-remainder.ll
+++ /dev/null
@@ -1,74 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-runtime=true -unroll-count=4 -unroll-remainder -instcombine | FileCheck %s
-
-; CHECK-LABEL: unroll
-define i32 @unroll(i32* nocapture readonly %a, i32* nocapture readonly %b, i32 %N) local_unnamed_addr #0 {
-entry:
- %cmp9 = icmp eq i32 %N, 0
- br i1 %cmp9, label %for.cond.cleanup, label %for.body.lr.ph
-
-for.body.lr.ph:
- %wide.trip.count = zext i32 %N to i64
- br label %for.body
-
-for.cond.cleanup:
- %c.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
- ret i32 %c.0.lcssa
-
-; CHECK-LABEL: for.body.lr.ph
-; CHECK: [[COUNT:%[a-z.0-9]+]] = add nsw i64 %wide.trip.count, -1
-; CHECK: %xtraiter = and i64 %wide.trip.count, 3
-; CHECK: [[CMP:%[a-z.0-9]+]] = icmp ult i64 [[COUNT]], 3
-; CHECK: br i1 [[CMP]], label %[[CLEANUP:.*]], label %for.body.lr.ph.new
-
-; CHECK-LABEL: for.body.lr.ph.new:
-; CHECK: %unroll_iter = sub nsw i64 %wide.trip.count, %xtraiter
-; CHECK: br label %for.body
-
-; CHECK: [[CLEANUP]]:
-; CHECK: [[MOD:%[a-z.0-9]+]] = icmp eq i64 %xtraiter, 0
-; CHECK: br i1 [[MOD]], label %[[EXIT:.*]], label %[[EPIL_PEEL0_PRE:.*]]
-
-; CHECK: [[EPIL_PEEL0_PRE]]:
-; CHECK: br label %[[EPIL_PEEL0:.*]]
-
-; CHECK: [[EPIL_PEEL0]]:
-; CHECK: [[PEEL_CMP0:%[a-z.0-9]+]] = icmp eq i64 %xtraiter, 1
-; CHECK: br i1 [[PEEL_CMP0]], label %[[EPIL_EXIT:.*]], label %[[EPIL_PEEL1:.*]]
-
-; CHECK: [[EPIL_EXIT]]:
-; CHECK: br label %[[EXIT]]
-
-; CHECK: [[EXIT]]:
-; CHECK: ret i32
-
-; CHECK-LABEL: for.body:
-; CHECK: [[INDVAR0:%[a-z.0-9]+]] = phi i64 [ 0, %for.body.lr.ph
-; CHECK: [[ITER:%[a-z.0-9]+]] = phi i64 [ %unroll_iter
-; CHECK: or i64 [[INDVAR0]], 1
-; CHECK: or i64 [[INDVAR0]], 2
-; CHECK: or i64 [[INDVAR0]], 3
-; CHECK: add nuw nsw i64 [[INDVAR0]], 4
-; CHECK: [[SUB:%[a-z.0-9]+]] = add i64 [[ITER]], -4
-; CHECK: [[ITER_CMP:%[a-z.0-9]+]] = icmp eq i64 [[SUB]], 0
-; CHECK: br i1 [[ITER_CMP]], label %[[LOOP_EXIT:.*]], label %for.body
-
-; CHECK: [[EPIL_PEEL1]]:
-; CHECK: [[PEEL_CMP1:%[a-z.0-9]+]] = icmp eq i64 %xtraiter, 2
-; CHECK: br i1 [[PEEL_CMP1]], label %[[EPIL_EXIT]], label %[[EPIL_PEEL2:.*]]
-
-; CHECK: [[EPIL_PEEL2]]:
-; CHECK: br label %[[EXIT]]
-
-for.body:
- %indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
- %c.010 = phi i32 [ 0, %for.body.lr.ph ], [ %add, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %arrayidx2 = getelementptr inbounds i32, i32* %b, i64 %indvars.iv
- %1 = load i32, i32* %arrayidx2, align 4
- %mul = mul nsw i32 %1, %0
- %add = add nsw i32 %mul, %c.010
- %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, label %for.body
-}
diff --git a/llvm/test/Transforms/LoopUnroll/scevunroll.ll b/llvm/test/Transforms/LoopUnroll/scevunroll.ll
deleted file mode 100644
index a5c9a6efacf..00000000000
--- a/llvm/test/Transforms/LoopUnroll/scevunroll.ll
+++ /dev/null
@@ -1,207 +0,0 @@
-; RUN: opt < %s -S -indvars -loop-unroll -verify-loop-info | FileCheck %s
-;
-; Unit tests for loop unrolling using ScalarEvolution to compute trip counts.
-;
-; Indvars is run first to generate an "old" SCEV result. Some unit
-; tests may check that SCEV is properly invalidated between passes.
-
-; Completely unroll loops without a canonical IV.
-;
-; CHECK-LABEL: @sansCanonical(
-; CHECK-NOT: phi
-; CHECK-NOT: icmp
-; CHECK: ret
-define i32 @sansCanonical(i32* %base) nounwind {
-entry:
- br label %while.body
-
-while.body:
- %iv = phi i64 [ 10, %entry ], [ %iv.next, %while.body ]
- %sum = phi i32 [ 0, %entry ], [ %sum.next, %while.body ]
- %iv.next = add i64 %iv, -1
- %adr = getelementptr inbounds i32, i32* %base, i64 %iv.next
- %tmp = load i32, i32* %adr, align 8
- %sum.next = add i32 %sum, %tmp
- %iv.narrow = trunc i64 %iv.next to i32
- %cmp.i65 = icmp sgt i32 %iv.narrow, 0
- br i1 %cmp.i65, label %while.body, label %exit
-
-exit:
- ret i32 %sum
-}
-
-; SCEV unrolling properly handles loops with multiple exits. In this
-; case, the computed trip count based on a canonical IV is *not* for a
-; latch block. Canonical unrolling incorrectly unrolls it, but SCEV
-; unrolling does not.
-;
-; CHECK-LABEL: @earlyLoopTest(
-; CHECK: tail:
-; CHECK-NOT: br
-; CHECK: br i1 %cmp2, label %loop, label %exit2
-define i64 @earlyLoopTest(i64* %base) nounwind {
-entry:
- br label %loop
-
-loop:
- %iv = phi i64 [ 0, %entry ], [ %inc, %tail ]
- %s = phi i64 [ 0, %entry ], [ %s.next, %tail ]
- %adr = getelementptr i64, i64* %base, i64 %iv
- %val = load i64, i64* %adr
- %s.next = add i64 %s, %val
- %inc = add i64 %iv, 1
- %cmp = icmp ne i64 %inc, 4
- br i1 %cmp, label %tail, label %exit1
-
-tail:
- %cmp2 = icmp ne i64 %val, 0
- br i1 %cmp2, label %loop, label %exit2
-
-exit1:
- ret i64 %s
-
-exit2:
- ret i64 %s.next
-}
-
-; SCEV properly unrolls multi-exit loops.
-;
-; CHECK-LABEL: @multiExit(
-; CHECK: getelementptr i32, i32* %base, i32 10
-; CHECK-NEXT: load i32, i32*
-; CHECK: br i1 false, label %l2.10, label %exit1
-; CHECK: l2.10:
-; CHECK-NOT: br
-; CHECK: ret i32
-define i32 @multiExit(i32* %base) nounwind {
-entry:
- br label %l1
-l1:
- %iv1 = phi i32 [ 0, %entry ], [ %inc1, %l2 ]
- %iv2 = phi i32 [ 0, %entry ], [ %inc2, %l2 ]
- %inc1 = add i32 %iv1, 1
- %inc2 = add i32 %iv2, 1
- %adr = getelementptr i32, i32* %base, i32 %iv1
- %val = load i32, i32* %adr
- %cmp1 = icmp slt i32 %iv1, 5
- br i1 %cmp1, label %l2, label %exit1
-l2:
- %cmp2 = icmp slt i32 %iv2, 10
- br i1 %cmp2, label %l1, label %exit2
-exit1:
- ret i32 1
-exit2:
- ret i32 %val
-}
-
-
-; SCEV should not unroll a multi-exit loops unless the latch block has
-; a known trip count, regardless of the early exit trip counts. The
-; LoopUnroll utility uses this assumption to optimize the latch
-; block's branch.
-;
-; CHECK-LABEL: @multiExitIncomplete(
-; CHECK: l3:
-; CHECK-NOT: br
-; CHECK: br i1 %cmp3, label %l1, label %exit3
-define i32 @multiExitIncomplete(i32* %base) nounwind {
-entry:
- br label %l1
-l1:
- %iv1 = phi i32 [ 0, %entry ], [ %inc1, %l3 ]
- %iv2 = phi i32 [ 0, %entry ], [ %inc2, %l3 ]
- %inc1 = add i32 %iv1, 1
- %inc2 = add i32 %iv2, 1
- %adr = getelementptr i32, i32* %base, i32 %iv1
- %val = load i32, i32* %adr
- %cmp1 = icmp slt i32 %iv1, 5
- br i1 %cmp1, label %l2, label %exit1
-l2:
- %cmp2 = icmp slt i32 %iv2, 10
- br i1 %cmp2, label %l3, label %exit2
-l3:
- %cmp3 = icmp ne i32 %val, 0
- br i1 %cmp3, label %l1, label %exit3
-
-exit1:
- ret i32 1
-exit2:
- ret i32 2
-exit3:
- ret i32 3
-}
-
-; When loop unroll merges a loop exit with one of its parent loop's
-; exits, SCEV must forget its ExitNotTaken info.
-;
-; CHECK-LABEL: @nestedUnroll(
-; CHECK-NOT: br i1
-; CHECK: for.body87:
-define void @nestedUnroll() nounwind {
-entry:
- br label %for.inc
-
-for.inc:
- br i1 false, label %for.inc, label %for.body38.preheader
-
-for.body38.preheader:
- br label %for.body38
-
-for.body38:
- %i.113 = phi i32 [ %inc76, %for.inc74 ], [ 0, %for.body38.preheader ]
- %mul48 = mul nsw i32 %i.113, 6
- br label %for.body43
-
-for.body43:
- %j.011 = phi i32 [ 0, %for.body38 ], [ %inc72, %for.body43 ]
- %add49 = add nsw i32 %j.011, %mul48
- %sh_prom50 = zext i32 %add49 to i64
- %inc72 = add nsw i32 %j.011, 1
- br i1 false, label %for.body43, label %for.inc74
-
-for.inc74:
- %inc76 = add nsw i32 %i.113, 1
- br i1 false, label %for.body38, label %for.body87.preheader
-
-for.body87.preheader:
- br label %for.body87
-
-for.body87:
- br label %for.body87
-}
-
-; PR16130: clang produces incorrect code with loop/expression at -O2
-; rdar:14036816 loop-unroll makes assumptions about undefined behavior
-;
-; The loop latch is assumed to exit after the first iteration because
-; of the induction variable's NSW flag. However, the loop latch's
-; equality test is skipped and the loop exits after the second
-; iteration via the early exit. So loop unrolling cannot assume that
-; the loop latch's exit count of zero is an upper bound on the number
-; of iterations.
-;
-; CHECK-LABEL: @nsw_latch(
-; CHECK: for.body:
-; CHECK: %b.03 = phi i32 [ 0, %entry ], [ %add, %for.cond ]
-; CHECK: return:
-; CHECK: %b.03.lcssa = phi i32 [ %b.03, %for.body ], [ %b.03, %for.cond ]
-define void @nsw_latch(i32* %a) nounwind {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.cond, %entry
- %b.03 = phi i32 [ 0, %entry ], [ %add, %for.cond ]
- %tobool = icmp eq i32 %b.03, 0
- %add = add nsw i32 %b.03, 8
- br i1 %tobool, label %for.cond, label %return
-
-for.cond: ; preds = %for.body
- %cmp = icmp eq i32 %add, 13
- br i1 %cmp, label %return, label %for.body
-
-return: ; preds = %for.body, %for.cond
- %b.03.lcssa = phi i32 [ %b.03, %for.body ], [ %b.03, %for.cond ]
- %retval.0 = phi i32 [ 1, %for.body ], [ 0, %for.cond ]
- store i32 %b.03.lcssa, i32* %a, align 4
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/shifted-tripcount.ll b/llvm/test/Transforms/LoopUnroll/shifted-tripcount.ll
deleted file mode 100644
index 4c216983af5..00000000000
--- a/llvm/test/Transforms/LoopUnroll/shifted-tripcount.ll
+++ /dev/null
@@ -1,28 +0,0 @@
-; RUN: opt < %s -loop-unroll -unroll-count=2 -S | FileCheck %s
-
-; LoopUnroll should unroll this loop into one big basic block.
-
-; CHECK: for.body:
-; CHECK: %i.013 = phi i64 [ 0, %entry ], [ %tmp16.1, %for.body ]
-; CHECK: br i1 %exitcond.1, label %for.end, label %for.body
-
-define void @foo(double* nocapture %p, i64 %n) nounwind {
-entry:
- %mul10 = shl i64 %n, 1 ; <i64> [#uses=2]
- br label %for.body
-
-for.body: ; preds = %entry, %for.body
- %i.013 = phi i64 [ %tmp16, %for.body ], [ 0, %entry ] ; <i64> [#uses=2]
- %arrayidx7 = getelementptr double, double* %p, i64 %i.013 ; <double*> [#uses=2]
- %tmp16 = add i64 %i.013, 1 ; <i64> [#uses=3]
- %arrayidx = getelementptr double, double* %p, i64 %tmp16 ; <double*> [#uses=1]
- %tmp4 = load double, double* %arrayidx ; <double> [#uses=1]
- %tmp8 = load double, double* %arrayidx7 ; <double> [#uses=1]
- %mul9 = fmul double %tmp8, %tmp4 ; <double> [#uses=1]
- store double %mul9, double* %arrayidx7
- %exitcond = icmp eq i64 %tmp16, %mul10 ; <i1> [#uses=1]
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %for.body, %entry
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/tripcount-overflow.ll b/llvm/test/Transforms/LoopUnroll/tripcount-overflow.ll
deleted file mode 100644
index 0d5681b539a..00000000000
--- a/llvm/test/Transforms/LoopUnroll/tripcount-overflow.ll
+++ /dev/null
@@ -1,49 +0,0 @@
-; RUN: opt < %s -S -unroll-runtime -unroll-count=2 -loop-unroll -unroll-runtime-epilog=true | FileCheck %s -check-prefix=EPILOG
-; RUN: opt < %s -S -unroll-runtime -unroll-count=2 -loop-unroll -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-
-; This test case documents how runtime loop unrolling handles the case
-; when the backedge-count is -1.
-
-; If %N, the backedge-taken count, is -1 then %0 unsigned-overflows
-; and is 0. %xtraiter too is 0, signifying that the total trip-count
-; is divisible by 2. The prologue then branches to the unrolled loop
-; and executes the 2^32 iterations there, in groups of 2.
-
-; EPILOG: entry:
-
-; EPILOG-NEXT: %0 = add i32 %N, 1
-; EPILOG-NEXT: %xtraiter = and i32 %0, 1
-; EPILOG-NEXT: %1 = icmp ult i32 %N, 1
-; EPILOG-NEXT: br i1 %1, label %while.end.unr-lcssa, label %entry.new
-; EPILOG: while.body:
-
-; EPILOG: %lcmp.mod = icmp ne i32 %xtraiter, 0
-; EPILOG-NEXT: br i1 %lcmp.mod, label %while.body.epil.preheader, label %while.end
-; EPILOG: while.body.epil:
-
-; PROLOG: entry:
-; PROLOG-NEXT: %0 = add i32 %N, 1
-; PROLOG-NEXT: %xtraiter = and i32 %0, 1
-; PROLOG-NEXT: %lcmp.mod = icmp ne i32 %xtraiter, 0
-; PROLOG-NEXT: br i1 %lcmp.mod, label %while.body.prol.preheader, label %while.body.prol.loopexit
-; PROLOG: while.body.prol:
-
-; PROLOG: %1 = icmp ult i32 %N, 1
-; PROLOG-NEXT: br i1 %1, label %while.end, label %entry.new
-; PROLOG: while.body:
-
-; Function Attrs: nounwind readnone ssp uwtable
-define i32 @foo(i32 %N) {
-entry:
- br label %while.body
-
-while.body: ; preds = %while.body, %entry
- %i = phi i32 [ 0, %entry ], [ %inc, %while.body ]
- %cmp = icmp eq i32 %i, %N
- %inc = add i32 %i, 1
- br i1 %cmp, label %while.end, label %while.body
-
-while.end: ; preds = %while.body
- ret i32 %i
-}
diff --git a/llvm/test/Transforms/LoopUnroll/unloop.ll b/llvm/test/Transforms/LoopUnroll/unloop.ll
deleted file mode 100644
index 899ccbf2b2e..00000000000
--- a/llvm/test/Transforms/LoopUnroll/unloop.ll
+++ /dev/null
@@ -1,473 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -verify-loop-info | FileCheck %s
-; RUN: opt < %s -S -passes='require<opt-remark-emit>,unroll,verify<loops>' | FileCheck %s
-;
-; Unit tests for LoopInfo::markAsRemoved.
-
-declare i1 @check() nounwind
-
-; Ensure that tail->inner is removed and rely on verify-loopinfo to
-; check soundness.
-;
-; CHECK-LABEL: @skiplevelexit(
-; CHECK: tail:
-; CHECK-NOT: br
-; CHECK: ret void
-define void @skiplevelexit() nounwind {
-entry:
- br label %outer
-
-outer:
- br label %inner
-
-inner:
- %iv = phi i32 [ 0, %outer ], [ %inc, %tail ]
- %inc = add i32 %iv, 1
- call zeroext i1 @check()
- br i1 true, label %outer.backedge, label %tail
-
-tail:
- br i1 false, label %inner, label %exit
-
-outer.backedge:
- br label %outer
-
-exit:
- ret void
-}
-
-; Remove the middle loop of a triply nested loop tree.
-; Ensure that only the middle loop is removed and rely on verify-loopinfo to
-; check soundness.
-;
-; CHECK-LABEL: @unloopNested(
-; Outer loop control.
-; CHECK: while.body:
-; CHECK: br i1 %cmp3, label %if.then, label %if.end
-; Inner loop control.
-; CHECK: while.end14.i:
-; CHECK: br i1 %call15.i, label %if.end.i, label %exit
-; Middle loop control should no longer reach %while.cond.
-; Now it is the outer loop backedge.
-; CHECK: exit:
-; CHECK: br label %while.cond.outer
-define void @unloopNested() {
-entry:
- br label %while.cond.outer
-
-while.cond.outer:
- br label %while.cond
-
-while.cond:
- %cmp = call zeroext i1 @check()
- br i1 %cmp, label %while.body, label %while.end
-
-while.body:
- %cmp3 = call zeroext i1 @check()
- br i1 %cmp3, label %if.then, label %if.end
-
-if.then:
- br label %return
-
-if.end:
- %cmp.i48 = call zeroext i1 @check()
- br i1 %cmp.i48, label %if.then.i, label %if.else20.i
-
-if.then.i:
- %cmp8.i = call zeroext i1 @check()
- br i1 %cmp8.i, label %merge, label %if.else.i
-
-if.else.i:
- br label %merge
-
-if.else20.i:
- %cmp25.i = call zeroext i1 @check()
- br i1 %cmp25.i, label %merge, label %if.else28.i
-
-if.else28.i:
- br label %merge
-
-merge:
- br label %while.cond2.i
-
-while.cond2.i:
- %cmp.i = call zeroext i1 @check()
- br i1 %cmp.i, label %while.cond2.backedge.i, label %while.end.i
-
-while.cond2.backedge.i:
- br label %while.cond2.i
-
-while.end.i:
- %cmp1114.i = call zeroext i1 @check()
- br i1 %cmp1114.i, label %while.body12.lr.ph.i, label %while.end14.i
-
-while.body12.lr.ph.i:
- br label %while.end14.i
-
-while.end14.i:
- %call15.i = call zeroext i1 @check()
- br i1 %call15.i, label %if.end.i, label %exit
-
-if.end.i:
- br label %while.cond2.backedge.i
-
-exit:
- br i1 false, label %while.cond, label %if.else
-
-if.else:
- br label %while.cond.outer
-
-while.end:
- br label %return
-
-return:
- ret void
-}
-
-; Remove the middle loop of a deeply nested loop tree.
-; Ensure that only the middle loop is removed and rely on verify-loopinfo to
-; check soundness.
-;
-; This test must be disabled until trip count computation can be optimized...
-; rdar:14038809 [SCEV]: Optimize trip count computation for multi-exit loops.
-; CHECKFIXME-LABEL: @unloopDeepNested(
-; Inner-inner loop control.
-; CHECKFIXME: while.cond.us.i:
-; CHECKFIXME: br i1 %cmp.us.i, label %next_data.exit, label %while.body.us.i
-; CHECKFIXME: if.then.us.i:
-; CHECKFIXME: br label %while.cond.us.i
-; Inner loop tail.
-; CHECKFIXME: if.else.i:
-; CHECKFIXME: br label %while.cond.outer.i
-; Middle loop control (removed).
-; CHECKFIXME: valid_data.exit:
-; CHECKFIXME-NOT: br
-; CHECKFIXME: %cmp = call zeroext i1 @check()
-; Outer loop control.
-; CHECKFIXME: copy_data.exit:
-; CHECKFIXME: br i1 %cmp38, label %if.then39, label %while.cond.outer
-; Outer-outer loop tail.
-; CHECKFIXME: while.cond.outer.outer.backedge:
-; CHECKFIXME: br label %while.cond.outer.outer
-define void @unloopDeepNested() nounwind {
-for.cond8.preheader.i:
- %cmp113.i = call zeroext i1 @check()
- br i1 %cmp113.i, label %make_data.exit, label %for.body13.lr.ph.i
-
-for.body13.lr.ph.i:
- br label %make_data.exit
-
-make_data.exit:
- br label %while.cond.outer.outer
-
-while.cond.outer.outer:
- br label %while.cond.outer
-
-while.cond.outer:
- br label %while.cond
-
-while.cond:
- br label %while.cond.outer.i
-
-while.cond.outer.i:
- %tmp192.ph.i = call zeroext i1 @check()
- br i1 %tmp192.ph.i, label %while.cond.outer.split.us.i, label %while.body.loopexit
-
-while.cond.outer.split.us.i:
- br label %while.cond.us.i
-
-while.cond.us.i:
- %cmp.us.i = call zeroext i1 @check()
- br i1 %cmp.us.i, label %next_data.exit, label %while.body.us.i
-
-while.body.us.i:
- %cmp7.us.i = call zeroext i1 @check()
- br i1 %cmp7.us.i, label %if.then.us.i, label %if.else.i
-
-if.then.us.i:
- br label %while.cond.us.i
-
-if.else.i:
- br label %while.cond.outer.i
-
-next_data.exit:
- %tmp192.ph.i.lcssa28 = call zeroext i1 @check()
- br i1 %tmp192.ph.i.lcssa28, label %while.end, label %while.body
-
-while.body.loopexit:
- br label %while.body
-
-while.body:
- br label %while.cond.i
-
-while.cond.i:
- %cmp.i = call zeroext i1 @check()
- br i1 %cmp.i, label %valid_data.exit, label %while.body.i
-
-while.body.i:
- %cmp7.i = call zeroext i1 @check()
- br i1 %cmp7.i, label %valid_data.exit, label %if.end.i
-
-if.end.i:
- br label %while.cond.i
-
-valid_data.exit:
- br i1 true, label %if.then, label %while.cond
-
-if.then:
- %cmp = call zeroext i1 @check()
- br i1 %cmp, label %if.then12, label %if.end
-
-if.then12:
- br label %if.end
-
-if.end:
- %tobool3.i = call zeroext i1 @check()
- br i1 %tobool3.i, label %copy_data.exit, label %while.body.lr.ph.i
-
-while.body.lr.ph.i:
- br label %copy_data.exit
-
-copy_data.exit:
- %cmp38 = call zeroext i1 @check()
- br i1 %cmp38, label %if.then39, label %while.cond.outer
-
-if.then39:
- %cmp5.i = call zeroext i1 @check()
- br i1 %cmp5.i, label %while.cond.outer.outer.backedge, label %for.cond8.preheader.i8.thread
-
-for.cond8.preheader.i8.thread:
- br label %while.cond.outer.outer.backedge
-
-while.cond.outer.outer.backedge:
- br label %while.cond.outer.outer
-
-while.end:
- ret void
-}
-
-; Remove a nested loop with irreducible control flow.
-; Ensure that only the middle loop is removed and rely on verify-loopinfo to
-; check soundness.
-;
-; CHECK-LABEL: @unloopIrreducible(
-; Irreducible loop.
-; CHECK: for.inc117:
-; CHECK: br label %for.cond103t
-; Nested loop (removed).
-; CHECK: for.inc159:
-; CHECK: br label %for.inc163
-define void @unloopIrreducible() nounwind {
-
-entry:
- br label %for.body
-
-for.body:
- %cmp2113 = call zeroext i1 @check()
- br i1 %cmp2113, label %for.body22.lr.ph, label %for.inc163
-
-for.body22.lr.ph:
- br label %for.body22
-
-for.body22:
- br label %for.body33
-
-for.body33:
- br label %for.end
-
-for.end:
- %cmp424 = call zeroext i1 @check()
- br i1 %cmp424, label %for.body43.lr.ph, label %for.end93
-
-for.body43.lr.ph:
- br label %for.end93
-
-for.end93:
- %cmp96 = call zeroext i1 @check()
- br i1 %cmp96, label %if.then97, label %for.cond103
-
-if.then97:
- br label %for.cond103t
-
-for.cond103t:
- br label %for.cond103
-
-for.cond103:
- %cmp105 = call zeroext i1 @check()
- br i1 %cmp105, label %for.body106, label %for.end120
-
-for.body106:
- %cmp108 = call zeroext i1 @check()
- br i1 %cmp108, label %if.then109, label %for.inc117
-
-if.then109:
- br label %for.inc117
-
-for.inc117:
- br label %for.cond103t
-
-for.end120:
- br label %for.inc159
-
-for.inc159:
- br i1 false, label %for.body22, label %for.cond15.for.inc163_crit_edge
-
-for.cond15.for.inc163_crit_edge:
- br label %for.inc163
-
-for.inc163:
- %cmp12 = call zeroext i1 @check()
- br i1 %cmp12, label %for.body, label %for.end166
-
-for.end166:
- ret void
-
-}
-
-; Remove a loop whose exit branches into a sibling loop.
-; Ensure that only the loop is removed and rely on verify-loopinfo to
-; check soundness.
-;
-; CHECK-LABEL: @unloopCriticalEdge(
-; CHECK: while.cond.outer.i.loopexit.split:
-; CHECK: br label %while.body
-; CHECK: while.body:
-; CHECK: br label %for.end78
-define void @unloopCriticalEdge() nounwind {
-entry:
- br label %for.cond31
-
-for.cond31:
- br i1 undef, label %for.body35, label %for.end94
-
-for.body35:
- br label %while.cond.i.preheader
-
-while.cond.i.preheader:
- br i1 undef, label %while.cond.i.preheader.split, label %while.cond.outer.i.loopexit.split
-
-while.cond.i.preheader.split:
- br label %while.cond.i
-
-while.cond.i:
- br i1 true, label %while.cond.i, label %while.cond.outer.i.loopexit
-
-while.cond.outer.i.loopexit:
- br label %while.cond.outer.i.loopexit.split
-
-while.cond.outer.i.loopexit.split:
- br i1 false, label %while.cond.i.preheader, label %Func2.exit
-
-Func2.exit:
- br label %while.body
-
-while.body:
- br i1 false, label %while.body, label %while.end
-
-while.end:
- br label %for.end78
-
-for.end78:
- br i1 undef, label %Proc2.exit, label %for.cond.i.preheader
-
-for.cond.i.preheader:
- br label %for.cond.i
-
-for.cond.i:
- br label %for.cond.i
-
-Proc2.exit:
- br label %for.cond31
-
-for.end94:
- ret void
-}
-
-; Test UnloopUpdater::removeBlocksFromAncestors.
-;
-; Check that the loop backedge is removed from the middle loop 1699,
-; but not the inner loop 1676.
-; CHECK: while.body1694:
-; CHECK: br label %while.cond1676
-; CHECK: while.end1699:
-; CHECK: br label %sw.default1711
-define void @removeSubloopBlocks() nounwind {
-entry:
- br label %tryagain.outer
-
-tryagain.outer: ; preds = %sw.bb304, %entry
- br label %tryagain
-
-tryagain: ; preds = %while.end1699, %tryagain.outer
- br i1 undef, label %sw.bb1669, label %sw.bb304
-
-sw.bb304: ; preds = %tryagain
- br i1 undef, label %return, label %tryagain.outer
-
-sw.bb1669: ; preds = %tryagain
- br i1 undef, label %sw.default1711, label %while.cond1676
-
-while.cond1676: ; preds = %while.body1694, %sw.bb1669
- br i1 undef, label %while.end1699, label %while.body1694
-
-while.body1694: ; preds = %while.cond1676
- br label %while.cond1676
-
-while.end1699: ; preds = %while.cond1676
- br i1 false, label %tryagain, label %sw.default1711
-
-sw.default1711: ; preds = %while.end1699, %sw.bb1669, %tryagain
- br label %defchar
-
-defchar: ; preds = %sw.default1711, %sw.bb376
- br i1 undef, label %if.end2413, label %if.then2368
-
-if.then2368: ; preds = %defchar
- unreachable
-
-if.end2413: ; preds = %defchar
- unreachable
-
-return: ; preds = %sw.bb304
- ret void
-}
-
-; PR11335: the most deeply nested block should be removed from the outer loop.
-; CHECK-LABEL: @removeSubloopBlocks2(
-; CHECK: for.cond3:
-; CHECK-NOT: br
-; CHECK: ret void
-define void @removeSubloopBlocks2() nounwind {
-entry:
- %tobool.i = icmp ne i32 undef, 0
- br label %lbl_616
-
-lbl_616.loopexit: ; preds = %for.cond
- br label %lbl_616
-
-lbl_616: ; preds = %lbl_616.loopexit, %entry
- br label %for.cond
-
-for.cond: ; preds = %for.cond3, %lbl_616
- br i1 false, label %for.cond1.preheader, label %lbl_616.loopexit
-
-for.cond1.preheader: ; preds = %for.cond
- br label %for.cond1
-
-for.cond1.loopexit: ; preds = %for.cond.i
- br label %for.cond1
-
-for.cond1: ; preds = %for.cond1.loopexit, %for.cond1.preheader
- br i1 false, label %for.body2, label %for.cond3
-
-for.body2: ; preds = %for.cond1
- br label %for.cond.i
-
-for.cond.i: ; preds = %for.cond.i, %for.body2
- br i1 %tobool.i, label %for.cond.i, label %for.cond1.loopexit
-
-for.cond3: ; preds = %for.cond1
- br i1 false, label %for.cond, label %if.end
-
-if.end: ; preds = %for.cond3
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/unroll-cleanup.ll b/llvm/test/Transforms/LoopUnroll/unroll-cleanup.ll
deleted file mode 100644
index 1e42203876e..00000000000
--- a/llvm/test/Transforms/LoopUnroll/unroll-cleanup.ll
+++ /dev/null
@@ -1,85 +0,0 @@
-; PR23524
-; The test is to check redundency produced by loop unroll pass
-; should be cleaned up by later pass.
-; RUN: opt < %s -O2 -S | FileCheck %s
-
-; After loop unroll:
-; %dec18 = add nsw i32 %dec18.in, -1
-; ...
-; %dec18.1 = add nsw i32 %dec18, -1
-; should be merged to:
-; %dec18.1 = add nsw i32 %dec18.in, -2
-;
-; CHECK-LABEL: @_Z3fn1v(
-; CHECK: %dec18.1 = add nsw i32 %dec18.in, -2
-
-; ModuleID = '<stdin>'
-target triple = "x86_64-unknown-linux-gnu"
-
-@b = global i32 0, align 4
-@c = global i32 0, align 4
-
-; Function Attrs: nounwind uwtable
-define void @_Z3fn1v() #0 {
-entry:
- %tmp = load i32, i32* @b, align 4
- %tobool20 = icmp eq i32 %tmp, 0
- br i1 %tobool20, label %for.end6, label %for.body.lr.ph
-
-for.body.lr.ph: ; preds = %entry
- br label %for.body
-
-for.cond1.for.cond.loopexit_crit_edge: ; preds = %for.inc
- %add.ptr.lcssa = phi i16* [ %add.ptr, %for.inc ]
- %incdec.ptr.lcssa = phi i8* [ %incdec.ptr, %for.inc ]
- br label %for.cond.loopexit
-
-for.cond.loopexit: ; preds = %for.body, %for.cond1.for.cond.loopexit_crit_edge
- %r.1.lcssa = phi i16* [ %add.ptr.lcssa, %for.cond1.for.cond.loopexit_crit_edge ], [ %r.022, %for.body ]
- %a.1.lcssa = phi i8* [ %incdec.ptr.lcssa, %for.cond1.for.cond.loopexit_crit_edge ], [ %a.021, %for.body ]
- %tmp1 = load i32, i32* @b, align 4
- %tobool = icmp eq i32 %tmp1, 0
- br i1 %tobool, label %for.cond.for.end6_crit_edge, label %for.body
-
-for.body: ; preds = %for.cond.loopexit, %for.body.lr.ph
- %r.022 = phi i16* [ undef, %for.body.lr.ph ], [ %r.1.lcssa, %for.cond.loopexit ]
- %a.021 = phi i8* [ undef, %for.body.lr.ph ], [ %a.1.lcssa, %for.cond.loopexit ]
- %tmp2 = load i32, i32* @c, align 4
- %tobool215 = icmp eq i32 %tmp2, 0
- br i1 %tobool215, label %for.cond.loopexit, label %for.body3.lr.ph
-
-for.body3.lr.ph: ; preds = %for.body
- br label %for.body3
-
-for.body3: ; preds = %for.inc, %for.body3.lr.ph
- %dec18.in = phi i32 [ %tmp2, %for.body3.lr.ph ], [ %dec18, %for.inc ]
- %r.117 = phi i16* [ %r.022, %for.body3.lr.ph ], [ %add.ptr, %for.inc ]
- %a.116 = phi i8* [ %a.021, %for.body3.lr.ph ], [ %incdec.ptr, %for.inc ]
- %dec18 = add nsw i32 %dec18.in, -1
- %tmp3 = load i8, i8* %a.116, align 1
- %cmp = icmp eq i8 %tmp3, 0
- br i1 %cmp, label %if.then, label %for.inc
-
-if.then: ; preds = %for.body3
- %arrayidx = getelementptr inbounds i16, i16* %r.117, i64 1
- store i16 0, i16* %arrayidx, align 2
- store i16 0, i16* %r.117, align 2
- %arrayidx5 = getelementptr inbounds i16, i16* %r.117, i64 2
- store i16 0, i16* %arrayidx5, align 2
- br label %for.inc
-
-for.inc: ; preds = %if.then, %for.body3
- %incdec.ptr = getelementptr inbounds i8, i8* %a.116, i64 1
- %add.ptr = getelementptr inbounds i16, i16* %r.117, i64 3
- %tobool2 = icmp eq i32 %dec18, 0
- br i1 %tobool2, label %for.cond1.for.cond.loopexit_crit_edge, label %for.body3, !llvm.loop !0
-
-for.cond.for.end6_crit_edge: ; preds = %for.cond.loopexit
- br label %for.end6
-
-for.end6: ; preds = %for.cond.for.end6_crit_edge, %entry
- ret void
-}
-
-!0 = !{!0, !1}
-!1 = !{!"llvm.loop.unroll.count", i32 2}
diff --git a/llvm/test/Transforms/LoopUnroll/unroll-cleanuppad.ll b/llvm/test/Transforms/LoopUnroll/unroll-cleanuppad.ll
deleted file mode 100644
index 67f3194f474..00000000000
--- a/llvm/test/Transforms/LoopUnroll/unroll-cleanuppad.ll
+++ /dev/null
@@ -1,40 +0,0 @@
-; RUN: opt -S -loop-unroll %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"
-
-define void @test1() personality i32 (...)* @__CxxFrameHandler3 {
-entry:
- br label %for.body
-
-for.body: ; preds = %entry, %for.inc
- %phi = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
- invoke void @callee(i32 %phi)
- to label %for.inc unwind label %ehcleanup
-
-for.inc: ; preds = %for.body
- %inc = add nuw nsw i32 %phi, 1
- %cmp = icmp slt i32 %inc, 3
- br i1 %cmp, label %for.body, label %for.cond.cleanup
-
-for.cond.cleanup: ; preds = %for.inc
- call void @dtor()
- ret void
-
-ehcleanup: ; preds = %for.body
- %cp = cleanuppad within none []
- call void @dtor() [ "funclet"(token %cp) ]
- cleanupret from %cp unwind to caller
-}
-
-; CHECK-LABEL: define void @test1(
-; CHECK: invoke void @callee(i32 0
-
-; CHECK: invoke void @callee(i32 1
-
-; CHECK: invoke void @callee(i32 2
-
-declare void @callee(i32)
-
-declare i32 @__CxxFrameHandler3(...)
-
-declare void @dtor()
diff --git a/llvm/test/Transforms/LoopUnroll/unroll-count.ll b/llvm/test/Transforms/LoopUnroll/unroll-count.ll
deleted file mode 100644
index f22c22bab0f..00000000000
--- a/llvm/test/Transforms/LoopUnroll/unroll-count.ll
+++ /dev/null
@@ -1,25 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-count=2 | FileCheck %s
-; Checks that "llvm.loop.unroll.disable" is set when
-; unroll with count set by user has been applied.
-;
-; CHECK-LABEL: @foo(
-; CHECK: llvm.loop.unroll.disable
-
-define void @foo(i32* nocapture %a) {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %arrayidx, align 4
- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, 64
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %for.body
- ret void
-}
-
diff --git a/llvm/test/Transforms/LoopUnroll/unroll-heuristics-pgo.ll b/llvm/test/Transforms/LoopUnroll/unroll-heuristics-pgo.ll
deleted file mode 100644
index 6778a52b3af..00000000000
--- a/llvm/test/Transforms/LoopUnroll/unroll-heuristics-pgo.ll
+++ /dev/null
@@ -1,59 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-runtime -unroll-threshold=40 -unroll-max-percent-threshold-boost=100 | FileCheck %s
-
-@known_constant = internal unnamed_addr constant [9 x i32] [i32 0, i32 -1, i32 0, i32 -1, i32 5, i32 -1, i32 0, i32 -1, i32 0], align 16
-
-; CHECK-LABEL: @bar_prof
-; CHECK: loop:
-; CHECK: %mul = mul
-; CHECK: %mul.1 = mul
-; CHECK: %mul.2 = mul
-; CHECK: %mul.3 = mul
-; CHECK: loop.epil:
-define i32 @bar_prof(i32* noalias nocapture readonly %src, i64 %c) !prof !1 {
-entry:
- br label %loop
-
-loop:
- %iv = phi i64 [ 0, %entry ], [ %inc, %loop ]
- %r = phi i32 [ 0, %entry ], [ %add, %loop ]
- %arrayidx = getelementptr inbounds i32, i32* %src, i64 %iv
- %src_element = load i32, i32* %arrayidx, align 4
- %array_const_idx = getelementptr inbounds [9 x i32], [9 x i32]* @known_constant, i64 0, i64 %iv
- %const_array_element = load i32, i32* %array_const_idx, align 4
- %mul = mul nsw i32 %src_element, %const_array_element
- %add = add nsw i32 %mul, %r
- %inc = add nuw nsw i64 %iv, 1
- %exitcond86.i = icmp eq i64 %inc, %c
- br i1 %exitcond86.i, label %loop.end, label %loop, !prof !2
-
-loop.end:
- %r.lcssa = phi i32 [ %r, %loop ]
- ret i32 %r.lcssa
-}
-
-; CHECK-LABEL: @bar_prof_flat
-; CHECK-NOT: loop.epil
-define i32 @bar_prof_flat(i32* noalias nocapture readonly %src, i64 %c) !prof !1 {
-entry:
- br label %loop
-
-loop:
- %iv = phi i64 [ 0, %entry ], [ %inc, %loop ]
- %r = phi i32 [ 0, %entry ], [ %add, %loop ]
- %arrayidx = getelementptr inbounds i32, i32* %src, i64 %iv
- %src_element = load i32, i32* %arrayidx, align 4
- %array_const_idx = getelementptr inbounds [9 x i32], [9 x i32]* @known_constant, i64 0, i64 %iv
- %const_array_element = load i32, i32* %array_const_idx, align 4
- %mul = mul nsw i32 %src_element, %const_array_element
- %add = add nsw i32 %mul, %r
- %inc = add nuw nsw i64 %iv, 1
- %exitcond86.i = icmp eq i64 %inc, %c
- br i1 %exitcond86.i, label %loop, label %loop.end, !prof !2
-
-loop.end:
- %r.lcssa = phi i32 [ %r, %loop ]
- ret i32 %r.lcssa
-}
-
-!1 = !{!"function_entry_count", i64 1}
-!2 = !{!"branch_weights", i32 1, i32 1000}
diff --git a/llvm/test/Transforms/LoopUnroll/unroll-loop-invalidation.ll b/llvm/test/Transforms/LoopUnroll/unroll-loop-invalidation.ll
deleted file mode 100644
index ea79d7164dc..00000000000
--- a/llvm/test/Transforms/LoopUnroll/unroll-loop-invalidation.ll
+++ /dev/null
@@ -1,107 +0,0 @@
-; This test exercises that we don't corrupt a loop-analysis when running loop
-; unrolling in a way that deletes a loop. To do that, we first ensure the
-; analysis is cached, then unroll the loop (deleting it) and make sure that the
-; next function doesn't get a cache "hit" for this stale analysis result.
-;
-; RUN: opt -S -passes='loop(require<access-info>),unroll,loop(print-access-info)' -debug-pass-manager < %s 2>&1 | FileCheck %s
-;
-; CHECK: Starting llvm::Function pass manager run.
-; CHECK: Running pass: FunctionToLoopPassAdaptor
-; CHECK: Running analysis: LoopAnalysis
-; CHECK: Running analysis: InnerAnalysisManagerProxy<
-; CHECK: Starting Loop pass manager run.
-; CHECK: Running pass: RequireAnalysisPass<{{.*}}LoopAccessAnalysis
-; CHECK: Running analysis: LoopAccessAnalysis on inner1.header
-; CHECK: Finished Loop pass manager run.
-; CHECK: Starting Loop pass manager run.
-; CHECK: Running pass: RequireAnalysisPass<{{.*}}LoopAccessAnalysis
-; CHECK: Running analysis: LoopAccessAnalysis on inner2.header
-; CHECK: Finished Loop pass manager run.
-; CHECK: Starting Loop pass manager run.
-; CHECK: Running pass: RequireAnalysisPass<{{.*}}LoopAccessAnalysis
-; CHECK: Running analysis: LoopAccessAnalysis on outer.header
-; CHECK: Finished Loop pass manager run.
-; CHECK: Running pass: LoopUnrollPass
-; CHECK: Clearing all analysis results for: inner2.header
-; CHECK: Clearing all analysis results for: outer.header
-; CHECK: Invalidating all non-preserved analyses for: test
-; CHECK: Invalidating all non-preserved analyses for: inner1.header
-; CHECK: Invalidating analysis: LoopAccessAnalysis on inner1.header
-; CHECK: Invalidating all non-preserved analyses for: inner1.header.1
-; CHECK-NOT: Invalidating analysis: LoopAccessAnalysis on inner1.header.1
-; CHECK: Running pass: FunctionToLoopPassAdaptor
-; CHECK: Starting Loop pass manager run.
-; CHECK: Running pass: LoopAccessInfoPrinterPass
-; CHECK: Running analysis: LoopAccessAnalysis on inner1.header
-; CHECK: Loop access info in function 'test':
-; CHECK: inner1.header:
-; CHECK: Finished Loop pass manager run.
-; CHECK: Starting Loop pass manager run.
-; CHECK: Running pass: LoopAccessInfoPrinterPass
-; CHECK: Running analysis: LoopAccessAnalysis on inner1.header.1
-; CHECK: Loop access info in function 'test':
-; CHECK: inner1.header.1:
-; CHECK: Finished Loop pass manager run.
-
-target triple = "x86_64-unknown-linux-gnu"
-
-define void @test(i32 %inner1.count) {
-; CHECK-LABEL: define void @test(
-bb:
- br label %outer.ph
-
-outer.ph:
- br label %outer.header
-
-outer.header:
- %outer.i = phi i32 [ 0, %outer.ph ], [ %outer.i.next, %outer.latch ]
- br label %inner1.ph
-
-inner1.ph:
- br label %inner1.header
-
-inner1.header:
- %inner1.i = phi i32 [ 0, %inner1.ph ], [ %inner1.i.next, %inner1.header ]
- %inner1.i.next = add i32 %inner1.i, 1
- %inner1.cond = icmp eq i32 %inner1.i, %inner1.count
- br i1 %inner1.cond, label %inner1.exit, label %inner1.header
-; We should have two unrolled copies of this loop and nothing else.
-;
-; CHECK-NOT: icmp eq
-; CHECK-NOT: br i1
-; CHECK: %[[COND1:.*]] = icmp eq i32 %{{.*}}, %inner1.count
-; CHECK: br i1 %[[COND1]],
-; CHECK-NOT: icmp eq
-; CHECK-NOT: br i1
-; CHECK: %[[COND2:.*]] = icmp eq i32 %{{.*}}, %inner1.count
-; CHECK: br i1 %[[COND2]],
-; CHECK-NOT: icmp eq
-; CHECK-NOT: br i1
-
-
-inner1.exit:
- br label %inner2.ph
-
-inner2.ph:
- br label %inner2.header
-
-inner2.header:
- %inner2.i = phi i32 [ 0, %inner2.ph ], [ %inner2.i.next, %inner2.header ]
- %inner2.i.next = add i32 %inner2.i, 1
- %inner2.cond = icmp eq i32 %inner2.i, 4
- br i1 %inner2.cond, label %inner2.exit, label %inner2.header
-
-inner2.exit:
- br label %outer.latch
-
-outer.latch:
- %outer.i.next = add i32 %outer.i, 1
- %outer.cond = icmp eq i32 %outer.i.next, 2
- br i1 %outer.cond, label %outer.exit, label %outer.header
-
-outer.exit:
- br label %exit
-
-exit:
- ret void
-}
diff --git a/llvm/test/Transforms/LoopUnroll/unroll-maxcount.ll b/llvm/test/Transforms/LoopUnroll/unroll-maxcount.ll
deleted file mode 100644
index 4cbd757aec2..00000000000
--- a/llvm/test/Transforms/LoopUnroll/unroll-maxcount.ll
+++ /dev/null
@@ -1,31 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-allow-partial -unroll-max-count=1 | FileCheck %s
-; Checks that unroll MaxCount is honored.
-;
-; CHECK-LABEL: @foo(
-; CHECK-LABEL: for.body:
-; CHECK-NEXT: phi
-; CHECK-NEXT: getelementptr
-; CHECK-NEXT: load
-; CHECK-NEXT: add
-; CHECK-NEXT: store
-; CHECK-NEXT: add
-; CHECK-NEXT: icmp
-; CHECK-NEXT: br
-define void @foo(i32* nocapture %a) {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %arrayidx, 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.end, label %for.body
-
-for.end: ; preds = %for.body
- ret void
-}
-
diff --git a/llvm/test/Transforms/LoopUnroll/unroll-opt-attribute.ll b/llvm/test/Transforms/LoopUnroll/unroll-opt-attribute.ll
deleted file mode 100644
index 2f0eb756fb6..00000000000
--- a/llvm/test/Transforms/LoopUnroll/unroll-opt-attribute.ll
+++ /dev/null
@@ -1,176 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-count=4 | FileCheck -check-prefix=CHECK_COUNT4 %s
-; RUN: opt < %s -S -loop-unroll | FileCheck -check-prefix=CHECK_NOCOUNT %s
-; RUN: opt < %s -S -passes='require<profile-summary>,function(unroll)' -pgso | FileCheck -check-prefix=PGSO %s
-; RUN: opt < %s -S -passes='require<profile-summary>,function(unroll)' -pgso=false | FileCheck -check-prefix=NPGSO %s
-
-
-;///////////////////// TEST 1 //////////////////////////////
-
-; This test shows that the loop is unrolled according to the specified
-; unroll factor.
-
-define void @Test1() nounwind {
-entry:
- br label %loop
-
-loop:
- %iv = phi i32 [ 0, %entry ], [ %inc, %loop ]
- %inc = add i32 %iv, 1
- %exitcnd = icmp uge i32 %inc, 1024
- br i1 %exitcnd, label %exit, label %loop
-
-exit:
- ret void
-}
-
-; CHECK_COUNT4-LABEL: @Test1
-; CHECK_COUNT4: phi
-; CHECK_COUNT4-NEXT: add
-; CHECK_COUNT4-NEXT: add
-; CHECK_COUNT4-NEXT: add
-; CHECK_COUNT4-NEXT: add
-; CHECK_COUNT4-NEXT: icmp
-
-
-;///////////////////// TEST 2 //////////////////////////////
-
-; This test shows that with optnone attribute, the loop is not unrolled
-; even if an unroll factor was specified.
-
-define void @Test2() nounwind optnone noinline {
-entry:
- br label %loop
-
-loop:
- %iv = phi i32 [ 0, %entry ], [ %inc, %loop ]
- %inc = add i32 %iv, 1
- %exitcnd = icmp uge i32 %inc, 1024
- br i1 %exitcnd, label %exit, label %loop
-
-exit:
- ret void
-}
-
-; CHECK_COUNT4-LABEL: @Test2
-; CHECK_COUNT4: phi
-; CHECK_COUNT4-NEXT: add
-; CHECK_COUNT4-NEXT: icmp
-
-
-;///////////////////// TEST 3 //////////////////////////////
-
-; This test shows that this loop is fully unrolled by default.
-
-@tab = common global [24 x i32] zeroinitializer, align 4
-
-define i32 @Test3() {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %i.05 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
- %arrayidx = getelementptr inbounds [24 x i32], [24 x i32]* @tab, i32 0, i32 %i.05
- store i32 %i.05, i32* %arrayidx, align 4
- %inc = add nuw nsw i32 %i.05, 1
- %exitcond = icmp eq i32 %inc, 24
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %for.body
- ret i32 42
-}
-
-; CHECK_NOCOUNT-LABEL: @Test3
-; CHECK_NOCOUNT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: store
-; CHECK_NOCOUNT-NEXT: ret
-
-
-;///////////////////// TEST 4 //////////////////////////////
-
-; This test shows that with optsize attribute, this loop is not unrolled.
-
-define i32 @Test4() optsize {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %i.05 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
- %arrayidx = getelementptr inbounds [24 x i32], [24 x i32]* @tab, i32 0, i32 %i.05
- store i32 %i.05, i32* %arrayidx, align 4
- %inc = add nuw nsw i32 %i.05, 1
- %exitcond = icmp eq i32 %inc, 24
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %for.body
- ret i32 42
-}
-
-; CHECK_NOCOUNT-LABEL: @Test4
-; CHECK_NOCOUNT: phi
-; CHECK_NOCOUNT: icmp
-
-;///////////////////// TEST 5 //////////////////////////////
-
-; This test shows that with PGO, this loop is cold and not unrolled.
-
-define i32 @Test5() !prof !14 {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %i.05 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
- %arrayidx = getelementptr inbounds [24 x i32], [24 x i32]* @tab, i32 0, i32 %i.05
- store i32 %i.05, i32* %arrayidx, align 4
- %inc = add nuw nsw i32 %i.05, 1
- %exitcond = icmp eq i32 %inc, 24
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %for.body
- ret i32 42
-}
-
-; PGSO-LABEL: @Test5
-; PGSO: phi
-; PGSO: icmp
-; NPGSO-LABEL: @Test5
-; NPGSO-NOT: phi
-; NPGSO-NOT: icmp
-
-!llvm.module.flags = !{!0}
-!0 = !{i32 1, !"ProfileSummary", !1}
-!1 = !{!2, !3, !4, !5, !6, !7, !8, !9}
-!2 = !{!"ProfileFormat", !"InstrProf"}
-!3 = !{!"TotalCount", i64 10000}
-!4 = !{!"MaxCount", i64 10}
-!5 = !{!"MaxInternalCount", i64 1}
-!6 = !{!"MaxFunctionCount", i64 1000}
-!7 = !{!"NumCounts", i64 3}
-!8 = !{!"NumFunctions", i64 3}
-!9 = !{!"DetailedSummary", !10}
-!10 = !{!11, !12, !13}
-!11 = !{i32 10000, i64 100, i32 1}
-!12 = !{i32 999000, i64 100, i32 1}
-!13 = !{i32 999999, i64 1, i32 2}
-!14 = !{!"function_entry_count", i64 0}
diff --git a/llvm/test/Transforms/LoopUnroll/unroll-pragmas-disabled.ll b/llvm/test/Transforms/LoopUnroll/unroll-pragmas-disabled.ll
deleted file mode 100644
index dc812fb4065..00000000000
--- a/llvm/test/Transforms/LoopUnroll/unroll-pragmas-disabled.ll
+++ /dev/null
@@ -1,149 +0,0 @@
-; RUN: opt < %s -loop-unroll -S | FileCheck %s
-;
-; Verify that the unrolling pass removes existing unroll count metadata
-; and adds a disable unrolling node after unrolling is complete.
-
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
-; #pragma clang loop vectorize(enable) unroll_count(4) vectorize_width(8)
-;
-; Unroll count metadata should be replaced with unroll(disable). Vectorize
-; metadata should be untouched.
-;
-; CHECK-LABEL: @unroll_count_4(
-; CHECK: br i1 {{.*}}, label {{.*}}, label {{.*}}, !llvm.loop ![[LOOP_1:.*]]
-define void @unroll_count_4(i32* nocapture %a) {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %arrayidx, align 4
- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, 64
- br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !1
-
-for.end: ; preds = %for.body
- ret void
-}
-!1 = !{!1, !2, !3, !4}
-!2 = !{!"llvm.loop.vectorize.enable", i1 true}
-!3 = !{!"llvm.loop.unroll.count", i32 4}
-!4 = !{!"llvm.loop.vectorize.width", i32 8}
-
-; #pragma clang loop unroll(full)
-;
-; An unroll disable metadata node is only added for the unroll count case.
-; In this case, the loop has a full unroll metadata but can't be fully unrolled
-; because the trip count is dynamic. The full unroll metadata should remain
-; after unrolling.
-;
-; CHECK-LABEL: @unroll_full(
-; CHECK: br i1 {{.*}}, label {{.*}}, label {{.*}}, !llvm.loop ![[LOOP_2:.*]]
-define void @unroll_full(i32* nocapture %a, i32 %b) {
-entry:
- %cmp3 = icmp sgt i32 %b, 0
- br i1 %cmp3, label %for.body, label %for.end, !llvm.loop !5
-
-for.body: ; preds = %entry, %for.body
- %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %arrayidx, 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, %b
- br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !5
-
-for.end: ; preds = %for.body, %entry
- ret void
-}
-!5 = !{!5, !6}
-!6 = !{!"llvm.loop.unroll.full"}
-
-; #pragma clang loop unroll(disable)
-;
-; Unroll metadata should not change.
-;
-; CHECK-LABEL: @unroll_disable(
-; CHECK: br i1 {{.*}}, label {{.*}}, label {{.*}}, !llvm.loop ![[LOOP_3:.*]]
-define void @unroll_disable(i32* nocapture %a) {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %arrayidx, align 4
- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, 64
- br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !7
-
-for.end: ; preds = %for.body
- ret void
-}
-!7 = !{!7, !8}
-!8 = !{!"llvm.loop.unroll.disable"}
-
-; This function contains two loops which share the same llvm.loop metadata node
-; with an llvm.loop.unroll.count 2 hint. Both loops should be unrolled. This
-; verifies that adding disable metadata to a loop after unrolling doesn't affect
-; other loops which previously shared the same llvm.loop metadata.
-;
-; CHECK-LABEL: @shared_metadata(
-; CHECK: store i32
-; CHECK: store i32
-; CHECK: br i1 {{.*}}, label {{.*}}, label {{.*}}, !llvm.loop ![[LOOP_4:.*]]
-; CHECK: store i32
-; CHECK: store i32
-; CHECK: br i1 {{.*}}, label {{.*}}, label {{.*}}, !llvm.loop ![[LOOP_5:.*]]
-define void @shared_metadata(i32* nocapture %List) #0 {
-entry:
- br label %for.body3
-
-for.body3: ; preds = %for.body3, %entry
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body3 ]
- %arrayidx = getelementptr inbounds i32, i32* %List, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %add4 = add nsw i32 %0, 10
- store i32 %add4, i32* %arrayidx, align 4
- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, 4
- br i1 %exitcond, label %for.body3.1.preheader, label %for.body3, !llvm.loop !9
-
-for.body3.1.preheader: ; preds = %for.body3
- br label %for.body3.1
-
-for.body3.1: ; preds = %for.body3.1.preheader, %for.body3.1
- %indvars.iv.1 = phi i64 [ %1, %for.body3.1 ], [ 0, %for.body3.1.preheader ]
- %1 = add nsw i64 %indvars.iv.1, 1
- %arrayidx.1 = getelementptr inbounds i32, i32* %List, i64 %1
- %2 = load i32, i32* %arrayidx.1, align 4
- %add4.1 = add nsw i32 %2, 10
- store i32 %add4.1, i32* %arrayidx.1, align 4
- %exitcond.1 = icmp eq i64 %1, 4
- br i1 %exitcond.1, label %for.inc5.1, label %for.body3.1, !llvm.loop !9
-
-for.inc5.1: ; preds = %for.body3.1
- ret void
-}
-!9 = !{!9, !10}
-!10 = !{!"llvm.loop.unroll.count", i32 2}
-
-
-; CHECK: ![[LOOP_1]] = distinct !{![[LOOP_1]], ![[VEC_ENABLE:.*]], ![[WIDTH_8:.*]], ![[UNROLL_DISABLE:.*]]}
-; CHECK: ![[VEC_ENABLE]] = !{!"llvm.loop.vectorize.enable", i1 true}
-; CHECK: ![[WIDTH_8]] = !{!"llvm.loop.vectorize.width", i32 8}
-; CHECK: ![[UNROLL_DISABLE]] = !{!"llvm.loop.unroll.disable"}
-; CHECK: ![[LOOP_2]] = distinct !{![[LOOP_2]], ![[UNROLL_FULL:.*]]}
-; CHECK: ![[UNROLL_FULL]] = !{!"llvm.loop.unroll.full"}
-; CHECK: ![[LOOP_3]] = distinct !{![[LOOP_3]], ![[UNROLL_DISABLE:.*]]}
-; CHECK: ![[LOOP_4]] = distinct !{![[LOOP_4]], ![[UNROLL_DISABLE:.*]]}
-; CHECK: ![[LOOP_5]] = distinct !{![[LOOP_5]], ![[UNROLL_DISABLE:.*]]}
diff --git a/llvm/test/Transforms/LoopUnroll/unroll-pragmas.ll b/llvm/test/Transforms/LoopUnroll/unroll-pragmas.ll
deleted file mode 100644
index afc70fbbe13..00000000000
--- a/llvm/test/Transforms/LoopUnroll/unroll-pragmas.ll
+++ /dev/null
@@ -1,372 +0,0 @@
-; RUN: opt < %s -loop-unroll -pragma-unroll-threshold=1024 -S | FileCheck -check-prefixes=CHECK,REM %s
-; RUN: opt < %s -loop-unroll -loop-unroll -pragma-unroll-threshold=1024 -S | FileCheck -check-prefixes=CHECK,REM %s
-; RUN: opt < %s -loop-unroll -unroll-allow-remainder=0 -pragma-unroll-threshold=1024 -S | FileCheck -check-prefixes=CHECK,NOREM %s
-;
-; Run loop unrolling twice to verify that loop unrolling metadata is properly
-; removed and further unrolling is disabled after the pass is run once.
-
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
-; loop4 contains a small loop which should be completely unrolled by
-; the default unrolling heuristics. It serves as a control for the
-; unroll(disable) pragma test loop4_with_disable.
-;
-; CHECK-LABEL: @loop4(
-; CHECK-NOT: br i1
-define void @loop4(i32* nocapture %a) {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %arrayidx, align 4
- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, 4
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %for.body
- ret void
-}
-
-; #pragma clang loop unroll(disable)
-;
-; CHECK-LABEL: @loop4_with_disable(
-; CHECK: store i32
-; CHECK-NOT: store i32
-; CHECK: br i1
-define void @loop4_with_disable(i32* nocapture %a) {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %arrayidx, align 4
- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, 4
- br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !1
-
-for.end: ; preds = %for.body
- ret void
-}
-!1 = !{!1, !2}
-!2 = !{!"llvm.loop.unroll.disable"}
-
-; loop64 has a high enough count that it should *not* be unrolled by
-; the default unrolling heuristic. It serves as the control for the
-; unroll(full) pragma test loop64_with_.* tests below.
-;
-; CHECK-LABEL: @loop64(
-; CHECK: store i32
-; CHECK-NOT: store i32
-; CHECK: br i1
-define void @loop64(i32* nocapture %a) {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %arrayidx, align 4
- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, 64
- br i1 %exitcond, label %for.end, label %for.body
-
-for.end: ; preds = %for.body
- ret void
-}
-
-; #pragma clang loop unroll(full)
-; Loop should be fully unrolled.
-;
-; CHECK-LABEL: @loop64_with_full(
-; CHECK-NOT: br i1
-define void @loop64_with_full(i32* nocapture %a) {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %arrayidx, align 4
- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, 64
- br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !3
-
-for.end: ; preds = %for.body
- ret void
-}
-!3 = !{!3, !4}
-!4 = !{!"llvm.loop.unroll.full"}
-
-; #pragma clang loop unroll_count(4)
-; Loop should be unrolled 4 times.
-;
-; CHECK-LABEL: @loop64_with_count4(
-; CHECK: store i32
-; CHECK: store i32
-; CHECK: store i32
-; CHECK: store i32
-; CHECK-NOT: store i32
-; CHECK: br i1
-define void @loop64_with_count4(i32* nocapture %a) {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %arrayidx, align 4
- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, 64
- br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !5
-
-for.end: ; preds = %for.body
- ret void
-}
-!5 = !{!5, !6}
-!6 = !{!"llvm.loop.unroll.count", i32 4}
-
-; #pragma clang loop unroll(full)
-; Full unrolling is requested, but loop has a runtime trip count so
-; no unrolling should occur.
-;
-; CHECK-LABEL: @runtime_loop_with_full(
-; CHECK: store i32
-; CHECK-NOT: store i32
-define void @runtime_loop_with_full(i32* nocapture %a, i32 %b) {
-entry:
- %cmp3 = icmp sgt i32 %b, 0
- br i1 %cmp3, label %for.body, label %for.end, !llvm.loop !8
-
-for.body: ; preds = %entry, %for.body
- %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %arrayidx, 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, %b
- br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !8
-
-for.end: ; preds = %for.body, %entry
- ret void
-}
-!8 = !{!8, !4}
-
-; #pragma clang loop unroll_count(4)
-; Loop has a runtime trip count. Runtime unrolling should occur and loop
-; should be duplicated (original and 4x unrolled) if remainder is allowed,
-; otherwise loop should not be unrolled.
-;
-; CHECK-LABEL: @runtime_loop_with_count4(
-; CHECK: for.body
-; CHECK: store
-; REM: store
-; REM: store
-; REM: store
-; CHECK-NOT: store
-; CHECK: br i1
-; REM: for.body.epil:
-; REM: store
-; NOREM-NOT: for.body.epil:
-; NOREM-NOT: store
-; CHECK-NOT: store
-; REM: br i1
-; NOREM-NOT: br i1
-define void @runtime_loop_with_count4(i32* nocapture %a, i32 %b) {
-entry:
- %cmp3 = icmp sgt i32 %b, 0
- br i1 %cmp3, label %for.body, label %for.end, !llvm.loop !9
-
-for.body: ; preds = %entry, %for.body
- %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %arrayidx, 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, %b
- br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !9
-
-for.end: ; preds = %for.body, %entry
- ret void
-}
-!9 = !{!9, !6}
-
-; #pragma clang loop unroll_count(1)
-; Loop should not be unrolled
-;
-; CHECK-LABEL: @unroll_1(
-; CHECK: store i32
-; CHECK-NOT: store i32
-; CHECK: br i1
-define void @unroll_1(i32* nocapture %a, i32 %b) {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %arrayidx, align 4
- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, 4
- br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !10
-
-for.end: ; preds = %for.body
- ret void
-}
-!10 = !{!10, !11}
-!11 = !{!"llvm.loop.unroll.count", i32 1}
-
-; #pragma clang loop unroll(full)
-; Loop has very high loop count (1 million) and full unrolling was requested.
-; Loop should unrolled up to the pragma threshold, but not completely.
-;
-; CHECK-LABEL: @unroll_1M(
-; CHECK: store i32
-; CHECK: store i32
-; CHECK: br i1
-define void @unroll_1M(i32* nocapture %a, i32 %b) {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %arrayidx, align 4
- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, 1000000
- br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !12
-
-for.end: ; preds = %for.body
- ret void
-}
-!12 = !{!12, !4}
-
-; #pragma clang loop unroll(enable)
-; Loop should be fully unrolled.
-;
-; CHECK-LABEL: @loop64_with_enable(
-; CHECK-NOT: br i1
-define void @loop64_with_enable(i32* nocapture %a) {
-entry:
- br label %for.body
-
-for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %arrayidx, align 4
- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, 64
- br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !13
-
-for.end: ; preds = %for.body
- ret void
-}
-!13 = !{!13, !14}
-!14 = !{!"llvm.loop.unroll.enable"}
-
-; #pragma clang loop unroll(enable)
-; Loop has a runtime trip count and should be runtime unrolled and duplicated
-; (original and 8x) if remainder is allowed, otherwise it should not be
-; unrolled.
-;
-; CHECK-LABEL: @runtime_loop_with_enable(
-; CHECK: for.body:
-; CHECK: store i32
-; REM: store i32
-; REM: store i32
-; REM: store i32
-; REM: store i32
-; REM: store i32
-; REM: store i32
-; REM: store i32
-; CHECK-NOT: store i32
-; CHECK: br i1
-; REM: for.body.epil:
-; NOREM-NOT: for.body.epil:
-; REM: store
-; CHECK-NOT: store
-; REM: br i1
-; NOREM-NOT: br i1
-define void @runtime_loop_with_enable(i32* nocapture %a, i32 %b) {
-entry:
- %cmp3 = icmp sgt i32 %b, 0
- br i1 %cmp3, label %for.body, label %for.end, !llvm.loop !8
-
-for.body: ; preds = %entry, %for.body
- %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %arrayidx, 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, %b
- br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !15
-
-for.end: ; preds = %for.body, %entry
- ret void
-}
-!15 = !{!15, !14}
-
-; #pragma clang loop unroll_count(3)
-; Loop has a runtime trip count. Runtime unrolling should occur and loop
-; should be duplicated (original and 3x unrolled) if remainder is allowed,
-; otherwise it should not be unrolled.
-;
-; CHECK-LABEL: @runtime_loop_with_count3(
-; CHECK: for.body
-; CHECK: store
-; REM: store
-; REM: store
-; CHECK-NOT: store
-; CHECK: br i1
-; REM: for.body.epil:
-; REM: store
-; NOREM-NOT: for.body.epil:
-; NOREM-NOT: store
-; CHECK-NOT: store
-; REM: br i1
-define void @runtime_loop_with_count3(i32* nocapture %a, i32 %b) {
-entry:
- %cmp3 = icmp sgt i32 %b, 0
- br i1 %cmp3, label %for.body, label %for.end, !llvm.loop !16
-
-for.body: ; preds = %entry, %for.body
- %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
- %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
- %0 = load i32, i32* %arrayidx, align 4
- %inc = add nsw i32 %0, 1
- store i32 %inc, i32* %arrayidx, 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, %b
- br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !16
-
-for.end: ; preds = %for.body, %entry
- ret void
-}
-!16 = !{!16, !17}
-!17 = !{!"llvm.loop.unroll.count", i32 3}
diff --git a/llvm/test/Transforms/LoopUnroll/update-loop-info-in-subloops.ll b/llvm/test/Transforms/LoopUnroll/update-loop-info-in-subloops.ll
deleted file mode 100644
index 4718e0500a6..00000000000
--- a/llvm/test/Transforms/LoopUnroll/update-loop-info-in-subloops.ll
+++ /dev/null
@@ -1,36 +0,0 @@
-; RUN: opt -S < %s -loop-unroll -block-freq | FileCheck %s
-; RUN: opt -S < %s -passes='require<opt-remark-emit>,unroll,require<block-freq>' | FileCheck %s
-; Crasher from PR20987.
-
-; CHECK: define void @update_loop_info_in_subloops
-; CHECK: entry:
-; CHECK: L:
-; CHECK: L.inner:
-; CHECK: L.inner.latch:
-; CHECK: L.latch:
-; CHECK: L.inner.1:
-; CHECK: L.inner.latch.1:
-; CHECK: L.latch.1:
-
-define void @update_loop_info_in_subloops() {
-entry:
- br label %L
-
-L:
- %0 = phi i64 [ 1, %entry ], [ %1, %L.latch ]
- br label %L.inner
-
-L.inner:
- br label %L.inner.latch
-
-L.inner.latch:
- br i1 false, label %L.latch, label %L.inner
-
-L.latch:
- %1 = add i64 %0, 1
- %2 = icmp eq i64 %1, 3
- br i1 %2, label %exit, label %L
-
-exit:
- ret void
-}
OpenPOWER on IntegriCloud