[llvm] d9426c3 - [Tests] Autogenerate a bunch of SCEV trip count tests for readability. Will likely merge some of these files soon.
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 21 10:46:27 PST 2019
Author: Philip Reames
Date: 2019-11-21T10:46:16-08:00
New Revision: d9426c3360895f265a19e25e2d2bae3348ad9ce8
URL: https://github.com/llvm/llvm-project/commit/d9426c3360895f265a19e25e2d2bae3348ad9ce8
DIFF: https://github.com/llvm/llvm-project/commit/d9426c3360895f265a19e25e2d2bae3348ad9ce8.diff
LOG: [Tests] Autogenerate a bunch of SCEV trip count tests for readability. Will likely merge some of these files soon.
Added:
Modified:
llvm/test/Analysis/ScalarEvolution/trip-count.ll
llvm/test/Analysis/ScalarEvolution/trip-count10.ll
llvm/test/Analysis/ScalarEvolution/trip-count2.ll
llvm/test/Analysis/ScalarEvolution/trip-count3.ll
llvm/test/Analysis/ScalarEvolution/trip-count4.ll
llvm/test/Analysis/ScalarEvolution/trip-count6.ll
llvm/test/Analysis/ScalarEvolution/trip-count7.ll
llvm/test/Analysis/ScalarEvolution/trip-count8.ll
llvm/test/Analysis/ScalarEvolution/trip-count9.ll
Removed:
################################################################################
diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count.ll b/llvm/test/Analysis/ScalarEvolution/trip-count.ll
index b5ff1c3d8a37..aef7f1b9bba5 100644
--- a/llvm/test/Analysis/ScalarEvolution/trip-count.ll
+++ b/llvm/test/Analysis/ScalarEvolution/trip-count.ll
@@ -1,43 +1,50 @@
-; RUN: opt < %s -analyze -scalar-evolution -scalar-evolution-max-iterations=0 | FileCheck %s
-; RUN: opt < %s -passes='print<scalar-evolution>' -disable-output 2>&1 | FileCheck %s
-; PR1101
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
+; RUN: opt < %s -analyze -scalar-evolution -scalar-evolution-max-iterations=0 -scalar-evolution-classify-expressions=0 | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
- at A = weak global [1000 x i32] zeroinitializer, align 32
-
-; CHECK-LABEL: Determining loop execution counts for: @test1
-; CHECK: backedge-taken count is 10000
-
-define void @test1(i32 %N) {
+ at A = weak global [1000 x i32] zeroinitializer, align 32
+
+define void @PR1101(i32 %N) {
+; CHECK-LABEL: 'PR1101'
+; CHECK-NEXT: Determining loop execution counts for: @PR1101
+; CHECK-NEXT: Loop %bb3: backedge-taken count is 10000
+; CHECK-NEXT: Loop %bb3: max backedge-taken count is 10000
+; CHECK-NEXT: Loop %bb3: Predicated backedge-taken count is 10000
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %bb3: Trip multiple is 10001
+;
entry:
- br label %bb3
+ br label %bb3
bb: ; preds = %bb3
- %tmp = getelementptr [1000 x i32], [1000 x i32]* @A, i32 0, i32 %i.0 ; <i32*> [#uses=1]
- store i32 123, i32* %tmp
- %tmp2 = add i32 %i.0, 1 ; <i32> [#uses=1]
- br label %bb3
+ %tmp = getelementptr [1000 x i32], [1000 x i32]* @A, i32 0, i32 %i.0 ; <i32*> [#uses=1]
+ store i32 123, i32* %tmp
+ %tmp2 = add i32 %i.0, 1 ; <i32> [#uses=1]
+ br label %bb3
bb3: ; preds = %bb, %entry
- %i.0 = phi i32 [ 0, %entry ], [ %tmp2, %bb ] ; <i32> [#uses=3]
- %tmp3 = icmp sle i32 %i.0, 9999 ; <i1> [#uses=1]
- br i1 %tmp3, label %bb, label %bb5
+ %i.0 = phi i32 [ 0, %entry ], [ %tmp2, %bb ] ; <i32> [#uses=3]
+ %tmp3 = icmp sle i32 %i.0, 9999 ; <i1> [#uses=1]
+ br i1 %tmp3, label %bb, label %bb5
bb5: ; preds = %bb3
- br label %return
+ br label %return
return: ; preds = %bb5
- ret void
+ ret void
}
-; PR22795
-; CHECK-LABEL: Classifying expressions for: @test2
-; CHECK: %iv = phi i32 [ -1, %entry ], [ %next.1, %for.inc.1 ]
-; CHECK-NEXT: --> {-1,+,2}<%preheader> U: full-set S: full-set Exits: 13
-
-define i32 @test2() {
+define i32 @PR22795() {
+; CHECK-LABEL: 'PR22795'
+; CHECK-NEXT: Determining loop execution counts for: @PR22795
+; CHECK-NEXT: Loop %preheader: backedge-taken count is 7
+; CHECK-NEXT: Loop %preheader: max backedge-taken count is 7
+; CHECK-NEXT: Loop %preheader: Predicated backedge-taken count is 7
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %preheader: Trip multiple is 8
+;
entry:
%bins = alloca [16 x i64], align 16
%0 = bitcast [16 x i64]* %bins to i8*
@@ -93,11 +100,14 @@ declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1) #0
declare void @may_exit() nounwind
define void @pr28012(i32 %n) {
-; CHECK-LABEL: Classifying expressions for: @pr28012
-; CHECK: Loop %loop: backedge-taken count is -1431655751
-; CHECK: Loop %loop: max backedge-taken count is -1431655751
-; CHECK: Loop %loop: Predicated backedge-taken count is -1431655751
-
+; CHECK-LABEL: 'pr28012'
+; CHECK-NEXT: Determining loop execution counts for: @pr28012
+; CHECK-NEXT: Loop %loop: backedge-taken count is -1431655751
+; CHECK-NEXT: Loop %loop: max backedge-taken count is -1431655751
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is -1431655751
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 2863311546
+;
entry:
br label %loop
diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count10.ll b/llvm/test/Analysis/ScalarEvolution/trip-count10.ll
index ead80b950409..5540e3e6a2da 100644
--- a/llvm/test/Analysis/ScalarEvolution/trip-count10.ll
+++ b/llvm/test/Analysis/ScalarEvolution/trip-count10.ll
@@ -1,24 +1,15 @@
-; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
+; RUN: opt < %s -analyze -scalar-evolution -scalar-evolution-classify-expressions=0 | FileCheck %s
; Trip counts with trivial exit conditions.
-; CHECK: Determining loop execution counts for: @a
-; CHECK: Loop %loop: Unpredictable backedge-taken count.
-; CHECK: Loop %loop: Unpredictable max backedge-taken count.
-
-; CHECK: Determining loop execution counts for: @b
-; CHECK: Loop %loop: backedge-taken count is false
-; CHECK: Loop %loop: max backedge-taken count is false
-
-; CHECK: Determining loop execution counts for: @c
-; CHECK: Loop %loop: backedge-taken count is false
-; CHECK: Loop %loop: max backedge-taken count is false
-
-; CHECK: Determining loop execution counts for: @d
-; CHECK: Loop %loop: Unpredictable backedge-taken count.
-; CHECK: Loop %loop: Unpredictable max backedge-taken count.
-
define void @a(i64 %n) nounwind {
+; CHECK-LABEL: 'a'
+; CHECK-NEXT: Determining loop execution counts for: @a
+; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable max backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
+;
entry:
%t0 = icmp sgt i64 %n, 0
br i1 %t0, label %loop, label %return
@@ -33,6 +24,14 @@ return:
ret void
}
define void @b(i64 %n) nounwind {
+; CHECK-LABEL: 'b'
+; CHECK-NEXT: Determining loop execution counts for: @b
+; CHECK-NEXT: Loop %loop: backedge-taken count is false
+; CHECK-NEXT: Loop %loop: max backedge-taken count is false
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is false
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 1
+;
entry:
%t0 = icmp sgt i64 %n, 0
br i1 %t0, label %loop, label %return
@@ -47,6 +46,14 @@ return:
ret void
}
define void @c(i64 %n) nounwind {
+; CHECK-LABEL: 'c'
+; CHECK-NEXT: Determining loop execution counts for: @c
+; CHECK-NEXT: Loop %loop: backedge-taken count is false
+; CHECK-NEXT: Loop %loop: max backedge-taken count is false
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is false
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 1
+;
entry:
%t0 = icmp sgt i64 %n, 0
br i1 %t0, label %loop, label %return
@@ -61,6 +68,12 @@ return:
ret void
}
define void @d(i64 %n) nounwind {
+; CHECK-LABEL: 'd'
+; CHECK-NEXT: Determining loop execution counts for: @d
+; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable max backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
+;
entry:
%t0 = icmp sgt i64 %n, 0
br i1 %t0, label %loop, label %return
@@ -80,13 +93,15 @@ return:
; should return unknown.
; PR7416
-; CHECK: Determining loop execution counts for: @nonpolynomial
-; CHECK-NEXT: Loop %loophead: Unpredictable backedge-taken count
-; CHECK-NEXT: Loop %loophead: Unpredictable max backedge-taken count
-
declare i1 @g() nounwind
define void @nonpolynomial() {
+; CHECK-LABEL: 'nonpolynomial'
+; CHECK-NEXT: Determining loop execution counts for: @nonpolynomial
+; CHECK-NEXT: Loop %loophead: Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %loophead: Unpredictable max backedge-taken count.
+; CHECK-NEXT: Loop %loophead: Unpredictable predicated backedge-taken count.
+;
entry:
br label %loophead
loophead:
@@ -108,11 +123,15 @@ retbb:
; PHI nodes with all constant operands.
-; CHECK: Determining loop execution counts for: @constant_phi_operands
-; CHECK: Loop %loop: backedge-taken count is 1
-; CHECK: Loop %loop: max backedge-taken count is 1
-
define void @constant_phi_operands() nounwind {
+; CHECK-LABEL: 'constant_phi_operands'
+; CHECK-NEXT: Determining loop execution counts for: @constant_phi_operands
+; CHECK-NEXT: Loop %loop: backedge-taken count is 1
+; CHECK-NEXT: Loop %loop: max backedge-taken count is 1
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is 1
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 2
+;
entry:
br label %loop
@@ -129,10 +148,13 @@ return:
; One side of the expression test against a value that will be skipped.
; We can't assume undefined behavior just because we have an NSW flag.
;
-; CHECK: Determining loop execution counts for: @exit_orcond_nsw
-; CHECK: Loop %for.body.i: Unpredictable backedge-taken count.
-; CHECK: Loop %for.body.i: max backedge-taken count is 1
define void @exit_orcond_nsw(i32 *%a) nounwind {
+; CHECK-LABEL: 'exit_orcond_nsw'
+; CHECK-NEXT: Determining loop execution counts for: @exit_orcond_nsw
+; CHECK-NEXT: Loop %for.body.i: Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %for.body.i: max backedge-taken count is 1
+; CHECK-NEXT: Loop %for.body.i: Unpredictable predicated backedge-taken count.
+;
entry:
br label %for.body.i
diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count2.ll b/llvm/test/Analysis/ScalarEvolution/trip-count2.ll
index d988eff7cfa1..7f4552723860 100644
--- a/llvm/test/Analysis/ScalarEvolution/trip-count2.ll
+++ b/llvm/test/Analysis/ScalarEvolution/trip-count2.ll
@@ -1,34 +1,40 @@
-; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
-; PR1101
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
+; RUN: opt < %s -analyze -scalar-evolution -scalar-evolution-classify-expressions=0 | FileCheck %s
- at A = weak global [1000 x i32] zeroinitializer, align 32
+ at A = weak global [1000 x i32] zeroinitializer, align 32
-; CHECK: backedge-taken count is 4
-
-define void @test(i32 %N) {
+define void @PR1101(i32 %N) {
+; CHECK-LABEL: 'PR1101'
+; CHECK-NEXT: Determining loop execution counts for: @PR1101
+; CHECK-NEXT: Loop %bb3: backedge-taken count is 4
+; CHECK-NEXT: Loop %bb3: max backedge-taken count is 4
+; CHECK-NEXT: Loop %bb3: Predicated backedge-taken count is 4
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %bb3: Trip multiple is 5
+;
entry:
- br label %bb3
+ br label %bb3
bb: ; preds = %bb3
- %tmp = getelementptr [1000 x i32], [1000 x i32]* @A, i32 0, i32 %i.0 ; <i32*> [#uses=1]
- store i32 123, i32* %tmp
- %tmp4 = mul i32 %i.0, 4 ; <i32> [#uses=1]
- %tmp5 = or i32 %tmp4, 1
- %tmp61 = xor i32 %tmp5, -2147483648
- %tmp6 = trunc i32 %tmp61 to i16
- %tmp71 = shl i16 %tmp6, 2
- %tmp7 = zext i16 %tmp71 to i32
- %tmp2 = add i32 %tmp7, %i.0
- br label %bb3
+ %tmp = getelementptr [1000 x i32], [1000 x i32]* @A, i32 0, i32 %i.0 ; <i32*> [#uses=1]
+ store i32 123, i32* %tmp
+ %tmp4 = mul i32 %i.0, 4 ; <i32> [#uses=1]
+ %tmp5 = or i32 %tmp4, 1
+ %tmp61 = xor i32 %tmp5, -2147483648
+ %tmp6 = trunc i32 %tmp61 to i16
+ %tmp71 = shl i16 %tmp6, 2
+ %tmp7 = zext i16 %tmp71 to i32
+ %tmp2 = add i32 %tmp7, %i.0
+ br label %bb3
bb3: ; preds = %bb, %entry
- %i.0 = phi i32 [ 0, %entry ], [ %tmp2, %bb ] ; <i32> [#uses=3]
- %tmp3 = icmp sle i32 %i.0, 9999 ; <i1> [#uses=1]
- br i1 %tmp3, label %bb, label %bb5
+ %i.0 = phi i32 [ 0, %entry ], [ %tmp2, %bb ] ; <i32> [#uses=3]
+ %tmp3 = icmp sle i32 %i.0, 9999 ; <i1> [#uses=1]
+ br i1 %tmp3, label %bb, label %bb5
bb5: ; preds = %bb3
- br label %return
+ br label %return
return: ; preds = %bb5
- ret void
+ ret void
}
diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count3.ll b/llvm/test/Analysis/ScalarEvolution/trip-count3.ll
index e10012c0c32d..a50886be325f 100644
--- a/llvm/test/Analysis/ScalarEvolution/trip-count3.ll
+++ b/llvm/test/Analysis/ScalarEvolution/trip-count3.ll
@@ -1,12 +1,10 @@
-; RUN: opt < %s -scalar-evolution -analyze | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
+; RUN: opt < %s -scalar-evolution -analyze -scalar-evolution-classify-expressions=0 | FileCheck %s
; ScalarEvolution can't compute a trip count because it doesn't know if
; dividing by the stride will have a remainder. This could theoretically
; be teaching it how to use a more elaborate trip count computation.
-; CHECK: Loop %bb3.i: backedge-taken count is ((63 + (-1 * (63 smin %0)) + %0) /u 64)
-; CHECK: Loop %bb3.i: max backedge-taken count is 33554431
-
%struct.FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct.FILE*, i32, i32, i64, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i64, i32, [20 x i8] }
%struct.SHA_INFO = type { [5 x i32], i32, i32, [16 x i32] }
%struct._IO_marker = type { %struct._IO_marker*, %struct.FILE*, i32 }
@@ -39,6 +37,14 @@ declare i32 @fclose(%struct.FILE* nocapture) nounwind
declare void @sha_stream(%struct.SHA_INFO* nocapture, %struct.FILE* nocapture) nounwind
define void @sha_stream_bb3_2E_i(%struct.SHA_INFO* %sha_info, i8* %data1, i32, i8** %buffer_addr.0.i.out, i32* %count_addr.0.i.out) nounwind {
+; CHECK-LABEL: 'sha_stream_bb3_2E_i'
+; CHECK-NEXT: Determining loop execution counts for: @sha_stream_bb3_2E_i
+; CHECK-NEXT: Loop %bb3.i: backedge-taken count is ((63 + (-1 * (63 smin %0)) + %0) /u 64)
+; CHECK-NEXT: Loop %bb3.i: max backedge-taken count is 33554431
+; CHECK-NEXT: Loop %bb3.i: Predicated backedge-taken count is ((63 + (-1 * (63 smin %0)) + %0) /u 64)
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %bb3.i: Trip multiple is 1
+;
newFuncRoot:
br label %bb3.i
diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count4.ll b/llvm/test/Analysis/ScalarEvolution/trip-count4.ll
index 966ffd26fd28..4c2d079e1922 100644
--- a/llvm/test/Analysis/ScalarEvolution/trip-count4.ll
+++ b/llvm/test/Analysis/ScalarEvolution/trip-count4.ll
@@ -1,25 +1,32 @@
-; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
+; RUN: opt < %s -analyze -scalar-evolution -scalar-evolution-classify-expressions=0 | FileCheck %s
; ScalarEvolution should be able to compute a loop exit value for %indvar.i8.
-; CHECK: sext{{.*}}trunc{{.*}}Exits: 11
-
define void @another_count_down_signed(double* %d, i64 %n) nounwind {
+; CHECK-LABEL: 'another_count_down_signed'
+; CHECK-NEXT: Determining loop execution counts for: @another_count_down_signed
+; CHECK-NEXT: Loop %loop: backedge-taken count is (-11 + %n)
+; CHECK-NEXT: Loop %loop: max backedge-taken count is -1
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-11 + %n)
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 1
+;
entry:
- br label %loop
+ br label %loop
loop: ; preds = %loop, %entry
- %indvar = phi i64 [ %n, %entry ], [ %indvar.next, %loop ] ; <i64> [#uses=4]
- %s0 = shl i64 %indvar, 8 ; <i64> [#uses=1]
- %indvar.i8 = ashr i64 %s0, 8 ; <i64> [#uses=1]
- %t0 = getelementptr double, double* %d, i64 %indvar.i8 ; <double*> [#uses=2]
- %t1 = load double, double* %t0 ; <double> [#uses=1]
- %t2 = fmul double %t1, 1.000000e-01 ; <double> [#uses=1]
- store double %t2, double* %t0
- %indvar.next = sub i64 %indvar, 1 ; <i64> [#uses=2]
- %exitcond = icmp eq i64 %indvar.next, 10 ; <i1> [#uses=1]
- br i1 %exitcond, label %return, label %loop
+ %indvar = phi i64 [ %n, %entry ], [ %indvar.next, %loop ] ; <i64> [#uses=4]
+ %s0 = shl i64 %indvar, 8 ; <i64> [#uses=1]
+ %indvar.i8 = ashr i64 %s0, 8 ; <i64> [#uses=1]
+ %t0 = getelementptr double, double* %d, i64 %indvar.i8 ; <double*> [#uses=2]
+ %t1 = load double, double* %t0 ; <double> [#uses=1]
+ %t2 = fmul double %t1, 1.000000e-01 ; <double> [#uses=1]
+ store double %t2, double* %t0
+ %indvar.next = sub i64 %indvar, 1 ; <i64> [#uses=2]
+ %exitcond = icmp eq i64 %indvar.next, 10 ; <i1> [#uses=1]
+ br i1 %exitcond, label %return, label %loop
return: ; preds = %loop
- ret void
+ ret void
}
diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count6.ll b/llvm/test/Analysis/ScalarEvolution/trip-count6.ll
index 7980bbdcb121..103b097e09b1 100644
--- a/llvm/test/Analysis/ScalarEvolution/trip-count6.ll
+++ b/llvm/test/Analysis/ScalarEvolution/trip-count6.ll
@@ -1,10 +1,17 @@
-; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
+; RUN: opt < %s -analyze -scalar-evolution -scalar-evolution-classify-expressions=0 | FileCheck %s
@mode_table = global [4 x i32] zeroinitializer ; <[4 x i32]*> [#uses=1]
-; CHECK: max backedge-taken count is 1{{$}}
-
define i8 @f() {
+; CHECK-LABEL: 'f'
+; CHECK-NEXT: Determining loop execution counts for: @f
+; CHECK-NEXT: Loop %bb: <multiple exits> Unpredictable backedge-taken count.
+; CHECK-NEXT: exit count for bb: ***COULDNOTCOMPUTE***
+; CHECK-NEXT: exit count for bb2: 1
+; CHECK-NEXT: Loop %bb: max backedge-taken count is 1
+; CHECK-NEXT: Loop %bb: Unpredictable predicated backedge-taken count.
+;
entry:
tail call i32 @fegetround( ) ; <i32>:0 [#uses=1]
br label %bb
@@ -29,10 +36,10 @@ bb4: ; preds = %bb2
br label %bb
bb5: ; preds = %bb2
- tail call void @raise_exception( ) noreturn
+ tail call void @raise_exception( ) noreturn
unreachable
}
declare i32 @fegetround()
-declare void @raise_exception() noreturn
+declare void @raise_exception() noreturn
diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count7.ll b/llvm/test/Analysis/ScalarEvolution/trip-count7.ll
index bbe76c490cdd..8b92bf71c041 100644
--- a/llvm/test/Analysis/ScalarEvolution/trip-count7.ll
+++ b/llvm/test/Analysis/ScalarEvolution/trip-count7.ll
@@ -1,9 +1,8 @@
-; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
+; RUN: opt < %s -analyze -scalar-evolution -scalar-evolution-classify-expressions=0 | 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"
-; CHECK: Loop %bb7.i: Unpredictable backedge-taken count.
-
%struct.complex = type { float, float }
%struct.element = type { i32, i32 }
%struct.node = type { %struct.node*, %struct.node*, i32 }
@@ -62,90 +61,96 @@ declare void @Doit() nounwind
declare void @Doit_bb7([15 x i32]*, [17 x i32]*, [9 x i32]*) nounwind
define void @Doit_bb7_2E_i([9 x i32]* %x1, [15 x i32]* %c, [17 x i32]* %b, [9 x i32]* %a, i32* %q, i32* %x1.sub, i32* %b9, i32* %a10, i32* %c11) nounwind {
+; CHECK-LABEL: 'Doit_bb7_2E_i'
+; CHECK-NEXT: Determining loop execution counts for: @Doit_bb7_2E_i
+; CHECK-NEXT: Loop %bb7.i: Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %bb7.i: max backedge-taken count is 8
+; CHECK-NEXT: Loop %bb7.i: Unpredictable predicated backedge-taken count.
+;
newFuncRoot:
- br label %bb7.i
+ br label %bb7.i
Try.exit.exitStub: ; preds = %bb7.i
- ret void
+ ret void
bb.i: ; preds = %bb7.i
- %tmp = add i32 %j.0.i, 1 ; <i32> [#uses=5]
- store i32 0, i32* %q, align 4
- %tmp1 = sext i32 %tmp to i64 ; <i64> [#uses=1]
- %tmp2 = getelementptr [9 x i32], [9 x i32]* %a, i64 0, i64 %tmp1 ; <i32*> [#uses=1]
- %tmp3 = load i32, i32* %tmp2, align 4 ; <i32> [#uses=1]
- %tmp4 = icmp eq i32 %tmp3, 0 ; <i1> [#uses=1]
- br i1 %tmp4, label %bb.i.bb7.i.backedge_crit_edge, label %bb1.i
+ %tmp = add i32 %j.0.i, 1 ; <i32> [#uses=5]
+ store i32 0, i32* %q, align 4
+ %tmp1 = sext i32 %tmp to i64 ; <i64> [#uses=1]
+ %tmp2 = getelementptr [9 x i32], [9 x i32]* %a, i64 0, i64 %tmp1 ; <i32*> [#uses=1]
+ %tmp3 = load i32, i32* %tmp2, align 4 ; <i32> [#uses=1]
+ %tmp4 = icmp eq i32 %tmp3, 0 ; <i1> [#uses=1]
+ br i1 %tmp4, label %bb.i.bb7.i.backedge_crit_edge, label %bb1.i
bb1.i: ; preds = %bb.i
- %tmp5 = add i32 %j.0.i, 2 ; <i32> [#uses=1]
- %tmp6 = sext i32 %tmp5 to i64 ; <i64> [#uses=1]
- %tmp7 = getelementptr [17 x i32], [17 x i32]* %b, i64 0, i64 %tmp6 ; <i32*> [#uses=1]
- %tmp8 = load i32, i32* %tmp7, align 4 ; <i32> [#uses=1]
- %tmp9 = icmp eq i32 %tmp8, 0 ; <i1> [#uses=1]
- br i1 %tmp9, label %bb1.i.bb7.i.backedge_crit_edge, label %bb2.i
+ %tmp5 = add i32 %j.0.i, 2 ; <i32> [#uses=1]
+ %tmp6 = sext i32 %tmp5 to i64 ; <i64> [#uses=1]
+ %tmp7 = getelementptr [17 x i32], [17 x i32]* %b, i64 0, i64 %tmp6 ; <i32*> [#uses=1]
+ %tmp8 = load i32, i32* %tmp7, align 4 ; <i32> [#uses=1]
+ %tmp9 = icmp eq i32 %tmp8, 0 ; <i1> [#uses=1]
+ br i1 %tmp9, label %bb1.i.bb7.i.backedge_crit_edge, label %bb2.i
bb2.i: ; preds = %bb1.i
- %tmp10 = sub i32 7, %j.0.i ; <i32> [#uses=1]
- %tmp11 = sext i32 %tmp10 to i64 ; <i64> [#uses=1]
- %tmp12 = getelementptr [15 x i32], [15 x i32]* %c, i64 0, i64 %tmp11 ; <i32*> [#uses=1]
- %tmp13 = load i32, i32* %tmp12, align 4 ; <i32> [#uses=1]
- %tmp14 = icmp eq i32 %tmp13, 0 ; <i1> [#uses=1]
- br i1 %tmp14, label %bb2.i.bb7.i.backedge_crit_edge, label %bb3.i
+ %tmp10 = sub i32 7, %j.0.i ; <i32> [#uses=1]
+ %tmp11 = sext i32 %tmp10 to i64 ; <i64> [#uses=1]
+ %tmp12 = getelementptr [15 x i32], [15 x i32]* %c, i64 0, i64 %tmp11 ; <i32*> [#uses=1]
+ %tmp13 = load i32, i32* %tmp12, align 4 ; <i32> [#uses=1]
+ %tmp14 = icmp eq i32 %tmp13, 0 ; <i1> [#uses=1]
+ br i1 %tmp14, label %bb2.i.bb7.i.backedge_crit_edge, label %bb3.i
bb3.i: ; preds = %bb2.i
- %tmp15 = getelementptr [9 x i32], [9 x i32]* %x1, i64 0, i64 1 ; <i32*> [#uses=1]
- store i32 %tmp, i32* %tmp15, align 4
- %tmp16 = sext i32 %tmp to i64 ; <i64> [#uses=1]
- %tmp17 = getelementptr [9 x i32], [9 x i32]* %a, i64 0, i64 %tmp16 ; <i32*> [#uses=1]
- store i32 0, i32* %tmp17, align 4
- %tmp18 = add i32 %j.0.i, 2 ; <i32> [#uses=1]
- %tmp19 = sext i32 %tmp18 to i64 ; <i64> [#uses=1]
- %tmp20 = getelementptr [17 x i32], [17 x i32]* %b, i64 0, i64 %tmp19 ; <i32*> [#uses=1]
- store i32 0, i32* %tmp20, align 4
- %tmp21 = sub i32 7, %j.0.i ; <i32> [#uses=1]
- %tmp22 = sext i32 %tmp21 to i64 ; <i64> [#uses=1]
- %tmp23 = getelementptr [15 x i32], [15 x i32]* %c, i64 0, i64 %tmp22 ; <i32*> [#uses=1]
- store i32 0, i32* %tmp23, align 4
- call void @Try(i32 2, i32* %q, i32* %b9, i32* %a10, i32* %c11, i32* %x1.sub) nounwind
- %tmp24 = load i32, i32* %q, align 4 ; <i32> [#uses=1]
- %tmp25 = icmp eq i32 %tmp24, 0 ; <i1> [#uses=1]
- br i1 %tmp25, label %bb5.i, label %bb3.i.bb7.i.backedge_crit_edge
+ %tmp15 = getelementptr [9 x i32], [9 x i32]* %x1, i64 0, i64 1 ; <i32*> [#uses=1]
+ store i32 %tmp, i32* %tmp15, align 4
+ %tmp16 = sext i32 %tmp to i64 ; <i64> [#uses=1]
+ %tmp17 = getelementptr [9 x i32], [9 x i32]* %a, i64 0, i64 %tmp16 ; <i32*> [#uses=1]
+ store i32 0, i32* %tmp17, align 4
+ %tmp18 = add i32 %j.0.i, 2 ; <i32> [#uses=1]
+ %tmp19 = sext i32 %tmp18 to i64 ; <i64> [#uses=1]
+ %tmp20 = getelementptr [17 x i32], [17 x i32]* %b, i64 0, i64 %tmp19 ; <i32*> [#uses=1]
+ store i32 0, i32* %tmp20, align 4
+ %tmp21 = sub i32 7, %j.0.i ; <i32> [#uses=1]
+ %tmp22 = sext i32 %tmp21 to i64 ; <i64> [#uses=1]
+ %tmp23 = getelementptr [15 x i32], [15 x i32]* %c, i64 0, i64 %tmp22 ; <i32*> [#uses=1]
+ store i32 0, i32* %tmp23, align 4
+ call void @Try(i32 2, i32* %q, i32* %b9, i32* %a10, i32* %c11, i32* %x1.sub) nounwind
+ %tmp24 = load i32, i32* %q, align 4 ; <i32> [#uses=1]
+ %tmp25 = icmp eq i32 %tmp24, 0 ; <i1> [#uses=1]
+ br i1 %tmp25, label %bb5.i, label %bb3.i.bb7.i.backedge_crit_edge
bb5.i: ; preds = %bb3.i
- %tmp26 = sext i32 %tmp to i64 ; <i64> [#uses=1]
- %tmp27 = getelementptr [9 x i32], [9 x i32]* %a, i64 0, i64 %tmp26 ; <i32*> [#uses=1]
- store i32 1, i32* %tmp27, align 4
- %tmp28 = add i32 %j.0.i, 2 ; <i32> [#uses=1]
- %tmp29 = sext i32 %tmp28 to i64 ; <i64> [#uses=1]
- %tmp30 = getelementptr [17 x i32], [17 x i32]* %b, i64 0, i64 %tmp29 ; <i32*> [#uses=1]
- store i32 1, i32* %tmp30, align 4
- %tmp31 = sub i32 7, %j.0.i ; <i32> [#uses=1]
- %tmp32 = sext i32 %tmp31 to i64 ; <i64> [#uses=1]
- %tmp33 = getelementptr [15 x i32], [15 x i32]* %c, i64 0, i64 %tmp32 ; <i32*> [#uses=1]
- store i32 1, i32* %tmp33, align 4
- br label %bb7.i.backedge
+ %tmp26 = sext i32 %tmp to i64 ; <i64> [#uses=1]
+ %tmp27 = getelementptr [9 x i32], [9 x i32]* %a, i64 0, i64 %tmp26 ; <i32*> [#uses=1]
+ store i32 1, i32* %tmp27, align 4
+ %tmp28 = add i32 %j.0.i, 2 ; <i32> [#uses=1]
+ %tmp29 = sext i32 %tmp28 to i64 ; <i64> [#uses=1]
+ %tmp30 = getelementptr [17 x i32], [17 x i32]* %b, i64 0, i64 %tmp29 ; <i32*> [#uses=1]
+ store i32 1, i32* %tmp30, align 4
+ %tmp31 = sub i32 7, %j.0.i ; <i32> [#uses=1]
+ %tmp32 = sext i32 %tmp31 to i64 ; <i64> [#uses=1]
+ %tmp33 = getelementptr [15 x i32], [15 x i32]* %c, i64 0, i64 %tmp32 ; <i32*> [#uses=1]
+ store i32 1, i32* %tmp33, align 4
+ br label %bb7.i.backedge
bb7.i.backedge: ; preds = %bb3.i.bb7.i.backedge_crit_edge, %bb2.i.bb7.i.backedge_crit_edge, %bb1.i.bb7.i.backedge_crit_edge, %bb.i.bb7.i.backedge_crit_edge, %bb5.i
- br label %bb7.i
+ br label %bb7.i
bb7.i: ; preds = %bb7.i.backedge, %newFuncRoot
- %j.0.i = phi i32 [ 0, %newFuncRoot ], [ %tmp, %bb7.i.backedge ] ; <i32> [#uses=8]
- %tmp34 = load i32, i32* %q, align 4 ; <i32> [#uses=1]
- %tmp35 = icmp eq i32 %tmp34, 0 ; <i1> [#uses=1]
- %tmp36 = icmp ne i32 %j.0.i, 8 ; <i1> [#uses=1]
- %tmp37 = and i1 %tmp35, %tmp36 ; <i1> [#uses=1]
- br i1 %tmp37, label %bb.i, label %Try.exit.exitStub
+ %j.0.i = phi i32 [ 0, %newFuncRoot ], [ %tmp, %bb7.i.backedge ] ; <i32> [#uses=8]
+ %tmp34 = load i32, i32* %q, align 4 ; <i32> [#uses=1]
+ %tmp35 = icmp eq i32 %tmp34, 0 ; <i1> [#uses=1]
+ %tmp36 = icmp ne i32 %j.0.i, 8 ; <i1> [#uses=1]
+ %tmp37 = and i1 %tmp35, %tmp36 ; <i1> [#uses=1]
+ br i1 %tmp37, label %bb.i, label %Try.exit.exitStub
bb.i.bb7.i.backedge_crit_edge: ; preds = %bb.i
- br label %bb7.i.backedge
+ br label %bb7.i.backedge
bb1.i.bb7.i.backedge_crit_edge: ; preds = %bb1.i
- br label %bb7.i.backedge
+ br label %bb7.i.backedge
bb2.i.bb7.i.backedge_crit_edge: ; preds = %bb2.i
- br label %bb7.i.backedge
+ br label %bb7.i.backedge
bb3.i.bb7.i.backedge_crit_edge: ; preds = %bb3.i
- br label %bb7.i.backedge
+ br label %bb7.i.backedge
}
diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count8.ll b/llvm/test/Analysis/ScalarEvolution/trip-count8.ll
index a1777bc969c9..ac06fbf5db59 100644
--- a/llvm/test/Analysis/ScalarEvolution/trip-count8.ll
+++ b/llvm/test/Analysis/ScalarEvolution/trip-count8.ll
@@ -1,38 +1,45 @@
-; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
+; RUN: opt < %s -analyze -scalar-evolution -scalar-evolution-classify-expressions=0 | FileCheck %s
; PR4599
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"
-; CHECK: Loop %for.body: backedge-taken count is (-1 + {{%?}}ecx)
-
define i32 @foo(i32 %ecx) nounwind {
+; CHECK-LABEL: 'foo'
+; CHECK-NEXT: Determining loop execution counts for: @foo
+; CHECK-NEXT: Loop %for.body: backedge-taken count is (-1 + %ecx)
+; CHECK-NEXT: Loop %for.body: max backedge-taken count is -2
+; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (-1 + %ecx)
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %for.body: Trip multiple is 1
+;
entry:
- %cmp2 = icmp eq i32 %ecx, 0 ; <i1> [#uses=1]
- br i1 %cmp2, label %for.end, label %bb.nph
+ %cmp2 = icmp eq i32 %ecx, 0 ; <i1> [#uses=1]
+ br i1 %cmp2, label %for.end, label %bb.nph
for.cond: ; preds = %for.inc
- %cmp = icmp ult i32 %inc, %ecx ; <i1> [#uses=1]
- br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge
+ %cmp = icmp ult i32 %inc, %ecx ; <i1> [#uses=1]
+ br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge
for.cond.for.end_crit_edge: ; preds = %for.cond
- %phitmp = add i32 %i.01, 2 ; <i32> [#uses=1]
- br label %for.end
+ %phitmp = add i32 %i.01, 2 ; <i32> [#uses=1]
+ br label %for.end
bb.nph: ; preds = %entry
- br label %for.body
+ br label %for.body
for.body: ; preds = %bb.nph, %for.cond
- %i.01 = phi i32 [ %inc, %for.cond ], [ 0, %bb.nph ] ; <i32> [#uses=3]
- %call = call i32 @bar(i32 %i.01) nounwind ; <i32> [#uses=0]
- br label %for.inc
+ %i.01 = phi i32 [ %inc, %for.cond ], [ 0, %bb.nph ] ; <i32> [#uses=3]
+ %call = call i32 @bar(i32 %i.01) nounwind ; <i32> [#uses=0]
+ br label %for.inc
for.inc: ; preds = %for.body
- %inc = add i32 %i.01, 1 ; <i32> [#uses=2]
- br label %for.cond
+ %inc = add i32 %i.01, 1 ; <i32> [#uses=2]
+ br label %for.cond
for.end: ; preds = %for.cond.for.end_crit_edge, %entry
- %i.0.lcssa = phi i32 [ %phitmp, %for.cond.for.end_crit_edge ], [ 1, %entry ] ; <i32> [#uses=1]
- ret i32 %i.0.lcssa
+ %i.0.lcssa = phi i32 [ %phitmp, %for.cond.for.end_crit_edge ], [ 1, %entry ] ; <i32> [#uses=1]
+ ret i32 %i.0.lcssa
}
declare i32 @bar(i32)
diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count9.ll b/llvm/test/Analysis/ScalarEvolution/trip-count9.ll
index 9a080b34743f..d0fb51a1ee5f 100644
--- a/llvm/test/Analysis/ScalarEvolution/trip-count9.ll
+++ b/llvm/test/Analysis/ScalarEvolution/trip-count9.ll
@@ -1,4 +1,5 @@
-; RUN: opt -analyze -scalar-evolution -S < %s | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
+; RUN: opt -analyze -scalar-evolution -S -scalar-evolution-classify-expressions=0 < %s | FileCheck %s
; Every combination of
; - starting at 0, 1, or %x
@@ -8,10 +9,15 @@
; Some of these represent missed opportunities.
-; CHECK: Determining loop execution counts for: @foo
-; CHECK: Loop %loop: backedge-taken count is (-1 + %n)
-; CHECK: Loop %loop: max backedge-taken count is 6
define void @foo(i4 %n) {
+; CHECK-LABEL: 'foo'
+; CHECK-NEXT: Determining loop execution counts for: @foo
+; CHECK-NEXT: Loop %loop: backedge-taken count is (-1 + %n)
+; CHECK-NEXT: Loop %loop: max backedge-taken count is 6
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %n)
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 1
+;
entry:
%s = icmp sgt i4 %n, 0
br i1 %s, label %loop, label %exit
@@ -24,10 +30,13 @@ exit:
ret void
}
-; CHECK: Determining loop execution counts for: @step2
-; CHECK: Loop %loop: Unpredictable backedge-taken count.
-; CHECK: Loop %loop: Unpredictable max backedge-taken count.
define void @step2(i4 %n) {
+; CHECK-LABEL: 'step2'
+; CHECK-NEXT: Determining loop execution counts for: @step2
+; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable max backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
+;
entry:
%s = icmp sgt i4 %n, 0
br i1 %s, label %loop, label %exit
@@ -40,10 +49,15 @@ exit:
ret void
}
-; CHECK: Determining loop execution counts for: @start1
-; CHECK: Loop %loop: backedge-taken count is (-2 + (2 smax %n))
-; CHECK: Loop %loop: max backedge-taken count is 5
define void @start1(i4 %n) {
+; CHECK-LABEL: 'start1'
+; CHECK-NEXT: Determining loop execution counts for: @start1
+; CHECK-NEXT: Loop %loop: backedge-taken count is (-2 + (2 smax %n))<nsw>
+; CHECK-NEXT: Loop %loop: max backedge-taken count is 5
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-2 + (2 smax %n))<nsw>
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 1
+;
entry:
%s = icmp sgt i4 %n, 0
br i1 %s, label %loop, label %exit
@@ -56,10 +70,13 @@ exit:
ret void
}
-; CHECK: Determining loop execution counts for: @start1_step2
-; CHECK: Loop %loop: Unpredictable backedge-taken count.
-; CHECK: Loop %loop: Unpredictable max backedge-taken count.
define void @start1_step2(i4 %n) {
+; CHECK-LABEL: 'start1_step2'
+; CHECK-NEXT: Determining loop execution counts for: @start1_step2
+; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable max backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
+;
entry:
%s = icmp sgt i4 %n, 0
br i1 %s, label %loop, label %exit
@@ -72,10 +89,15 @@ exit:
ret void
}
-; CHECK: Determining loop execution counts for: @startx
-; CHECK: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax %n))
-; CHECK: Loop %loop: max backedge-taken count is -1
define void @startx(i4 %n, i4 %x) {
+; CHECK-LABEL: 'startx'
+; CHECK-NEXT: Determining loop execution counts for: @startx
+; CHECK-NEXT: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax %n))
+; CHECK-NEXT: Loop %loop: max backedge-taken count is -1
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax %n))
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 1
+;
entry:
%s = icmp sgt i4 %n, 0
br i1 %s, label %loop, label %exit
@@ -88,10 +110,13 @@ exit:
ret void
}
-; CHECK: Determining loop execution counts for: @startx_step2
-; CHECK: Loop %loop: Unpredictable backedge-taken count.
-; CHECK: Loop %loop: Unpredictable max backedge-taken count.
define void @startx_step2(i4 %n, i4 %x) {
+; CHECK-LABEL: 'startx_step2'
+; CHECK-NEXT: Determining loop execution counts for: @startx_step2
+; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable max backedge-taken count.
+; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
+;
entry:
%s = icmp sgt i4 %n, 0
br i1 %s, label %loop, label %exit
@@ -104,10 +129,15 @@ exit:
ret void
}
-; CHECK: Determining loop execution counts for: @nsw
-; CHECK: Loop %loop: backedge-taken count is (-1 + %n)
-; CHECK: Loop %loop: max backedge-taken count is 6
define void @nsw(i4 %n) {
+; CHECK-LABEL: 'nsw'
+; CHECK-NEXT: Determining loop execution counts for: @nsw
+; CHECK-NEXT: Loop %loop: backedge-taken count is (-1 + %n)
+; CHECK-NEXT: Loop %loop: max backedge-taken count is 6
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %n)
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 1
+;
entry:
%s = icmp sgt i4 %n, 0
br i1 %s, label %loop, label %exit
@@ -128,11 +158,15 @@ exit:
; (b) the return instruction enacts a side effect that is control
; dependent on the poison value.
;
-; CHECK-LABEL: nsw_step2
-; CHECK: Determining loop execution counts for: @nsw_step2
-; CHECK: Loop %loop: backedge-taken count is ((-1 + %n) /u 2)
-; CHECK: Loop %loop: max backedge-taken count is 2
define void @nsw_step2(i4 %n) {
+; CHECK-LABEL: 'nsw_step2'
+; CHECK-NEXT: Determining loop execution counts for: @nsw_step2
+; CHECK-NEXT: Loop %loop: backedge-taken count is ((-1 + %n) /u 2)
+; CHECK-NEXT: Loop %loop: max backedge-taken count is 2
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-1 + %n) /u 2)
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 1
+;
entry:
%s = icmp sgt i4 %n, 0
br i1 %s, label %loop, label %exit
@@ -145,11 +179,15 @@ exit:
ret void
}
-; CHECK-LABEL: nsw_start1
-; CHECK: Determining loop execution counts for: @nsw_start1
-; CHECK: Loop %loop: backedge-taken count is (-2 + (2 smax %n))
-; CHECK: Loop %loop: max backedge-taken count is 5
define void @nsw_start1(i4 %n) {
+; CHECK-LABEL: 'nsw_start1'
+; CHECK-NEXT: Determining loop execution counts for: @nsw_start1
+; CHECK-NEXT: Loop %loop: backedge-taken count is (-2 + (2 smax %n))<nsw>
+; CHECK-NEXT: Loop %loop: max backedge-taken count is 5
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-2 + (2 smax %n))<nsw>
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 1
+;
entry:
%s = icmp sgt i4 %n, 0
br i1 %s, label %loop, label %exit
@@ -162,10 +200,15 @@ exit:
ret void
}
-; CHECK: Determining loop execution counts for: @nsw_start1_step2
-; CHECK: Loop %loop: backedge-taken count is ((-2 + (3 smax %n)) /u 2)
-; CHECK: Loop %loop: max backedge-taken count is 2
define void @nsw_start1_step2(i4 %n) {
+; CHECK-LABEL: 'nsw_start1_step2'
+; CHECK-NEXT: Determining loop execution counts for: @nsw_start1_step2
+; CHECK-NEXT: Loop %loop: backedge-taken count is ((-2 + (3 smax %n)) /u 2)
+; CHECK-NEXT: Loop %loop: max backedge-taken count is 2
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-2 + (3 smax %n)) /u 2)
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 1
+;
entry:
%s = icmp sgt i4 %n, 0
br i1 %s, label %loop, label %exit
@@ -178,10 +221,15 @@ exit:
ret void
}
-; CHECK: Determining loop execution counts for: @nsw_startx
-; CHECK: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax %n))
-; CHECK: Loop %loop: max backedge-taken count is -1
define void @nsw_startx(i4 %n, i4 %x) {
+; CHECK-LABEL: 'nsw_startx'
+; CHECK-NEXT: Determining loop execution counts for: @nsw_startx
+; CHECK-NEXT: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax %n))
+; CHECK-NEXT: Loop %loop: max backedge-taken count is -1
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax %n))
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 1
+;
entry:
%s = icmp sgt i4 %n, 0
br i1 %s, label %loop, label %exit
@@ -194,10 +242,15 @@ exit:
ret void
}
-; CHECK: Determining loop execution counts for: @nsw_startx_step2
-; CHECK: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax %n)) /u 2)
-; CHECK: Loop %loop: max backedge-taken count is 7
define void @nsw_startx_step2(i4 %n, i4 %x) {
+; CHECK-LABEL: 'nsw_startx_step2'
+; CHECK-NEXT: Determining loop execution counts for: @nsw_startx_step2
+; CHECK-NEXT: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax %n)) /u 2)
+; CHECK-NEXT: Loop %loop: max backedge-taken count is 7
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax %n)) /u 2)
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 1
+;
entry:
%s = icmp sgt i4 %n, 0
br i1 %s, label %loop, label %exit
@@ -210,10 +263,15 @@ exit:
ret void
}
-; CHECK: Determining loop execution counts for: @even
-; CHECK: Loop %loop: backedge-taken count is (-1 + (2 * %n))
-; CHECK: Loop %loop: max backedge-taken count is 5
define void @even(i4 %n) {
+; CHECK-LABEL: 'even'
+; CHECK-NEXT: Determining loop execution counts for: @even
+; CHECK-NEXT: Loop %loop: backedge-taken count is (-1 + (2 * %n))
+; CHECK-NEXT: Loop %loop: max backedge-taken count is 5
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (2 * %n))
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 2
+;
entry:
%m = shl i4 %n, 1
%s = icmp sgt i4 %m, 0
@@ -227,10 +285,15 @@ exit:
ret void
}
-; CHECK: Determining loop execution counts for: @even_step2
-; CHECK: Loop %loop: backedge-taken count is ((-1 + (2 * %n)) /u 2)
-; CHECK: Loop %loop: max backedge-taken count is 2
define void @even_step2(i4 %n) {
+; CHECK-LABEL: 'even_step2'
+; CHECK-NEXT: Determining loop execution counts for: @even_step2
+; CHECK-NEXT: Loop %loop: backedge-taken count is ((-1 + (2 * %n)) /u 2)
+; CHECK-NEXT: Loop %loop: max backedge-taken count is 2
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-1 + (2 * %n)) /u 2)
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 1
+;
entry:
%m = shl i4 %n, 1
%s = icmp sgt i4 %m, 0
@@ -244,10 +307,15 @@ exit:
ret void
}
-; CHECK: Determining loop execution counts for: @even_start1
-; CHECK: Loop %loop: backedge-taken count is (-2 + (2 smax (2 * %n)))
-; CHECK: Loop %loop: max backedge-taken count is 4
define void @even_start1(i4 %n) {
+; CHECK-LABEL: 'even_start1'
+; CHECK-NEXT: Determining loop execution counts for: @even_start1
+; CHECK-NEXT: Loop %loop: backedge-taken count is (-2 + (2 smax (2 * %n)))<nsw>
+; CHECK-NEXT: Loop %loop: max backedge-taken count is 4
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-2 + (2 smax (2 * %n)))<nsw>
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 1
+;
entry:
%m = shl i4 %n, 1
%s = icmp sgt i4 %m, 0
@@ -261,10 +329,15 @@ exit:
ret void
}
-; CHECK: Determining loop execution counts for: @even_start1_step2
-; CHECK: Loop %loop: backedge-taken count is ((-2 + (3 smax (2 * %n))) /u 2)
-; CHECK: Loop %loop: max backedge-taken count is 2
define void @even_start1_step2(i4 %n) {
+; CHECK-LABEL: 'even_start1_step2'
+; CHECK-NEXT: Determining loop execution counts for: @even_start1_step2
+; CHECK-NEXT: Loop %loop: backedge-taken count is ((-2 + (3 smax (2 * %n))) /u 2)
+; CHECK-NEXT: Loop %loop: max backedge-taken count is 2
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-2 + (3 smax (2 * %n))) /u 2)
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 1
+;
entry:
%m = shl i4 %n, 1
%s = icmp sgt i4 %m, 0
@@ -278,10 +351,15 @@ exit:
ret void
}
-; CHECK: Determining loop execution counts for: @even_startx
-; CHECK: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax (2 * %n)))
-; CHECK: Loop %loop: max backedge-taken count is -2
define void @even_startx(i4 %n, i4 %x) {
+; CHECK-LABEL: 'even_startx'
+; CHECK-NEXT: Determining loop execution counts for: @even_startx
+; CHECK-NEXT: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax (2 * %n)))
+; CHECK-NEXT: Loop %loop: max backedge-taken count is -2
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax (2 * %n)))
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 1
+;
entry:
%m = shl i4 %n, 1
%s = icmp sgt i4 %m, 0
@@ -295,10 +373,15 @@ exit:
ret void
}
-; CHECK: Determining loop execution counts for: @even_startx_step2
-; CHECK: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax (2 * %n))) /u 2)
-; CHECK: Loop %loop: max backedge-taken count is 7
define void @even_startx_step2(i4 %n, i4 %x) {
+; CHECK-LABEL: 'even_startx_step2'
+; CHECK-NEXT: Determining loop execution counts for: @even_startx_step2
+; CHECK-NEXT: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax (2 * %n))) /u 2)
+; CHECK-NEXT: Loop %loop: max backedge-taken count is 7
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax (2 * %n))) /u 2)
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 1
+;
entry:
%m = shl i4 %n, 1
%s = icmp sgt i4 %m, 0
@@ -312,10 +395,15 @@ exit:
ret void
}
-; CHECK: Determining loop execution counts for: @even_nsw
-; CHECK: Loop %loop: backedge-taken count is (-1 + (2 * %n))
-; CHECK: Loop %loop: max backedge-taken count is 5
define void @even_nsw(i4 %n) {
+; CHECK-LABEL: 'even_nsw'
+; CHECK-NEXT: Determining loop execution counts for: @even_nsw
+; CHECK-NEXT: Loop %loop: backedge-taken count is (-1 + (2 * %n))
+; CHECK-NEXT: Loop %loop: max backedge-taken count is 5
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (2 * %n))
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 2
+;
entry:
%m = shl i4 %n, 1
%s = icmp sgt i4 %m, 0
@@ -329,10 +417,15 @@ exit:
ret void
}
-; CHECK: Determining loop execution counts for: @even_nsw_step2
-; CHECK: Loop %loop: backedge-taken count is ((-1 + (2 * %n)) /u 2)
-; CHECK: Loop %loop: max backedge-taken count is 2
define void @even_nsw_step2(i4 %n) {
+; CHECK-LABEL: 'even_nsw_step2'
+; CHECK-NEXT: Determining loop execution counts for: @even_nsw_step2
+; CHECK-NEXT: Loop %loop: backedge-taken count is ((-1 + (2 * %n)) /u 2)
+; CHECK-NEXT: Loop %loop: max backedge-taken count is 2
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-1 + (2 * %n)) /u 2)
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 1
+;
entry:
%m = shl i4 %n, 1
%s = icmp sgt i4 %m, 0
@@ -346,10 +439,15 @@ exit:
ret void
}
-; CHECK: Determining loop execution counts for: @even_nsw_start1
-; CHECK: Loop %loop: backedge-taken count is (-2 + (2 smax (2 * %n)))
-; CHECK: Loop %loop: max backedge-taken count is 4
define void @even_nsw_start1(i4 %n) {
+; CHECK-LABEL: 'even_nsw_start1'
+; CHECK-NEXT: Determining loop execution counts for: @even_nsw_start1
+; CHECK-NEXT: Loop %loop: backedge-taken count is (-2 + (2 smax (2 * %n)))<nsw>
+; CHECK-NEXT: Loop %loop: max backedge-taken count is 4
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-2 + (2 smax (2 * %n)))<nsw>
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 1
+;
entry:
%m = shl i4 %n, 1
%s = icmp sgt i4 %m, 0
@@ -363,10 +461,15 @@ exit:
ret void
}
-; CHECK: Determining loop execution counts for: @even_nsw_start1_step2
-; CHECK: Loop %loop: backedge-taken count is ((-2 + (3 smax (2 * %n))) /u 2)
-; CHECK: Loop %loop: max backedge-taken count is 2
define void @even_nsw_start1_step2(i4 %n) {
+; CHECK-LABEL: 'even_nsw_start1_step2'
+; CHECK-NEXT: Determining loop execution counts for: @even_nsw_start1_step2
+; CHECK-NEXT: Loop %loop: backedge-taken count is ((-2 + (3 smax (2 * %n))) /u 2)
+; CHECK-NEXT: Loop %loop: max backedge-taken count is 2
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-2 + (3 smax (2 * %n))) /u 2)
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 1
+;
entry:
%m = shl i4 %n, 1
%s = icmp sgt i4 %m, 0
@@ -380,10 +483,15 @@ exit:
ret void
}
-; CHECK: Determining loop execution counts for: @even_nsw_startx
-; CHECK: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax (2 * %n)))
-; CHECK: Loop %loop: max backedge-taken count is -2
define void @even_nsw_startx(i4 %n, i4 %x) {
+; CHECK-LABEL: 'even_nsw_startx'
+; CHECK-NEXT: Determining loop execution counts for: @even_nsw_startx
+; CHECK-NEXT: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax (2 * %n)))
+; CHECK-NEXT: Loop %loop: max backedge-taken count is -2
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax (2 * %n)))
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 1
+;
entry:
%m = shl i4 %n, 1
%s = icmp sgt i4 %m, 0
@@ -397,10 +505,15 @@ exit:
ret void
}
-; CHECK: Determining loop execution counts for: @even_nsw_startx_step2
-; CHECK: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax (2 * %n))) /u 2)
-; CHECK: Loop %loop: max backedge-taken count is 7
define void @even_nsw_startx_step2(i4 %n, i4 %x) {
+; CHECK-LABEL: 'even_nsw_startx_step2'
+; CHECK-NEXT: Determining loop execution counts for: @even_nsw_startx_step2
+; CHECK-NEXT: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax (2 * %n))) /u 2)
+; CHECK-NEXT: Loop %loop: max backedge-taken count is 7
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax (2 * %n))) /u 2)
+; CHECK-NEXT: Predicates:
+; CHECK: Loop %loop: Trip multiple is 1
+;
entry:
%m = shl i4 %n, 1
%s = icmp sgt i4 %m, 0
More information about the llvm-commits
mailing list