[llvm] 1668ace - [tests] Expand coverage for D99687

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 20 11:31:50 PDT 2021


Author: Philip Reames
Date: 2021-04-20T11:31:39-07:00
New Revision: 1668ace9481395440685cf2192e60a44cd6e1e73

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

LOG: [tests] Expand coverage for D99687

Added: 
    

Modified: 
    llvm/test/Analysis/ScalarEvolution/shift-recurrences.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Analysis/ScalarEvolution/shift-recurrences.ll b/llvm/test/Analysis/ScalarEvolution/shift-recurrences.ll
index 962252559af1..9c8944fc7012 100644
--- a/llvm/test/Analysis/ScalarEvolution/shift-recurrences.ll
+++ b/llvm/test/Analysis/ScalarEvolution/shift-recurrences.ll
@@ -593,6 +593,36 @@ exit:
   ret void
 }
 
+define void @test_ashr_zero_shift() {
+; CHECK-LABEL: 'test_ashr_zero_shift'
+; CHECK-NEXT:  Classifying expressions for: @test_ashr_zero_shift
+; CHECK-NEXT:    %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
+; CHECK-NEXT:    --> {0,+,1}<%loop> U: [0,5) S: [0,5) Exits: 4 LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %iv.ashr = phi i64 [ 1023, %entry ], [ %iv.ashr.next, %loop ]
+; CHECK-NEXT:    --> %iv.ashr U: [0,1024) S: [0,1024) Exits: 1023 LoopDispositions: { %loop: Variant }
+; CHECK-NEXT:    %iv.next = add i64 %iv, 1
+; CHECK-NEXT:    --> {1,+,1}<%loop> U: [1,6) S: [1,6) Exits: 5 LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %iv.ashr.next = ashr i64 %iv.ashr, 0
+; CHECK-NEXT:    --> %iv.ashr U: [0,1024) S: [0,1024) Exits: 1023 LoopDispositions: { %loop: Variant }
+; CHECK-NEXT:  Determining loop execution counts for: @test_ashr_zero_shift
+; CHECK-NEXT:  Loop %loop: backedge-taken count is 4
+; CHECK-NEXT:  Loop %loop: max backedge-taken count is 4
+; CHECK-NEXT:  Loop %loop: Predicated backedge-taken count is 4
+; CHECK-NEXT:   Predicates:
+; CHECK:       Loop %loop: Trip multiple is 5
+;
+entry:
+  br label %loop
+loop:
+  %iv = phi i64 [0, %entry], [%iv.next, %loop]
+  %iv.ashr = phi i64 [1023, %entry], [%iv.ashr.next, %loop]
+  %iv.next = add i64 %iv, 1
+  %iv.ashr.next = ashr i64 %iv.ashr, 0
+  %cmp = icmp eq i64 %iv, 4
+  br i1 %cmp, label %exit, label %loop
+exit:
+  ret void
+}
 
 define void @test_lshr_tc_positive() {
 ; CHECK-LABEL: 'test_lshr_tc_positive'
@@ -689,3 +719,129 @@ loop:
 exit:
   ret void
 }
+
+define void @test_lshr_zero_shift() {
+; CHECK-LABEL: 'test_lshr_zero_shift'
+; CHECK-NEXT:  Classifying expressions for: @test_lshr_zero_shift
+; CHECK-NEXT:    %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
+; CHECK-NEXT:    --> {0,+,1}<%loop> U: [0,5) S: [0,5) Exits: 4 LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %iv.lshr = phi i64 [ 1023, %entry ], [ %iv.lshr.next, %loop ]
+; CHECK-NEXT:    --> %iv.lshr U: [0,1024) S: [0,1024) Exits: 1023 LoopDispositions: { %loop: Variant }
+; CHECK-NEXT:    %iv.next = add i64 %iv, 1
+; CHECK-NEXT:    --> {1,+,1}<%loop> U: [1,6) S: [1,6) Exits: 5 LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %iv.lshr.next = lshr i64 %iv.lshr, 0
+; CHECK-NEXT:    --> %iv.lshr U: [0,1024) S: [0,1024) Exits: 1023 LoopDispositions: { %loop: Variant }
+; CHECK-NEXT:  Determining loop execution counts for: @test_lshr_zero_shift
+; CHECK-NEXT:  Loop %loop: backedge-taken count is 4
+; CHECK-NEXT:  Loop %loop: max backedge-taken count is 4
+; CHECK-NEXT:  Loop %loop: Predicated backedge-taken count is 4
+; CHECK-NEXT:   Predicates:
+; CHECK:       Loop %loop: Trip multiple is 5
+;
+entry:
+  br label %loop
+loop:
+  %iv = phi i64 [0, %entry], [%iv.next, %loop]
+  %iv.lshr = phi i64 [1023, %entry], [%iv.lshr.next, %loop]
+  %iv.next = add i64 %iv, 1
+  %iv.lshr.next = lshr i64 %iv.lshr, 0
+  %cmp = icmp eq i64 %iv, 4
+  br i1 %cmp, label %exit, label %loop
+exit:
+  ret void
+}
+
+
+define void @test_lshr_power_of_2_start() {
+; CHECK-LABEL: 'test_lshr_power_of_2_start'
+; CHECK-NEXT:  Classifying expressions for: @test_lshr_power_of_2_start
+; CHECK-NEXT:    %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
+; CHECK-NEXT:    --> {0,+,1}<%loop> U: [0,5) S: [0,5) Exits: 4 LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %iv.lshr = phi i64 [ 1024, %entry ], [ %iv.lshr.next, %loop ]
+; CHECK-NEXT:    --> %iv.lshr U: [0,1025) S: [0,1025) Exits: 4 LoopDispositions: { %loop: Variant }
+; CHECK-NEXT:    %iv.next = add i64 %iv, 1
+; CHECK-NEXT:    --> {1,+,1}<%loop> U: [1,6) S: [1,6) Exits: 5 LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %iv.lshr.next = lshr i64 %iv.lshr, 2
+; CHECK-NEXT:    --> (%iv.lshr /u 4) U: [0,512) S: [0,512) Exits: 1 LoopDispositions: { %loop: Variant }
+; CHECK-NEXT:  Determining loop execution counts for: @test_lshr_power_of_2_start
+; CHECK-NEXT:  Loop %loop: backedge-taken count is 4
+; CHECK-NEXT:  Loop %loop: max backedge-taken count is 4
+; CHECK-NEXT:  Loop %loop: Predicated backedge-taken count is 4
+; CHECK-NEXT:   Predicates:
+; CHECK:       Loop %loop: Trip multiple is 5
+;
+entry:
+  br label %loop
+loop:
+  %iv = phi i64 [0, %entry], [%iv.next, %loop]
+  %iv.lshr = phi i64 [1024, %entry], [%iv.lshr.next, %loop]
+  %iv.next = add i64 %iv, 1
+  %iv.lshr.next = lshr i64 %iv.lshr, 2
+  %cmp = icmp eq i64 %iv, 4
+  br i1 %cmp, label %exit, label %loop
+exit:
+  ret void
+}
+
+; Starting value is chosen not to be near power of 2
+define void @test_lshr_arbitrary_start() {
+; CHECK-LABEL: 'test_lshr_arbitrary_start'
+; CHECK-NEXT:  Classifying expressions for: @test_lshr_arbitrary_start
+; CHECK-NEXT:    %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
+; CHECK-NEXT:    --> {0,+,1}<%loop> U: [0,5) S: [0,5) Exits: 4 LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %iv.lshr = phi i64 [ 957, %entry ], [ %iv.lshr.next, %loop ]
+; CHECK-NEXT:    --> %iv.lshr U: [0,958) S: [0,958) Exits: 3 LoopDispositions: { %loop: Variant }
+; CHECK-NEXT:    %iv.next = add i64 %iv, 1
+; CHECK-NEXT:    --> {1,+,1}<%loop> U: [1,6) S: [1,6) Exits: 5 LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %iv.lshr.next = lshr i64 %iv.lshr, 2
+; CHECK-NEXT:    --> (%iv.lshr /u 4) U: [0,256) S: [0,256) Exits: 0 LoopDispositions: { %loop: Variant }
+; CHECK-NEXT:  Determining loop execution counts for: @test_lshr_arbitrary_start
+; CHECK-NEXT:  Loop %loop: backedge-taken count is 4
+; CHECK-NEXT:  Loop %loop: max backedge-taken count is 4
+; CHECK-NEXT:  Loop %loop: Predicated backedge-taken count is 4
+; CHECK-NEXT:   Predicates:
+; CHECK:       Loop %loop: Trip multiple is 5
+;
+entry:
+  br label %loop
+loop:
+  %iv = phi i64 [0, %entry], [%iv.next, %loop]
+  %iv.lshr = phi i64 [957, %entry], [%iv.lshr.next, %loop]
+  %iv.next = add i64 %iv, 1
+  %iv.lshr.next = lshr i64 %iv.lshr, 2
+  %cmp = icmp eq i64 %iv, 4
+  br i1 %cmp, label %exit, label %loop
+exit:
+  ret void
+}
+
+define void @test_lshr_start_power_of_2_plus_one() {
+; CHECK-LABEL: 'test_lshr_start_power_of_2_plus_one'
+; CHECK-NEXT:  Classifying expressions for: @test_lshr_start_power_of_2_plus_one
+; CHECK-NEXT:    %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
+; CHECK-NEXT:    --> {0,+,1}<%loop> U: [0,5) S: [0,5) Exits: 4 LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %iv.lshr = phi i64 [ 1025, %entry ], [ %iv.lshr.next, %loop ]
+; CHECK-NEXT:    --> %iv.lshr U: [0,1026) S: [0,1026) Exits: 4 LoopDispositions: { %loop: Variant }
+; CHECK-NEXT:    %iv.next = add i64 %iv, 1
+; CHECK-NEXT:    --> {1,+,1}<%loop> U: [1,6) S: [1,6) Exits: 5 LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %iv.lshr.next = lshr i64 %iv.lshr, 2
+; CHECK-NEXT:    --> (%iv.lshr /u 4) U: [0,512) S: [0,512) Exits: 1 LoopDispositions: { %loop: Variant }
+; CHECK-NEXT:  Determining loop execution counts for: @test_lshr_start_power_of_2_plus_one
+; CHECK-NEXT:  Loop %loop: backedge-taken count is 4
+; CHECK-NEXT:  Loop %loop: max backedge-taken count is 4
+; CHECK-NEXT:  Loop %loop: Predicated backedge-taken count is 4
+; CHECK-NEXT:   Predicates:
+; CHECK:       Loop %loop: Trip multiple is 5
+;
+entry:
+  br label %loop
+loop:
+  %iv = phi i64 [0, %entry], [%iv.next, %loop]
+  %iv.lshr = phi i64 [1025, %entry], [%iv.lshr.next, %loop]
+  %iv.next = add i64 %iv, 1
+  %iv.lshr.next = lshr i64 %iv.lshr, 2
+  %cmp = icmp eq i64 %iv, 4
+  br i1 %cmp, label %exit, label %loop
+exit:
+  ret void
+}


        


More information about the llvm-commits mailing list