summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Analysis/ScalarEvolution/exact_iter_count.ll27
-rw-r--r--llvm/test/Analysis/ScalarEvolution/max-trip-count.ll2
-rw-r--r--llvm/test/Analysis/ScalarEvolution/trip-count14.ll4
-rw-r--r--llvm/test/Transforms/IndVarSimplify/loop_evaluate10.ll5
-rw-r--r--llvm/test/Transforms/LoopSimplify/preserve-scev.ll4
5 files changed, 32 insertions, 10 deletions
diff --git a/llvm/test/Analysis/ScalarEvolution/exact_iter_count.ll b/llvm/test/Analysis/ScalarEvolution/exact_iter_count.ll
new file mode 100644
index 00000000000..ba0bc1f4cf3
--- /dev/null
+++ b/llvm/test/Analysis/ScalarEvolution/exact_iter_count.ll
@@ -0,0 +1,27 @@
+; RUN: opt < %s -scalar-evolution -analyze | FileCheck %s
+
+; One side exit dominating the latch, exact backedge taken count is known.
+define void @test_01() {
+
+; CHECK-LABEL: Determining loop execution counts for: @test_01
+; CHECK-NEXT: Loop %loop: <multiple exits> backedge-taken count is 50
+
+entry:
+ br label %loop
+
+loop:
+ %iv = phi i32 [ 0, %entry ], [ %iv.next, %backedge ]
+ %side.cond = icmp slt i32 %iv, 50
+ br i1 %side.cond, label %backedge, label %side.exit
+
+backedge:
+ %iv.next = add i32 %iv, 1
+ %loop.cond = icmp slt i32 %iv, 100
+ br i1 %loop.cond, label %loop, label %exit
+
+exit:
+ ret void
+
+side.exit:
+ ret void
+}
diff --git a/llvm/test/Analysis/ScalarEvolution/max-trip-count.ll b/llvm/test/Analysis/ScalarEvolution/max-trip-count.ll
index 240ff8de6d6..53b882bdcbf 100644
--- a/llvm/test/Analysis/ScalarEvolution/max-trip-count.ll
+++ b/llvm/test/Analysis/ScalarEvolution/max-trip-count.ll
@@ -186,7 +186,7 @@ bar.exit: ; preds = %for.cond.i, %for.bo
; MaxBECount should be the minimum of them.
;
; CHECK-LABEL: @two_mustexit
-; CHECK: Loop %for.body.i: <multiple exits> Unpredictable backedge-taken count.
+; CHECK: Loop %for.body.i: <multiple exits> backedge-taken count is 1
; CHECK: Loop %for.body.i: max backedge-taken count is 1
define i32 @two_mustexit() {
entry:
diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count14.ll b/llvm/test/Analysis/ScalarEvolution/trip-count14.ll
index 0f935d74983..5e6cfe85101 100644
--- a/llvm/test/Analysis/ScalarEvolution/trip-count14.ll
+++ b/llvm/test/Analysis/ScalarEvolution/trip-count14.ll
@@ -81,7 +81,7 @@ if.end:
br i1 %cmp1, label %do.body, label %do.end ; taken either 0 or 2 times
; CHECK-LABEL: Determining loop execution counts for: @s32_max2_unpredictable_exit
-; CHECK-NEXT: Loop %do.body: <multiple exits> Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %do.body: <multiple exits> backedge-taken count is (-1 + (-1 * ((-1 + (-1 * ((2 + %n) smax %n)) + %n) umax (-1 + (-1 * %x) + %n))))
; CHECK-NEXT: Loop %do.body: max backedge-taken count is 2{{$}}
do.end:
@@ -169,7 +169,7 @@ if.end:
br i1 %cmp1, label %do.body, label %do.end ; taken either 0 or 2 times
; CHECK-LABEL: Determining loop execution counts for: @u32_max2_unpredictable_exit
-; CHECK-NEXT: Loop %do.body: <multiple exits> Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %do.body: <multiple exits> backedge-taken count is (-1 + (-1 * ((-1 + (-1 * ((2 + %n) umax %n)) + %n) umax (-1 + (-1 * %x) + %n))))
; CHECK-NEXT: Loop %do.body: max backedge-taken count is 2{{$}}
do.end:
diff --git a/llvm/test/Transforms/IndVarSimplify/loop_evaluate10.ll b/llvm/test/Transforms/IndVarSimplify/loop_evaluate10.ll
index 0739219fccd..3ac91060461 100644
--- a/llvm/test/Transforms/IndVarSimplify/loop_evaluate10.ll
+++ b/llvm/test/Transforms/IndVarSimplify/loop_evaluate10.ll
@@ -3,11 +3,6 @@
; This loop has multiple exits, and the value of %b1 depends on which
; exit is taken. Indvars should correctly compute the exit values.
;
-; XFAIL: *
-; Indvars does not currently replace loop invariant values unless all
-; loop exits have the same exit value. We could handle some cases,
-; such as this, by making getSCEVAtScope() sensitive to a particular
-; loop exit. See PR11388.
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
target triple = "x86_64-pc-linux-gnu"
diff --git a/llvm/test/Transforms/LoopSimplify/preserve-scev.ll b/llvm/test/Transforms/LoopSimplify/preserve-scev.ll
index fb15d84c8b4..2def885353b 100644
--- a/llvm/test/Transforms/LoopSimplify/preserve-scev.ll
+++ b/llvm/test/Transforms/LoopSimplify/preserve-scev.ll
@@ -91,9 +91,9 @@ declare void @foo() nounwind
; After simplifying, the max backedge count is refined.
; Second SCEV print:
; CHECK-LABEL: Determining loop execution counts for: @mergeExit
-; CHECK: Loop %while.cond191: <multiple exits> Unpredictable backedge-taken count.
+; CHECK: Loop %while.cond191: <multiple exits> backedge-taken count is 0
; CHECK: Loop %while.cond191: max backedge-taken count is 0
-; CHECK: Loop %while.cond191: Unpredictable predicated backedge-taken count.
+; CHECK: Loop %while.cond191: Predicated backedge-taken count is 0
; CHECK: Loop %while.cond191.outer: <multiple exits> Unpredictable backedge-taken count.
; CHECK: Loop %while.cond191.outer: Unpredictable max backedge-taken count.
; CHECK: Loop %while.cond191.outer: Unpredictable predicated backedge-taken count.
OpenPOWER on IntegriCloud