[llvm] 8df8b48 - [NFC][SCEV] Autogenerate checklines in a test to simplify further updates

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 10 14:21:59 PST 2022


Author: Roman Lebedev
Date: 2022-02-11T01:21:45+03:00
New Revision: 8df8b488e3dc956cb171ed356dcfd9a33a97ebef

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

LOG: [NFC][SCEV] Autogenerate checklines in a test to simplify further updates

Added: 
    

Modified: 
    llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info-rewrite-expressions.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info-rewrite-expressions.ll b/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info-rewrite-expressions.ll
index 34e2a71585556..3b8f4409a99bd 100644
--- a/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info-rewrite-expressions.ll
+++ b/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info-rewrite-expressions.ll
@@ -1,15 +1,26 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
 ; RUN: opt -passes='print<scalar-evolution>' -disable-output %s 2>&1 | FileCheck %s
 
 ; Test cases that require rewriting zext SCEV expression with infomration from
 ; the loop guards.
 
 define void @rewrite_zext(i32 %n) {
-; CHECK-LABEL: Determining loop execution counts for: @rewrite_zext
+; CHECK-LABEL: 'rewrite_zext'
+; CHECK-NEXT:  Classifying expressions for: @rewrite_zext
+; CHECK-NEXT:    %ext = zext i32 %n to i64
+; CHECK-NEXT:    --> (zext i32 %n to i64) U: [0,4294967296) S: [0,4294967296)
+; CHECK-NEXT:    %n.vec = and i64 %ext, -8
+; CHECK-NEXT:    --> (8 * ((zext i32 %n to i64) /u 8))<nuw><nsw> U: [0,4294967289) S: [0,4294967289)
+; CHECK-NEXT:    %index = phi i64 [ 0, %check ], [ %index.next, %loop ]
+; CHECK-NEXT:    --> {0,+,8}<nuw><nsw><%loop> U: [0,17) S: [0,17) Exits: (8 * ((-8 + (8 * ((zext i32 %n to i64) /u 8))<nuw><nsw>)<nsw> /u 8))<nuw> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %index.next = add nuw nsw i64 %index, 8
+; CHECK-NEXT:    --> {8,+,8}<nuw><nsw><%loop> U: [8,25) S: [8,25) Exits: (8 + (8 * ((-8 + (8 * ((zext i32 %n to i64) /u 8))<nuw><nsw>)<nsw> /u 8))<nuw>) LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @rewrite_zext
 ; CHECK-NEXT:  Loop %loop: backedge-taken count is ((-8 + (8 * ((zext i32 %n to i64) /u 8))<nuw><nsw>)<nsw> /u 8)
 ; CHECK-NEXT:  Loop %loop: max backedge-taken count is 2
 ; CHECK-NEXT:  Loop %loop: Predicated backedge-taken count is ((-8 + (8 * ((zext i32 %n to i64) /u 8))<nuw><nsw>)<nsw> /u 8)
-; CHECK-NEXT:  Predicates:
-; CHECK:        Loop %loop: Trip multiple is 1
+; CHECK-NEXT:   Predicates:
+; CHECK:       Loop %loop: Trip multiple is 1
 ;
 entry:
   %ext = zext i32 %n to i64
@@ -33,12 +44,26 @@ exit:
 
 ; Test case from PR40961.
 define i32 @rewrite_zext_min_max(i32 %N, i32* %arr) {
-; CHECK-LABEL:  Determining loop execution counts for: @rewrite_zext_min_max
-; CHECK-NEXT:   Loop %loop: backedge-taken count is ((-4 + (4 * ((zext i32 (16 umin %N) to i64) /u 4))<nuw><nsw>)<nsw> /u 4)
-; CHECK-NEXT:   Loop %loop: max backedge-taken count is 3
-; CHECK-NEXT:   Loop %loop: Predicated backedge-taken count is ((-4 + (4 * ((zext i32 (16 umin %N) to i64) /u 4))<nuw><nsw>)<nsw> /u 4)
+; CHECK-LABEL: 'rewrite_zext_min_max'
+; CHECK-NEXT:  Classifying expressions for: @rewrite_zext_min_max
+; CHECK-NEXT:    %umin = call i32 @llvm.umin.i32(i32 %N, i32 16)
+; CHECK-NEXT:    --> (16 umin %N) U: [0,17) S: [0,17)
+; CHECK-NEXT:    %ext = zext i32 %umin to i64
+; CHECK-NEXT:    --> (zext i32 (16 umin %N) to i64) U: [0,17) S: [0,17)
+; CHECK-NEXT:    %n.vec = and i64 %ext, 28
+; CHECK-NEXT:    --> (4 * ((zext i32 (16 umin %N) to i64) /u 4))<nuw><nsw> U: [0,17) S: [0,17)
+; CHECK-NEXT:    %index = phi i64 [ 0, %loop.ph ], [ %index.next, %loop ]
+; CHECK-NEXT:    --> {0,+,4}<nuw><%loop> U: [0,13) S: [0,13) Exits: (4 * ((-4 + (4 * ((zext i32 (16 umin %N) to i64) /u 4))<nuw><nsw>)<nsw> /u 4))<nuw> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %gep = getelementptr inbounds i32, i32* %arr, i64 %index
+; CHECK-NEXT:    --> {%arr,+,16}<nuw><%loop> U: full-set S: full-set Exits: ((16 * ((-4 + (4 * ((zext i32 (16 umin %N) to i64) /u 4))<nuw><nsw>)<nsw> /u 4)) + %arr) LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %index.next = add nuw i64 %index, 4
+; CHECK-NEXT:    --> {4,+,4}<nuw><%loop> U: [4,17) S: [4,17) Exits: (4 + (4 * ((-4 + (4 * ((zext i32 (16 umin %N) to i64) /u 4))<nuw><nsw>)<nsw> /u 4))<nuw>) LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @rewrite_zext_min_max
+; CHECK-NEXT:  Loop %loop: backedge-taken count is ((-4 + (4 * ((zext i32 (16 umin %N) to i64) /u 4))<nuw><nsw>)<nsw> /u 4)
+; CHECK-NEXT:  Loop %loop: max backedge-taken count is 3
+; CHECK-NEXT:  Loop %loop: Predicated backedge-taken count is ((-4 + (4 * ((zext i32 (16 umin %N) to i64) /u 4))<nuw><nsw>)<nsw> /u 4)
 ; CHECK-NEXT:   Predicates:
-; CHECK:         Loop %loop: Trip multiple is 1
+; CHECK:       Loop %loop: Trip multiple is 1
 ;
 entry:
   %umin = call i32 @llvm.umin.i32(i32 %N, i32 16)
@@ -66,13 +91,28 @@ exit:
 ; Test case from PR52464. applyLoopGuards needs to apply information about %and
 ; to %ext, which requires rewriting the zext.
 define i32 @rewrite_zext_with_info_from_icmp_ne(i32 %N) {
-; CHECK-LABEL: Determining loop execution counts for: @rewrite_zext_with_info_from_icmp_ne
+; CHECK-LABEL: 'rewrite_zext_with_info_from_icmp_ne'
+; CHECK-NEXT:  Classifying expressions for: @rewrite_zext_with_info_from_icmp_ne
+; CHECK-NEXT:    %and = and i32 %N, 3
+; CHECK-NEXT:    --> (zext i2 (trunc i32 %N to i2) to i32) U: [0,4) S: [0,4)
+; CHECK-NEXT:    %and.sub.1 = add nsw i32 %and, -1
+; CHECK-NEXT:    --> (-1 + (zext i2 (trunc i32 %N to i2) to i32))<nsw> U: [-1,3) S: [-1,3)
+; CHECK-NEXT:    %ext = zext i32 %and.sub.1 to i64
+; CHECK-NEXT:    --> (zext i32 (-1 + (zext i2 (trunc i32 %N to i2) to i32))<nsw> to i64) U: [0,4294967296) S: [0,4294967296)
+; CHECK-NEXT:    %n.rnd.up = add nuw nsw i64 %ext, 4
+; CHECK-NEXT:    --> (4 + (zext i32 (-1 + (zext i2 (trunc i32 %N to i2) to i32))<nsw> to i64))<nuw><nsw> U: [4,4294967300) S: [4,4294967300)
+; CHECK-NEXT:    %n.vec = and i64 %n.rnd.up, 8589934588
+; CHECK-NEXT:    --> (4 * ((4 + (zext i32 (-1 + (zext i2 (trunc i32 %N to i2) to i32))<nsw> to i64))<nuw><nsw> /u 4))<nuw><nsw> U: [4,4294967297) S: [4,4294967297)
+; CHECK-NEXT:    %iv = phi i64 [ 0, %loop.ph ], [ %iv.next, %loop ]
+; CHECK-NEXT:    --> {0,+,4}<%loop> U: [0,1) S: [0,1) Exits: 0 LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %iv.next = add i64 %iv, 4
+; CHECK-NEXT:    --> {4,+,4}<%loop> U: [4,5) S: [4,5) Exits: 4 LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @rewrite_zext_with_info_from_icmp_ne
 ; CHECK-NEXT:  Loop %loop: backedge-taken count is 0
 ; CHECK-NEXT:  Loop %loop: max backedge-taken count is 0
 ; CHECK-NEXT:  Loop %loop: Predicated backedge-taken count is 0
 ; CHECK-NEXT:   Predicates:
-; CHECK-EMPTY:
-; CHECK-NEXT:  Loop %loop: Trip multiple is 1
+; CHECK:       Loop %loop: Trip multiple is 1
 ;
 entry:
   %and = and i32 %N, 3
@@ -100,13 +140,28 @@ exit:
 ; Similar to @rewrite_zext_with_info_from_icmp_ne, but the loop is not guarded by %and != 0,
 ; hence the subsequent subtraction may yield a negative number.
 define i32 @rewrite_zext_no_icmp_ne(i32 %N) {
-; CHECK-LABEL: Determining loop execution counts for: @rewrite_zext_no_icmp_ne
+; CHECK-LABEL: 'rewrite_zext_no_icmp_ne'
+; CHECK-NEXT:  Classifying expressions for: @rewrite_zext_no_icmp_ne
+; CHECK-NEXT:    %and = and i32 %N, 3
+; CHECK-NEXT:    --> (zext i2 (trunc i32 %N to i2) to i32) U: [0,4) S: [0,4)
+; CHECK-NEXT:    %and.sub.1 = add nsw i32 %and, -1
+; CHECK-NEXT:    --> (-1 + (zext i2 (trunc i32 %N to i2) to i32))<nsw> U: [-1,3) S: [-1,3)
+; CHECK-NEXT:    %ext = zext i32 %and.sub.1 to i64
+; CHECK-NEXT:    --> (zext i32 (-1 + (zext i2 (trunc i32 %N to i2) to i32))<nsw> to i64) U: [0,4294967296) S: [0,4294967296)
+; CHECK-NEXT:    %n.rnd.up = add nuw nsw i64 %ext, 4
+; CHECK-NEXT:    --> (4 + (zext i32 (-1 + (zext i2 (trunc i32 %N to i2) to i32))<nsw> to i64))<nuw><nsw> U: [4,4294967300) S: [4,4294967300)
+; CHECK-NEXT:    %n.vec = and i64 %n.rnd.up, 8589934588
+; CHECK-NEXT:    --> (4 * ((4 + (zext i32 (-1 + (zext i2 (trunc i32 %N to i2) to i32))<nsw> to i64))<nuw><nsw> /u 4))<nuw><nsw> U: [4,4294967297) S: [4,4294967297)
+; CHECK-NEXT:    %iv = phi i64 [ 0, %loop.ph ], [ %iv.next, %loop ]
+; CHECK-NEXT:    --> {0,+,4}<%loop> U: [0,4294967293) S: [0,4294967293) Exits: (4 * ((-4 + (4 * ((4 + (zext i32 (-1 + (zext i2 (trunc i32 %N to i2) to i32))<nsw> to i64))<nuw><nsw> /u 4))<nuw><nsw>)<nsw> /u 4))<nuw><nsw> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %iv.next = add i64 %iv, 4
+; CHECK-NEXT:    --> {4,+,4}<%loop> U: [4,4294967297) S: [4,4294967297) Exits: (4 + (4 * ((-4 + (4 * ((4 + (zext i32 (-1 + (zext i2 (trunc i32 %N to i2) to i32))<nsw> to i64))<nuw><nsw> /u 4))<nuw><nsw>)<nsw> /u 4))<nuw><nsw>)<nuw><nsw> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @rewrite_zext_no_icmp_ne
 ; CHECK-NEXT:  Loop %loop: backedge-taken count is ((-4 + (4 * ((4 + (zext i32 (-1 + (zext i2 (trunc i32 %N to i2) to i32))<nsw> to i64))<nuw><nsw> /u 4))<nuw><nsw>)<nsw> /u 4)
 ; CHECK-NEXT:  Loop %loop: max backedge-taken count is 1073741823
 ; CHECK-NEXT:  Loop %loop: Predicated backedge-taken count is ((-4 + (4 * ((4 + (zext i32 (-1 + (zext i2 (trunc i32 %N to i2) to i32))<nsw> to i64))<nuw><nsw> /u 4))<nuw><nsw>)<nsw> /u 4)
 ; CHECK-NEXT:   Predicates:
-; CHECK-EMPTY:
-; CHECK-NEXT:  Loop %loop: Trip multiple is 1
+; CHECK:       Loop %loop: Trip multiple is 1
 ;
 entry:
   %and = and i32 %N, 3
@@ -132,12 +187,22 @@ exit:
 
 ; Make sure no information is lost for conditions on both %n and (zext %n).
 define void @rewrite_zext_and_base_1(i32 %n) {
-; CHECK-LABEL: Determining loop execution counts for: @rewrite_zext_and_base
+; CHECK-LABEL: 'rewrite_zext_and_base_1'
+; CHECK-NEXT:  Classifying expressions for: @rewrite_zext_and_base_1
+; CHECK-NEXT:    %ext = zext i32 %n to i64
+; CHECK-NEXT:    --> (zext i32 %n to i64) U: [0,4294967296) S: [0,4294967296)
+; CHECK-NEXT:    %n.vec = and i64 %ext, -8
+; CHECK-NEXT:    --> (8 * ((zext i32 %n to i64) /u 8))<nuw><nsw> U: [0,4294967289) S: [0,4294967289)
+; CHECK-NEXT:    %index = phi i64 [ 0, %check ], [ %index.next, %loop ]
+; CHECK-NEXT:    --> {0,+,8}<nuw><nsw><%loop> U: [0,25) S: [0,25) Exits: (8 * ((-8 + (8 * ((zext i32 %n to i64) /u 8))<nuw><nsw>)<nsw> /u 8))<nuw> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %index.next = add nuw nsw i64 %index, 8
+; CHECK-NEXT:    --> {8,+,8}<nuw><nsw><%loop> U: [8,33) S: [8,33) Exits: (8 + (8 * ((-8 + (8 * ((zext i32 %n to i64) /u 8))<nuw><nsw>)<nsw> /u 8))<nuw>) LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @rewrite_zext_and_base_1
 ; CHECK-NEXT:  Loop %loop: backedge-taken count is ((-8 + (8 * ((zext i32 %n to i64) /u 8))<nuw><nsw>)<nsw> /u 8)
 ; CHECK-NEXT:  Loop %loop: max backedge-taken count is 3
 ; CHECK-NEXT:  Loop %loop: Predicated backedge-taken count is ((-8 + (8 * ((zext i32 %n to i64) /u 8))<nuw><nsw>)<nsw> /u 8)
-; CHECK-NEXT:  Predicates:
-; CHECK:        Loop %loop: Trip multiple is 1
+; CHECK-NEXT:   Predicates:
+; CHECK:       Loop %loop: Trip multiple is 1
 ;
 entry:
   %ext = zext i32 %n to i64
@@ -166,12 +231,22 @@ exit:
 
 ; Make sure no information is lost for conditions on both %n and (zext %n).
 define void @rewrite_zext_and_base_2(i32 %n) {
-; CHECK-LABEL: Determining loop execution counts for: @rewrite_zext_and_base
+; CHECK-LABEL: 'rewrite_zext_and_base_2'
+; CHECK-NEXT:  Classifying expressions for: @rewrite_zext_and_base_2
+; CHECK-NEXT:    %ext = zext i32 %n to i64
+; CHECK-NEXT:    --> (zext i32 %n to i64) U: [0,4294967296) S: [0,4294967296)
+; CHECK-NEXT:    %n.vec = and i64 %ext, -8
+; CHECK-NEXT:    --> (8 * ((zext i32 %n to i64) /u 8))<nuw><nsw> U: [0,4294967289) S: [0,4294967289)
+; CHECK-NEXT:    %index = phi i64 [ 0, %check ], [ %index.next, %loop ]
+; CHECK-NEXT:    --> {0,+,8}<nuw><nsw><%loop> U: [0,25) S: [0,25) Exits: (8 * ((-8 + (8 * ((zext i32 %n to i64) /u 8))<nuw><nsw>)<nsw> /u 8))<nuw> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %index.next = add nuw nsw i64 %index, 8
+; CHECK-NEXT:    --> {8,+,8}<nuw><nsw><%loop> U: [8,33) S: [8,33) Exits: (8 + (8 * ((-8 + (8 * ((zext i32 %n to i64) /u 8))<nuw><nsw>)<nsw> /u 8))<nuw>) LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @rewrite_zext_and_base_2
 ; CHECK-NEXT:  Loop %loop: backedge-taken count is ((-8 + (8 * ((zext i32 %n to i64) /u 8))<nuw><nsw>)<nsw> /u 8)
 ; CHECK-NEXT:  Loop %loop: max backedge-taken count is 3
 ; CHECK-NEXT:  Loop %loop: Predicated backedge-taken count is ((-8 + (8 * ((zext i32 %n to i64) /u 8))<nuw><nsw>)<nsw> /u 8)
-; CHECK-NEXT:  Predicates:
-; CHECK:        Loop %loop: Trip multiple is 1
+; CHECK-NEXT:   Predicates:
+; CHECK:       Loop %loop: Trip multiple is 1
 ;
 entry:
   %ext = zext i32 %n to i64
@@ -199,13 +274,21 @@ exit:
 
 define void @guard_pessimizes_analysis_step2(i1 %c, i32 %N) {
 ; CHECK-LABEL: 'guard_pessimizes_analysis_step2'
-; CHECK:       Determining loop execution counts for: @guard_pessimizes_analysis_step2
+; CHECK-NEXT:  Classifying expressions for: @guard_pessimizes_analysis_step2
+; CHECK-NEXT:    %N.ext = zext i32 %N to i64
+; CHECK-NEXT:    --> (zext i32 %N to i64) U: [0,4294967296) S: [0,4294967296)
+; CHECK-NEXT:    %init = phi i64 [ 2, %entry ], [ 4, %bb1 ]
+; CHECK-NEXT:    --> %init U: [2,5) S: [2,5)
+; CHECK-NEXT:    %iv = phi i64 [ %iv.next, %loop ], [ %init, %loop.ph ]
+; CHECK-NEXT:    --> {%init,+,2}<%loop> U: [2,17) S: [2,17) Exits: ((2 * ((14 + (-1 * %init)<nsw>)<nsw> /u 2))<nuw><nsw> + %init) LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %iv.next = add i64 %iv, 2
+; CHECK-NEXT:    --> {(2 + %init)<nuw><nsw>,+,2}<%loop> U: [4,19) S: [4,19) Exits: (2 + (2 * ((14 + (-1 * %init)<nsw>)<nsw> /u 2))<nuw><nsw> + %init) LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @guard_pessimizes_analysis_step2
 ; CHECK-NEXT:  Loop %loop: backedge-taken count is ((14 + (-1 * %init)<nsw>)<nsw> /u 2)
 ; CHECK-NEXT:  Loop %loop: max backedge-taken count is 6
 ; CHECK-NEXT:  Loop %loop: Predicated backedge-taken count is ((14 + (-1 * %init)<nsw>)<nsw> /u 2)
 ; CHECK-NEXT:   Predicates:
-; CHECK-EMPTY:
-; CHECK-NEXT:  Loop %loop: Trip multiple is 1
+; CHECK:       Loop %loop: Trip multiple is 1
 ;
 entry:
   %N.ext = zext i32 %N to i64


        


More information about the llvm-commits mailing list