[llvm] e946b5a - [SCEV] Autogenerate more scev analysis check tests

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 6 12:42:27 PST 2024


Author: Philip Reames
Date: 2024-03-06T12:42:19-08:00
New Revision: e946b5a87b2db307da076093d0a9a72ecb4ec089

URL: https://github.com/llvm/llvm-project/commit/e946b5a87b2db307da076093d0a9a72ecb4ec089
DIFF: https://github.com/llvm/llvm-project/commit/e946b5a87b2db307da076093d0a9a72ecb4ec089.diff

LOG: [SCEV] Autogenerate more scev analysis check tests

Added: 
    

Modified: 
    llvm/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll
    llvm/test/Analysis/ScalarEvolution/2007-09-27-LargeStepping.ll
    llvm/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll
    llvm/test/Analysis/ScalarEvolution/2008-07-19-WrappingIV.ll
    llvm/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll
    llvm/test/Analysis/ScalarEvolution/2009-05-09-PointerEdgeCount.ll
    llvm/test/Analysis/ScalarEvolution/SolveQuadraticEquation.ll
    llvm/test/Analysis/ScalarEvolution/exact_iter_count.ll
    llvm/test/Transforms/PhaseOrdering/scev-custom-dl.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll b/llvm/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll
index 6af105e3c28df3..aade3499dba17a 100644
--- a/llvm/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll
+++ b/llvm/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll
@@ -1,11 +1,18 @@
-; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-max-iterations=0 2>&1 | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 4
+; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-max-iterations=0 -scalar-evolution-classify-expressions=0 2>&1 | FileCheck %s
 ; PR1533
 
 @array = weak global [101 x i32] zeroinitializer, align 32		; <ptr> [#uses=1]
 
-; CHECK: Loop %bb: backedge-taken count is 100
 
 define void @loop(i32 %x) {
+; CHECK-LABEL: 'loop'
+; CHECK-NEXT:  Determining loop execution counts for: @loop
+; CHECK-NEXT:  Loop %bb: backedge-taken count is 100
+; CHECK-NEXT:  Loop %bb: constant max backedge-taken count is i32 100
+; CHECK-NEXT:  Loop %bb: symbolic max backedge-taken count is 100
+; CHECK-NEXT:  Loop %bb: Trip multiple is 101
+;
 entry:
 	br label %bb
 

diff  --git a/llvm/test/Analysis/ScalarEvolution/2007-09-27-LargeStepping.ll b/llvm/test/Analysis/ScalarEvolution/2007-09-27-LargeStepping.ll
index 321b29efb5f6a2..f79d5daee7416c 100644
--- a/llvm/test/Analysis/ScalarEvolution/2007-09-27-LargeStepping.ll
+++ b/llvm/test/Analysis/ScalarEvolution/2007-09-27-LargeStepping.ll
@@ -1,9 +1,16 @@
-; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-max-iterations=0 2>&1 | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 4
+; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-max-iterations=0 -scalar-evolution-classify-expressions=0 2>&1 | FileCheck %s
 ; PR1706
 
-; CHECK: backedge-taken count is 13
 
 define i32 @f() {
+; CHECK-LABEL: 'f'
+; CHECK-NEXT:  Determining loop execution counts for: @f
+; CHECK-NEXT:  Loop %bb5: backedge-taken count is 13
+; CHECK-NEXT:  Loop %bb5: constant max backedge-taken count is i32 13
+; CHECK-NEXT:  Loop %bb5: symbolic max backedge-taken count is 13
+; CHECK-NEXT:  Loop %bb5: Trip multiple is 14
+;
 entry:
 	br label %bb5
 

diff  --git a/llvm/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll b/llvm/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll
index 6ed38ffb95fee7..a9545f436b89ee 100644
--- a/llvm/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll
+++ b/llvm/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll
@@ -1,9 +1,16 @@
-; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-max-iterations=0 2>&1 | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 4
+; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-max-iterations=0 -scalar-evolution-classify-expressions=0 2>&1 | FileCheck %s
 ; PR2364
 
-; CHECK: backedge-taken count is 61
 
 define i32 @func_6() nounwind  {
+; CHECK-LABEL: 'func_6'
+; CHECK-NEXT:  Determining loop execution counts for: @func_6
+; CHECK-NEXT:  Loop %bb5: backedge-taken count is 61
+; CHECK-NEXT:  Loop %bb5: constant max backedge-taken count is i8 61
+; CHECK-NEXT:  Loop %bb5: symbolic max backedge-taken count is 61
+; CHECK-NEXT:  Loop %bb5: Trip multiple is 62
+;
 entry:
 	br label %bb5
 

diff  --git a/llvm/test/Analysis/ScalarEvolution/2008-07-19-WrappingIV.ll b/llvm/test/Analysis/ScalarEvolution/2008-07-19-WrappingIV.ll
index b3361844c468b2..45fe08a340ebdb 100644
--- a/llvm/test/Analysis/ScalarEvolution/2008-07-19-WrappingIV.ll
+++ b/llvm/test/Analysis/ScalarEvolution/2008-07-19-WrappingIV.ll
@@ -1,9 +1,16 @@
-; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-max-iterations=0 2>&1 | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 4
+; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-max-iterations=0 -scalar-evolution-classify-expressions=0 2>&1 | FileCheck %s
 ; PR2088
 
-; CHECK: backedge-taken count is 113
 
 define void @fun() {
+; CHECK-LABEL: 'fun'
+; CHECK-NEXT:  Determining loop execution counts for: @fun
+; CHECK-NEXT:  Loop %loop: backedge-taken count is 113
+; CHECK-NEXT:  Loop %loop: constant max backedge-taken count is i8 113
+; CHECK-NEXT:  Loop %loop: symbolic max backedge-taken count is 113
+; CHECK-NEXT:  Loop %loop: Trip multiple is 114
+;
 entry:
         br label %loop
 loop:

diff  --git a/llvm/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll b/llvm/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll
index fabd37a269359e..fab2e5495653d1 100644
--- a/llvm/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll
+++ b/llvm/test/Analysis/ScalarEvolution/2008-12-08-FiniteSGE.ll
@@ -1,8 +1,15 @@
-; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" 2>&1 | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 4
+; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-classify-expressions=0 2>&1 | FileCheck %s
 
-; CHECK: backedge-taken count is 255
 
 define i32 @foo(i32 %x, i32 %y, ptr %lam, ptr %alp) nounwind {
+; CHECK-LABEL: 'foo'
+; CHECK-NEXT:  Determining loop execution counts for: @foo
+; CHECK-NEXT:  Loop %bb1: backedge-taken count is 255
+; CHECK-NEXT:  Loop %bb1: constant max backedge-taken count is i32 255
+; CHECK-NEXT:  Loop %bb1: symbolic max backedge-taken count is 255
+; CHECK-NEXT:  Loop %bb1: Trip multiple is 256
+;
 bb1.thread:
 	br label %bb1
 

diff  --git a/llvm/test/Analysis/ScalarEvolution/2009-05-09-PointerEdgeCount.ll b/llvm/test/Analysis/ScalarEvolution/2009-05-09-PointerEdgeCount.ll
index 452ba1bd2edb78..c683fbaa9aefcd 100644
--- a/llvm/test/Analysis/ScalarEvolution/2009-05-09-PointerEdgeCount.ll
+++ b/llvm/test/Analysis/ScalarEvolution/2009-05-09-PointerEdgeCount.ll
@@ -1,7 +1,7 @@
-; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" 2>&1 | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 4
+; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-classify-expressions=0 2>&1 | FileCheck %s
 ; PR3171
 
-; CHECK: count is 2
 
 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
 
@@ -9,6 +9,13 @@ target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:1
 	%struct.NonPod = type { [2 x %struct.Foo] }
 
 define void @_Z3foov() nounwind {
+; CHECK-LABEL: '_Z3foov'
+; CHECK-NEXT:  Determining loop execution counts for: @_Z3foov
+; CHECK-NEXT:  Loop %bb1.i: backedge-taken count is 2
+; CHECK-NEXT:  Loop %bb1.i: constant max backedge-taken count is i64 2
+; CHECK-NEXT:  Loop %bb1.i: symbolic max backedge-taken count is 2
+; CHECK-NEXT:  Loop %bb1.i: Trip multiple is 3
+;
 entry:
 	%x = alloca %struct.NonPod, align 8		; <ptr> [#uses=2]
 	%0 = getelementptr %struct.NonPod, ptr %x, i32 0, i32 0		; <ptr> [#uses=1]

diff  --git a/llvm/test/Analysis/ScalarEvolution/SolveQuadraticEquation.ll b/llvm/test/Analysis/ScalarEvolution/SolveQuadraticEquation.ll
index e09ebea43083e6..d87c2cf466a6f3 100644
--- a/llvm/test/Analysis/ScalarEvolution/SolveQuadraticEquation.ll
+++ b/llvm/test/Analysis/ScalarEvolution/SolveQuadraticEquation.ll
@@ -1,10 +1,18 @@
-; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-max-iterations=0 2>&1 | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 4
+; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-max-iterations=0 -scalar-evolution-classify-expressions=0 2>&1 | FileCheck %s
 
 ; PR1101
 
- at A = weak global [1000 x i32] zeroinitializer, align 32         
+ at A = weak global [1000 x i32] zeroinitializer, align 32
 
 define void @test1(i32 %N) {
+; CHECK-LABEL: 'test1'
+; CHECK-NEXT:  Determining loop execution counts for: @test1
+; CHECK-NEXT:  Loop %bb3: backedge-taken count is 100
+; CHECK-NEXT:  Loop %bb3: constant max backedge-taken count is i32 100
+; CHECK-NEXT:  Loop %bb3: symbolic max backedge-taken count is 100
+; CHECK-NEXT:  Loop %bb3: Trip multiple is 101
+;
 entry:
         %"alloca point" = bitcast i32 0 to i32           ; <i32> [#uses=0]
         br label %bb3
@@ -29,14 +37,21 @@ bb5:            ; preds = %bb3
 return:         ; preds = %bb5
         ret void
 }
-; CHECK: Determining loop execution counts for: @test1
-; CHECK-NEXT: backedge-taken count is 100
 
 
 ; PR10383
 ; These next two used to crash.
 
 define void @test2(i1 %cmp, i64 %n) {
+; CHECK-LABEL: 'test2'
+; CHECK-NEXT:  Determining loop execution counts for: @test2
+; CHECK-NEXT:  Loop %for.body2: Unpredictable backedge-taken count.
+; CHECK-NEXT:  Loop %for.body2: Unpredictable constant max backedge-taken count.
+; CHECK-NEXT:  Loop %for.body2: Unpredictable symbolic max backedge-taken count.
+; CHECK-NEXT:  Loop %for.body1: Unpredictable backedge-taken count.
+; CHECK-NEXT:  Loop %for.body1: Unpredictable constant max backedge-taken count.
+; CHECK-NEXT:  Loop %for.body1: Unpredictable symbolic max backedge-taken count.
+;
 entry:
   br label %for.body1
 
@@ -59,9 +74,14 @@ for.body2:
 end:
   ret void
 }
-; CHECK: Determining loop execution counts for: @test2
 
 define i32 @test3() {
+; CHECK-LABEL: 'test3'
+; CHECK-NEXT:  Determining loop execution counts for: @test3
+; CHECK-NEXT:  Loop %for.inc479: Unpredictable backedge-taken count.
+; CHECK-NEXT:  Loop %for.inc479: Unpredictable constant max backedge-taken count.
+; CHECK-NEXT:  Loop %for.inc479: Unpredictable symbolic max backedge-taken count.
+;
 if.then466:
   br i1 undef, label %for.cond539.preheader, label %for.inc479
 
@@ -78,12 +98,17 @@ for.inc479:
 for.cond539.preheader:
   unreachable
 }
-; CHECK: Determining loop execution counts for: @test3
 
 ; PR13489
 ; We used to crash on this too.
 
 define void @test4() {
+; CHECK-LABEL: 'test4'
+; CHECK-NEXT:  Determining loop execution counts for: @test4
+; CHECK-NEXT:  Loop %for.body: Unpredictable backedge-taken count.
+; CHECK-NEXT:  Loop %for.body: Unpredictable constant max backedge-taken count.
+; CHECK-NEXT:  Loop %for.body: Unpredictable symbolic max backedge-taken count.
+;
 entry:
   br label %for.body
 
@@ -99,4 +124,3 @@ for.end:                                          ; preds = %for.body
   ret void
 }
 
-; CHECK: Determining loop execution counts for: @test4

diff  --git a/llvm/test/Analysis/ScalarEvolution/exact_iter_count.ll b/llvm/test/Analysis/ScalarEvolution/exact_iter_count.ll
index 86848c0af8394a..9e6c6aa651b079 100644
--- a/llvm/test/Analysis/ScalarEvolution/exact_iter_count.ll
+++ b/llvm/test/Analysis/ScalarEvolution/exact_iter_count.ll
@@ -1,11 +1,19 @@
-; RUN: opt < %s "-passes=print<scalar-evolution>" -disable-output 2>&1 | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 4
+; RUN: opt < %s "-passes=print<scalar-evolution>" -scalar-evolution-classify-expressions=0 -disable-output 2>&1 | 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-LABEL: 'test_01'
+; CHECK-NEXT:  Determining loop execution counts for: @test_01
 ; CHECK-NEXT:  Loop %loop: <multiple exits> backedge-taken count is 50
-
+; CHECK-NEXT:    exit count for loop: 50
+; CHECK-NEXT:    exit count for backedge: 100
+; CHECK-NEXT:  Loop %loop: constant max backedge-taken count is i32 50
+; CHECK-NEXT:  Loop %loop: symbolic max backedge-taken count is 50
+; CHECK-NEXT:    symbolic max exit count for loop: 50
+; CHECK-NEXT:    symbolic max exit count for backedge: 100
+; CHECK-NEXT:  Loop %loop: Trip multiple is 1
+;
 entry:
   br label %loop
 
@@ -27,10 +35,17 @@ side.exit:
 }
 
 define void @test_02(i1 %c) {
-
-; CHECK-LABEL: Determining loop execution counts for: @test_02
+; CHECK-LABEL: 'test_02'
+; CHECK-NEXT:  Determining loop execution counts for: @test_02
 ; CHECK-NEXT:  Loop %loop: <multiple exits> backedge-taken count is 50
-
+; CHECK-NEXT:    exit count for merge: 50
+; CHECK-NEXT:    exit count for backedge: 100
+; CHECK-NEXT:  Loop %loop: constant max backedge-taken count is i32 50
+; CHECK-NEXT:  Loop %loop: symbolic max backedge-taken count is 50
+; CHECK-NEXT:    symbolic max exit count for merge: 50
+; CHECK-NEXT:    symbolic max exit count for backedge: 100
+; CHECK-NEXT:  Loop %loop: Trip multiple is 1
+;
 entry:
   br label %loop
 

diff  --git a/llvm/test/Transforms/PhaseOrdering/scev-custom-dl.ll b/llvm/test/Transforms/PhaseOrdering/scev-custom-dl.ll
index 05f0651857f2b7..467f1e0210ff41 100644
--- a/llvm/test/Transforms/PhaseOrdering/scev-custom-dl.ll
+++ b/llvm/test/Transforms/PhaseOrdering/scev-custom-dl.ll
@@ -1,4 +1,5 @@
-; RUN: opt -passes='default<O3>,print<scalar-evolution>' -S < %s 2>&1 | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 4
+; RUN: opt -passes='default<O3>,print<scalar-evolution>' -disable-output -S < %s 2>&1 | FileCheck %s
 
 target datalayout = "e-m:m-p:40:64:64:32-i32:32-i16:16-i8:8-n32"
 
@@ -7,11 +8,29 @@ target datalayout = "e-m:m-p:40:64:64:32-i32:32-i16:16-i8:8-n32"
 ; Test that the standard passes don't obfuscate the IR so scalar evolution can't
 ; recognize expressions.
 
-; CHECK: test1
 ; The loop body contains two increments by %div.
 ; Make sure that 2*%div is recognizable, and not expressed as a bit mask of %d.
-; CHECK: -->  {%p,+,(8 * (%d /u 4))}
 define void @test1(i32 %d, ptr %p) nounwind uwtable ssp {
+; CHECK-LABEL: 'test1'
+; CHECK-NEXT:  Classifying expressions for: @test1
+; CHECK-NEXT:    %div1 = lshr i32 %d, 2
+; CHECK-NEXT:    --> (%d /u 4) U: [0,1073741824) S: [0,1073741824)
+; CHECK-NEXT:    %i.03 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
+; CHECK-NEXT:    --> {0,+,1}<nuw><nsw><%for.body> U: [0,64) S: [0,64) Exits: 63 LoopDispositions: { %for.body: Computable }
+; CHECK-NEXT:    %p.addr.02 = phi ptr [ %p, %entry ], [ %add.ptr1, %for.body ]
+; CHECK-NEXT:    --> {%p,+,(8 * (%d /u 4))}<%for.body> U: full-set S: full-set Exits: ((504 * (%d /u 4)) + %p) LoopDispositions: { %for.body: Computable }
+; CHECK-NEXT:    %add.ptr = getelementptr inbounds i32, ptr %p.addr.02, i32 %div1
+; CHECK-NEXT:    --> {((4 * (%d /u 4))<nuw><nsw> + %p),+,(8 * (%d /u 4))}<%for.body> U: full-set S: full-set Exits: ((508 * (%d /u 4)) + %p) LoopDispositions: { %for.body: Computable }
+; CHECK-NEXT:    %add.ptr1 = getelementptr inbounds i32, ptr %add.ptr, i32 %div1
+; CHECK-NEXT:    --> {((8 * (%d /u 4)) + %p),+,(8 * (%d /u 4))}<%for.body> U: full-set S: full-set Exits: ((512 * (%d /u 4)) + %p) LoopDispositions: { %for.body: Computable }
+; CHECK-NEXT:    %inc = add nuw nsw i32 %i.03, 1
+; CHECK-NEXT:    --> {1,+,1}<nuw><nsw><%for.body> U: [1,65) S: [1,65) Exits: 64 LoopDispositions: { %for.body: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @test1
+; CHECK-NEXT:  Loop %for.body: backedge-taken count is 63
+; CHECK-NEXT:  Loop %for.body: constant max backedge-taken count is i32 63
+; CHECK-NEXT:  Loop %for.body: symbolic max backedge-taken count is 63
+; CHECK-NEXT:  Loop %for.body: Trip multiple is 64
+;
 entry:
   %div = udiv i32 %d, 4
   br label %for.cond
@@ -37,10 +56,28 @@ for.end:                                          ; preds = %for.cond
   ret void
 }
 
-; CHECK: test1a
 ; Same thing as test1, but it is even more tempting to fold 2 * (%d /u 2)
-; CHECK: -->  {%p,+,(8 * (%d /u 2))}
 define void @test1a(i32 %d, ptr %p) nounwind uwtable ssp {
+; CHECK-LABEL: 'test1a'
+; CHECK-NEXT:  Classifying expressions for: @test1a
+; CHECK-NEXT:    %div1 = lshr i32 %d, 1
+; CHECK-NEXT:    --> (%d /u 2) U: [0,-2147483648) S: [0,-2147483648)
+; CHECK-NEXT:    %i.03 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
+; CHECK-NEXT:    --> {0,+,1}<nuw><nsw><%for.body> U: [0,64) S: [0,64) Exits: 63 LoopDispositions: { %for.body: Computable }
+; CHECK-NEXT:    %p.addr.02 = phi ptr [ %p, %entry ], [ %add.ptr1, %for.body ]
+; CHECK-NEXT:    --> {%p,+,(8 * (%d /u 2))}<%for.body> U: full-set S: full-set Exits: ((504 * (%d /u 2)) + %p) LoopDispositions: { %for.body: Computable }
+; CHECK-NEXT:    %add.ptr = getelementptr inbounds i32, ptr %p.addr.02, i32 %div1
+; CHECK-NEXT:    --> {((4 * (%d /u 2))<nuw><nsw> + %p),+,(8 * (%d /u 2))}<%for.body> U: full-set S: full-set Exits: ((508 * (%d /u 2)) + %p) LoopDispositions: { %for.body: Computable }
+; CHECK-NEXT:    %add.ptr1 = getelementptr inbounds i32, ptr %add.ptr, i32 %div1
+; CHECK-NEXT:    --> {((8 * (%d /u 2)) + %p),+,(8 * (%d /u 2))}<%for.body> U: full-set S: full-set Exits: ((512 * (%d /u 2)) + %p) LoopDispositions: { %for.body: Computable }
+; CHECK-NEXT:    %inc = add nuw nsw i32 %i.03, 1
+; CHECK-NEXT:    --> {1,+,1}<nuw><nsw><%for.body> U: [1,65) S: [1,65) Exits: 64 LoopDispositions: { %for.body: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @test1a
+; CHECK-NEXT:  Loop %for.body: backedge-taken count is 63
+; CHECK-NEXT:  Loop %for.body: constant max backedge-taken count is i32 63
+; CHECK-NEXT:  Loop %for.body: symbolic max backedge-taken count is 63
+; CHECK-NEXT:  Loop %for.body: Trip multiple is 64
+;
 entry:
   %div = udiv i32 %d, 2
   br label %for.cond
@@ -68,9 +105,22 @@ for.end:                                          ; preds = %for.cond
 
 @array = weak global [101 x i32] zeroinitializer, align 32		; <ptr> [#uses=1]
 
-; CHECK: Loop %bb: backedge-taken count is 100
 
 define void @test_range_ref1a(i32 %x) {
+; CHECK-LABEL: 'test_range_ref1a'
+; CHECK-NEXT:  Classifying expressions for: @test_range_ref1a
+; CHECK-NEXT:    %i.01.0 = phi i32 [ 100, %entry ], [ %tmp4, %bb ]
+; CHECK-NEXT:    --> {100,+,-1}<nsw><%bb> U: [0,101) S: [0,101) Exits: 0 LoopDispositions: { %bb: Computable }
+; CHECK-NEXT:    %tmp1 = getelementptr [101 x i32], ptr @array, i32 0, i32 %i.01.0
+; CHECK-NEXT:    --> {(400 + @array),+,-4}<nw><%bb> U: [0,-3) S: [-2147483648,2147483645) Exits: @array LoopDispositions: { %bb: Computable }
+; CHECK-NEXT:    %tmp4 = add nsw i32 %i.01.0, -1
+; CHECK-NEXT:    --> {99,+,-1}<nsw><%bb> U: [-1,100) S: [-1,100) Exits: -1 LoopDispositions: { %bb: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @test_range_ref1a
+; CHECK-NEXT:  Loop %bb: backedge-taken count is 100
+; CHECK-NEXT:  Loop %bb: constant max backedge-taken count is i32 100
+; CHECK-NEXT:  Loop %bb: symbolic max backedge-taken count is 100
+; CHECK-NEXT:  Loop %bb: Trip multiple is 101
+;
 entry:
 	br label %bb
 
@@ -87,6 +137,32 @@ return:		; preds = %bb
 }
 
 define i32 @test_loop_idiom_recogize(i32 %x, i32 %y, ptr %lam, ptr %alp) nounwind {
+; CHECK-LABEL: 'test_loop_idiom_recogize'
+; CHECK-NEXT:  Classifying expressions for: @test_loop_idiom_recogize
+; CHECK-NEXT:    %indvar = phi i32 [ 0, %bb1.thread ], [ %indvar.next, %bb1 ]
+; CHECK-NEXT:    --> {0,+,1}<nuw><nsw><%bb1> U: [0,256) S: [0,256) Exits: 255 LoopDispositions: { %bb1: Computable }
+; CHECK-NEXT:    %i.0.reg2mem.0 = sub nuw nsw i32 255, %indvar
+; CHECK-NEXT:    --> {255,+,-1}<nsw><%bb1> U: [0,256) S: [0,256) Exits: 0 LoopDispositions: { %bb1: Computable }
+; CHECK-NEXT:    %0 = getelementptr i32, ptr %alp, i32 %i.0.reg2mem.0
+; CHECK-NEXT:    --> {(1020 + %alp),+,-4}<nw><%bb1> U: full-set S: full-set Exits: %alp LoopDispositions: { %bb1: Computable }
+; CHECK-NEXT:    %1 = load i32, ptr %0, align 4
+; CHECK-NEXT:    --> %1 U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %bb1: Variant }
+; CHECK-NEXT:    %2 = getelementptr i32, ptr %lam, i32 %i.0.reg2mem.0
+; CHECK-NEXT:    --> {(1020 + %lam),+,-4}<nw><%bb1> U: full-set S: full-set Exits: %lam LoopDispositions: { %bb1: Computable }
+; CHECK-NEXT:    %indvar.next = add nuw nsw i32 %indvar, 1
+; CHECK-NEXT:    --> {1,+,1}<nuw><nsw><%bb1> U: [1,257) S: [1,257) Exits: 256 LoopDispositions: { %bb1: Computable }
+; CHECK-NEXT:    %tmp10 = mul i32 %x, 255
+; CHECK-NEXT:    --> (255 * %x) U: full-set S: full-set
+; CHECK-NEXT:    %z.0.reg2mem.0 = add i32 %y, %x
+; CHECK-NEXT:    --> (%x + %y) U: full-set S: full-set
+; CHECK-NEXT:    %3 = add i32 %z.0.reg2mem.0, %tmp10
+; CHECK-NEXT:    --> ((256 * %x) + %y) U: full-set S: full-set
+; CHECK-NEXT:  Determining loop execution counts for: @test_loop_idiom_recogize
+; CHECK-NEXT:  Loop %bb1: backedge-taken count is 255
+; CHECK-NEXT:  Loop %bb1: constant max backedge-taken count is i32 255
+; CHECK-NEXT:  Loop %bb1: symbolic max backedge-taken count is 255
+; CHECK-NEXT:  Loop %bb1: Trip multiple is 256
+;
 bb1.thread:
 	br label %bb1
 
@@ -114,8 +190,22 @@ declare void @use(i1)
 declare void @llvm.experimental.guard(i1, ...)
 
 ; This tests getRangeRef acts as intended with 
diff erent idx size.
-; CHECK: Loop %loop: Unpredictable constant max backedge-taken count.
 define void @test_range_ref1(i8 %t) {
+; CHECK-LABEL: 'test_range_ref1'
+; CHECK-NEXT:  Classifying expressions for: @test_range_ref1
+; CHECK-NEXT:    %0 = zext i8 %t to i40
+; CHECK-NEXT:    --> (zext i8 %t to i40) U: [0,256) S: [0,256)
+; CHECK-NEXT:    %t.ptr = inttoptr i40 %0 to ptr
+; CHECK-NEXT:    --> %t.ptr U: [0,256) S: [0,256)
+; CHECK-NEXT:    %idx = phi ptr [ %t.ptr, %entry ], [ %snext, %loop ]
+; CHECK-NEXT:    --> {%t.ptr,+,1}<nuw><%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %snext = getelementptr inbounds i8, ptr %idx, i32 1
+; CHECK-NEXT:    --> {(1 + %t.ptr)<nuw><nsw>,+,1}<nw><%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @test_range_ref1
+; CHECK-NEXT:  Loop %loop: Unpredictable backedge-taken count.
+; CHECK-NEXT:  Loop %loop: Unpredictable constant max backedge-taken count.
+; CHECK-NEXT:  Loop %loop: Unpredictable symbolic max backedge-taken count.
+;
  entry:
   %t.ptr = inttoptr i8 %t to ptr
   %p.42 = inttoptr i8 42 to ptr


        


More information about the llvm-commits mailing list