[llvm] SCEV: regen some tests with UTC (NFC) (PR #123050)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 05:04:43 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-analysis

Author: Ramkumar Ramachandra (artagnon)

<details>
<summary>Changes</summary>



---

Patch is 41.59 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/123050.diff


4 Files Affected:

- (modified) llvm/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll (+28-15) 
- (modified) llvm/test/Analysis/ScalarEvolution/implied-via-addition.ll (+40-12) 
- (modified) llvm/test/Analysis/ScalarEvolution/implied-via-division.ll (+242-33) 
- (modified) llvm/test/Analysis/ScalarEvolution/infer-prestart-no-wrap.ll (+99-16) 


``````````diff
diff --git a/llvm/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll b/llvm/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll
index 22404b102a73f0..43f5b95e19b502 100644
--- a/llvm/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll
+++ b/llvm/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll
@@ -1,32 +1,45 @@
-; 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 5
+; RUN: opt < %s -passes="print<scalar-evolution>" -disable-output 2>&1 | FileCheck %s
 ; PR1597
 
-; CHECK: Loop %bb: backedge-taken count is (-1 + (-1 * %x) + %y)
-
 define i32 @f(i32 %x, i32 %y) {
+; CHECK-LABEL: 'f'
+; CHECK-NEXT:  Classifying expressions for: @f
+; CHECK-NEXT:    %x_addr.0 = phi i32 [ %tmp2, %bb3 ], [ %x, %bb.preheader ]
+; CHECK-NEXT:    --> {%x,+,1}<%bb> U: full-set S: full-set Exits: (-1 + %y) LoopDispositions: { %bb: Computable }
+; CHECK-NEXT:    %tmp2 = add i32 %x_addr.0, 1
+; CHECK-NEXT:    --> {(1 + %x),+,1}<%bb> U: full-set S: full-set Exits: %y LoopDispositions: { %bb: Computable }
+; CHECK-NEXT:    %x_addr.1 = phi i32 [ %x, %entry ], [ %tmp2, %bb8.loopexit ]
+; CHECK-NEXT:    --> %x_addr.1 U: full-set S: full-set
+; CHECK-NEXT:  Determining loop execution counts for: @f
+; CHECK-NEXT:  Loop %bb: backedge-taken count is (-1 + (-1 * %x) + %y)
+; CHECK-NEXT:  Loop %bb: constant max backedge-taken count is i32 -1
+; CHECK-NEXT:  Loop %bb: symbolic max backedge-taken count is (-1 + (-1 * %x) + %y)
+; CHECK-NEXT:  Loop %bb: Trip multiple is 1
+;
 entry:
-        %tmp63 = icmp ult i32 %x, %y            ; <i1> [#uses=1]
-        br i1 %tmp63, label %bb.preheader, label %bb8
+  %tmp63 = icmp ult i32 %x, %y            ; <i1> [#uses=1]
+  br i1 %tmp63, label %bb.preheader, label %bb8
 
 bb.preheader:           ; preds = %entry
-        br label %bb
+  br label %bb
 
 bb:             ; preds = %bb3, %bb.preheader
-        %x_addr.0 = phi i32 [ %tmp2, %bb3 ], [ %x, %bb.preheader ]              ; <i32> [#uses=1]
-        %tmp2 = add i32 %x_addr.0, 1            ; <i32> [#uses=3]
-        br label %bb3
+  %x_addr.0 = phi i32 [ %tmp2, %bb3 ], [ %x, %bb.preheader ]              ; <i32> [#uses=1]
+  %tmp2 = add i32 %x_addr.0, 1            ; <i32> [#uses=3]
+  br label %bb3
 
 bb3:            ; preds = %bb
-        %tmp6 = icmp ult i32 %tmp2, %y          ; <i1> [#uses=1]
-        br i1 %tmp6, label %bb, label %bb8.loopexit
+  %tmp6 = icmp ult i32 %tmp2, %y          ; <i1> [#uses=1]
+  br i1 %tmp6, label %bb, label %bb8.loopexit
 
 bb8.loopexit:           ; preds = %bb3
-        br label %bb8
+  br label %bb8
 
 bb8:            ; preds = %bb8.loopexit, %entry
-        %x_addr.1 = phi i32 [ %x, %entry ], [ %tmp2, %bb8.loopexit ]            ; <i32> [#uses=1]
-        br label %return
+  %x_addr.1 = phi i32 [ %x, %entry ], [ %tmp2, %bb8.loopexit ]            ; <i32> [#uses=1]
+  br label %return
 
 return:         ; preds = %bb8
-        ret i32 %x_addr.1
+  ret i32 %x_addr.1
 }
diff --git a/llvm/test/Analysis/ScalarEvolution/implied-via-addition.ll b/llvm/test/Analysis/ScalarEvolution/implied-via-addition.ll
index 4a0ebf810568e0..865c10e3913aad 100644
--- a/llvm/test/Analysis/ScalarEvolution/implied-via-addition.ll
+++ b/llvm/test/Analysis/ScalarEvolution/implied-via-addition.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
 ; RUN: opt -passes=indvars -S < %s | FileCheck %s
 
 declare void @use(i1)
@@ -5,46 +6,73 @@ declare void @use(i1)
 declare void @llvm.experimental.guard(i1, ...)
 
 define void @test_01(i8 %t) {
-; CHECK-LABEL: test_01
- entry:
+; CHECK-LABEL: define void @test_01(
+; CHECK-SAME: i8 [[T:%.*]]) {
+; CHECK-NEXT:  [[ENTRY:.*]]:
+; CHECK-NEXT:    [[ST:%.*]] = sext i8 [[T]] to i16
+; CHECK-NEXT:    [[CMP1:%.*]] = icmp slt i16 [[ST]], 42
+; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[CMP1]]) [ "deopt"() ]
+; CHECK-NEXT:    br label %[[LOOP:.*]]
+; CHECK:       [[LOOP]]:
+; CHECK-NEXT:    [[IDX:%.*]] = phi i8 [ [[T]], %[[ENTRY]] ], [ [[IDX_INC:%.*]], %[[LOOP]] ]
+; CHECK-NEXT:    [[IDX_INC]] = add nsw i8 [[IDX]], 1
+; CHECK-NEXT:    call void @use(i1 true)
+; CHECK-NEXT:    [[BE:%.*]] = icmp slt i8 [[IDX_INC]], 42
+; CHECK-NEXT:    br i1 [[BE]], label %[[LOOP]], label %[[EXIT:.*]]
+; CHECK:       [[EXIT]]:
+; CHECK-NEXT:    ret void
+;
+  entry:
   %st = sext i8 %t to i16
   %cmp1 = icmp slt i16 %st, 42
   call void(i1, ...) @llvm.experimental.guard(i1 %cmp1) [ "deopt"() ]
   br label %loop
 
- loop:
-; CHECK-LABEL: loop
+  loop:
   %idx = phi i8 [ %t, %entry ], [ %idx.inc, %loop ]
   %idx.inc = add i8 %idx, 1
   %c = icmp slt i8 %idx, 42
-; CHECK: call void @use(i1 true)
   call void @use(i1 %c)
   %be = icmp slt i8 %idx.inc, 42
   br i1 %be, label %loop, label %exit
 
- exit:
+  exit:
   ret void
 }
 
 define void @test_02(i8 %t) {
-; CHECK-LABEL: test_02
- entry:
+; CHECK-LABEL: define void @test_02(
+; CHECK-SAME: i8 [[T:%.*]]) {
+; CHECK-NEXT:  [[ENTRY:.*]]:
+; CHECK-NEXT:    [[T_PTR:%.*]] = inttoptr i8 [[T]] to ptr
+; CHECK-NEXT:    [[P_42:%.*]] = inttoptr i8 42 to ptr
+; CHECK-NEXT:    [[CMP1:%.*]] = icmp slt ptr [[T_PTR]], [[P_42]]
+; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[CMP1]]) [ "deopt"() ]
+; CHECK-NEXT:    br label %[[LOOP:.*]]
+; CHECK:       [[LOOP]]:
+; CHECK-NEXT:    [[IDX:%.*]] = phi ptr [ [[T_PTR]], %[[ENTRY]] ], [ [[SNEXT:%.*]], %[[LOOP]] ]
+; CHECK-NEXT:    [[SNEXT]] = getelementptr inbounds i8, ptr [[IDX]], i64 1
+; CHECK-NEXT:    call void @use(i1 true)
+; CHECK-NEXT:    [[BE:%.*]] = icmp ult ptr [[SNEXT]], [[P_42]]
+; CHECK-NEXT:    br i1 [[BE]], label %[[LOOP]], label %[[EXIT:.*]]
+; CHECK:       [[EXIT]]:
+; CHECK-NEXT:    ret void
+;
+  entry:
   %t.ptr = inttoptr i8 %t to ptr
   %p.42 = inttoptr i8 42 to ptr
   %cmp1 = icmp slt ptr %t.ptr, %p.42
   call void(i1, ...) @llvm.experimental.guard(i1 %cmp1) [ "deopt"() ]
   br label %loop
 
- loop:
-; CHECK-LABEL: loop
+  loop:
   %idx = phi ptr [ %t.ptr, %entry ], [ %snext, %loop ]
   %snext = getelementptr inbounds i8, ptr %idx, i64 1
   %c = icmp slt ptr %idx, %p.42
-; CHECK: call void @use(i1 true)
   call void @use(i1 %c)
   %be = icmp slt ptr %snext, %p.42
   br i1 %be, label %loop, label %exit
 
- exit:
+  exit:
   ret void
 }
diff --git a/llvm/test/Analysis/ScalarEvolution/implied-via-division.ll b/llvm/test/Analysis/ScalarEvolution/implied-via-division.ll
index 6d38f510c4997b..b4e6076a34cd36 100644
--- a/llvm/test/Analysis/ScalarEvolution/implied-via-division.ll
+++ b/llvm/test/Analysis/ScalarEvolution/implied-via-division.ll
@@ -1,11 +1,24 @@
-; 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 5
+; RUN: opt < %s -disable-output -passes="print<scalar-evolution>" 2>&1 | FileCheck %s
 
 declare void @llvm.experimental.guard(i1, ...)
 
 define void @test_1(i32 %n) nounwind {
 ; Prove that (n > 1) ===> (n / 2 > 0).
-; CHECK:         Determining loop execution counts for: @test_1
-; CHECK:         Loop %header: backedge-taken count is (-1 + %n.div.2)<nsw>
+; CHECK-LABEL: 'test_1'
+; CHECK-NEXT:  Classifying expressions for: @test_1
+; CHECK-NEXT:    %n.div.2 = sdiv i32 %n, 2
+; CHECK-NEXT:    --> %n.div.2 U: [-1073741824,1073741824) S: [-1073741824,1073741824)
+; CHECK-NEXT:    %indvar = phi i32 [ %indvar.next, %header ], [ 0, %entry ]
+; CHECK-NEXT:    --> {0,+,1}<nuw><nsw><%header> U: [0,1073741823) S: [0,1073741823) Exits: (-1 + %n.div.2)<nsw> LoopDispositions: { %header: Computable }
+; CHECK-NEXT:    %indvar.next = add i32 %indvar, 1
+; CHECK-NEXT:    --> {1,+,1}<nuw><nsw><%header> U: [1,1073741824) S: [1,1073741824) Exits: %n.div.2 LoopDispositions: { %header: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @test_1
+; CHECK-NEXT:  Loop %header: backedge-taken count is (-1 + %n.div.2)<nsw>
+; CHECK-NEXT:  Loop %header: constant max backedge-taken count is i32 1073741822
+; CHECK-NEXT:  Loop %header: symbolic max backedge-taken count is (-1 + %n.div.2)<nsw>
+; CHECK-NEXT:  Loop %header: Trip multiple is 1
+;
 entry:
   %cmp1 = icmp sgt i32 %n, 1
   %n.div.2 = sdiv i32 %n, 2
@@ -24,8 +37,20 @@ exit:
 
 define void @test_1neg(i32 %n) nounwind {
 ; Prove that (n > 0) =\=> (n / 2 > 0).
-; CHECK:         Determining loop execution counts for: @test_1neg
-; CHECK:         Loop %header: backedge-taken count is (-1 + (1 smax %n.div.2))<nsw>
+; CHECK-LABEL: 'test_1neg'
+; CHECK-NEXT:  Classifying expressions for: @test_1neg
+; CHECK-NEXT:    %n.div.2 = sdiv i32 %n, 2
+; CHECK-NEXT:    --> %n.div.2 U: [-1073741824,1073741824) S: [-1073741824,1073741824)
+; CHECK-NEXT:    %indvar = phi i32 [ %indvar.next, %header ], [ 0, %entry ]
+; CHECK-NEXT:    --> {0,+,1}<nuw><nsw><%header> U: [0,1073741823) S: [0,1073741823) Exits: (-1 + (1 smax %n.div.2))<nsw> LoopDispositions: { %header: Computable }
+; CHECK-NEXT:    %indvar.next = add i32 %indvar, 1
+; CHECK-NEXT:    --> {1,+,1}<nuw><nsw><%header> U: [1,1073741824) S: [1,1073741824) Exits: (1 smax %n.div.2) LoopDispositions: { %header: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @test_1neg
+; CHECK-NEXT:  Loop %header: backedge-taken count is (-1 + (1 smax %n.div.2))<nsw>
+; CHECK-NEXT:  Loop %header: constant max backedge-taken count is i32 1073741822
+; CHECK-NEXT:  Loop %header: symbolic max backedge-taken count is (-1 + (1 smax %n.div.2))<nsw>
+; CHECK-NEXT:  Loop %header: Trip multiple is 1
+;
 entry:
   %cmp1 = icmp sgt i32 %n, 0
   %n.div.2 = sdiv i32 %n, 2
@@ -44,8 +69,20 @@ exit:
 
 define void @test_2(i32 %n) nounwind {
 ; Prove that (n >= 2) ===> (n / 2 > 0).
-; CHECK:         Determining loop execution counts for: @test_2
-; CHECK:         Loop %header: backedge-taken count is (-1 + %n.div.2)<nsw>
+; CHECK-LABEL: 'test_2'
+; CHECK-NEXT:  Classifying expressions for: @test_2
+; CHECK-NEXT:    %n.div.2 = sdiv i32 %n, 2
+; CHECK-NEXT:    --> %n.div.2 U: [-1073741824,1073741824) S: [-1073741824,1073741824)
+; CHECK-NEXT:    %indvar = phi i32 [ %indvar.next, %header ], [ 0, %entry ]
+; CHECK-NEXT:    --> {0,+,1}<nuw><nsw><%header> U: [0,1073741823) S: [0,1073741823) Exits: (-1 + %n.div.2)<nsw> LoopDispositions: { %header: Computable }
+; CHECK-NEXT:    %indvar.next = add i32 %indvar, 1
+; CHECK-NEXT:    --> {1,+,1}<nuw><nsw><%header> U: [1,1073741824) S: [1,1073741824) Exits: %n.div.2 LoopDispositions: { %header: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @test_2
+; CHECK-NEXT:  Loop %header: backedge-taken count is (-1 + %n.div.2)<nsw>
+; CHECK-NEXT:  Loop %header: constant max backedge-taken count is i32 1073741822
+; CHECK-NEXT:  Loop %header: symbolic max backedge-taken count is (-1 + %n.div.2)<nsw>
+; CHECK-NEXT:  Loop %header: Trip multiple is 1
+;
 entry:
   %cmp1 = icmp sge i32 %n, 2
   %n.div.2 = sdiv i32 %n, 2
@@ -64,8 +101,20 @@ exit:
 
 define void @test_2neg(i32 %n) nounwind {
 ; Prove that (n >= 1) =\=> (n / 2 > 0).
-; CHECK:         Determining loop execution counts for: @test_2neg
-; CHECK:         Loop %header: backedge-taken count is (-1 + (1 smax %n.div.2))<nsw>
+; CHECK-LABEL: 'test_2neg'
+; CHECK-NEXT:  Classifying expressions for: @test_2neg
+; CHECK-NEXT:    %n.div.2 = sdiv i32 %n, 2
+; CHECK-NEXT:    --> %n.div.2 U: [-1073741824,1073741824) S: [-1073741824,1073741824)
+; CHECK-NEXT:    %indvar = phi i32 [ %indvar.next, %header ], [ 0, %entry ]
+; CHECK-NEXT:    --> {0,+,1}<nuw><nsw><%header> U: [0,1073741823) S: [0,1073741823) Exits: (-1 + (1 smax %n.div.2))<nsw> LoopDispositions: { %header: Computable }
+; CHECK-NEXT:    %indvar.next = add i32 %indvar, 1
+; CHECK-NEXT:    --> {1,+,1}<nuw><nsw><%header> U: [1,1073741824) S: [1,1073741824) Exits: (1 smax %n.div.2) LoopDispositions: { %header: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @test_2neg
+; CHECK-NEXT:  Loop %header: backedge-taken count is (-1 + (1 smax %n.div.2))<nsw>
+; CHECK-NEXT:  Loop %header: constant max backedge-taken count is i32 1073741822
+; CHECK-NEXT:  Loop %header: symbolic max backedge-taken count is (-1 + (1 smax %n.div.2))<nsw>
+; CHECK-NEXT:  Loop %header: Trip multiple is 1
+;
 entry:
   %cmp1 = icmp sge i32 %n, 1
   %n.div.2 = sdiv i32 %n, 2
@@ -84,8 +133,20 @@ exit:
 
 define void @test_3(i32 %n) nounwind {
 ; Prove that (n > -2) ===> (n / 2 >= 0).
-; CHECK:         Determining loop execution counts for: @test_3
-; CHECK:         Loop %header: backedge-taken count is (1 + %n.div.2)<nsw>
+; CHECK-LABEL: 'test_3'
+; CHECK-NEXT:  Classifying expressions for: @test_3
+; CHECK-NEXT:    %n.div.2 = sdiv i32 %n, 2
+; CHECK-NEXT:    --> %n.div.2 U: [-1073741824,1073741824) S: [-1073741824,1073741824)
+; CHECK-NEXT:    %indvar = phi i32 [ %indvar.next, %header ], [ 0, %entry ]
+; CHECK-NEXT:    --> {0,+,1}<nuw><nsw><%header> U: [0,1073741825) S: [0,1073741825) Exits: (1 + %n.div.2)<nsw> LoopDispositions: { %header: Computable }
+; CHECK-NEXT:    %indvar.next = add i32 %indvar, 1
+; CHECK-NEXT:    --> {1,+,1}<nuw><nsw><%header> U: [1,1073741826) S: [1,1073741826) Exits: (2 + %n.div.2)<nsw> LoopDispositions: { %header: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @test_3
+; CHECK-NEXT:  Loop %header: backedge-taken count is (1 + %n.div.2)<nsw>
+; CHECK-NEXT:  Loop %header: constant max backedge-taken count is i32 1073741824
+; CHECK-NEXT:  Loop %header: symbolic max backedge-taken count is (1 + %n.div.2)<nsw>
+; CHECK-NEXT:  Loop %header: Trip multiple is 1
+;
 entry:
   %cmp1 = icmp sgt i32 %n, -2
   %n.div.2 = sdiv i32 %n, 2
@@ -104,8 +165,20 @@ exit:
 
 define void @test_3neg(i32 %n) nounwind {
 ; Prove that (n > -3) =\=> (n / 2 >= 0).
-; CHECK:         Determining loop execution counts for: @test_3neg
-; CHECK:         Loop %header: backedge-taken count is (0 smax (1 + %n.div.2)<nsw>)
+; CHECK-LABEL: 'test_3neg'
+; CHECK-NEXT:  Classifying expressions for: @test_3neg
+; CHECK-NEXT:    %n.div.2 = sdiv i32 %n, 2
+; CHECK-NEXT:    --> %n.div.2 U: [-1073741824,1073741824) S: [-1073741824,1073741824)
+; CHECK-NEXT:    %indvar = phi i32 [ %indvar.next, %header ], [ 0, %entry ]
+; CHECK-NEXT:    --> {0,+,1}<nuw><nsw><%header> U: [0,1073741825) S: [0,1073741825) Exits: (0 smax (1 + %n.div.2)<nsw>) LoopDispositions: { %header: Computable }
+; CHECK-NEXT:    %indvar.next = add i32 %indvar, 1
+; CHECK-NEXT:    --> {1,+,1}<nuw><nsw><%header> U: [1,1073741826) S: [1,1073741826) Exits: (1 + (0 smax (1 + %n.div.2)<nsw>))<nuw><nsw> LoopDispositions: { %header: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @test_3neg
+; CHECK-NEXT:  Loop %header: backedge-taken count is (0 smax (1 + %n.div.2)<nsw>)
+; CHECK-NEXT:  Loop %header: constant max backedge-taken count is i32 1073741824
+; CHECK-NEXT:  Loop %header: symbolic max backedge-taken count is (0 smax (1 + %n.div.2)<nsw>)
+; CHECK-NEXT:  Loop %header: Trip multiple is 1
+;
 entry:
   %cmp1 = icmp sgt i32 %n, -3
   %n.div.2 = sdiv i32 %n, 2
@@ -124,8 +197,20 @@ exit:
 
 define void @test_4(i32 %n) nounwind {
 ; Prove that (n >= -1) ===> (n / 2 >= 0).
-; CHECK:         Determining loop execution counts for: @test_4
-; CHECK:         Loop %header: backedge-taken count is (1 + %n.div.2)<nsw>
+; CHECK-LABEL: 'test_4'
+; CHECK-NEXT:  Classifying expressions for: @test_4
+; CHECK-NEXT:    %n.div.2 = sdiv i32 %n, 2
+; CHECK-NEXT:    --> %n.div.2 U: [-1073741824,1073741824) S: [-1073741824,1073741824)
+; CHECK-NEXT:    %indvar = phi i32 [ %indvar.next, %header ], [ 0, %entry ]
+; CHECK-NEXT:    --> {0,+,1}<nuw><nsw><%header> U: [0,1073741825) S: [0,1073741825) Exits: (1 + %n.div.2)<nsw> LoopDispositions: { %header: Computable }
+; CHECK-NEXT:    %indvar.next = add i32 %indvar, 1
+; CHECK-NEXT:    --> {1,+,1}<nuw><nsw><%header> U: [1,1073741826) S: [1,1073741826) Exits: (2 + %n.div.2)<nsw> LoopDispositions: { %header: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @test_4
+; CHECK-NEXT:  Loop %header: backedge-taken count is (1 + %n.div.2)<nsw>
+; CHECK-NEXT:  Loop %header: constant max backedge-taken count is i32 1073741824
+; CHECK-NEXT:  Loop %header: symbolic max backedge-taken count is (1 + %n.div.2)<nsw>
+; CHECK-NEXT:  Loop %header: Trip multiple is 1
+;
 entry:
   %cmp1 = icmp sge i32 %n, -1
   %n.div.2 = sdiv i32 %n, 2
@@ -144,8 +229,20 @@ exit:
 
 define void @test_4neg(i32 %n) nounwind {
 ; Prove that (n >= -2) =\=> (n / 2 >= 0).
-; CHECK:         Determining loop execution counts for: @test_4neg
-; CHECK:         Loop %header: backedge-taken count is (0 smax (1 + %n.div.2)<nsw>)
+; CHECK-LABEL: 'test_4neg'
+; CHECK-NEXT:  Classifying expressions for: @test_4neg
+; CHECK-NEXT:    %n.div.2 = sdiv i32 %n, 2
+; CHECK-NEXT:    --> %n.div.2 U: [-1073741824,1073741824) S: [-1073741824,1073741824)
+; CHECK-NEXT:    %indvar = phi i32 [ %indvar.next, %header ], [ 0, %entry ]
+; CHECK-NEXT:    --> {0,+,1}<nuw><nsw><%header> U: [0,1073741825) S: [0,1073741825) Exits: (0 smax (1 + %n.div.2)<nsw>) LoopDispositions: { %header: Computable }
+; CHECK-NEXT:    %indvar.next = add i32 %indvar, 1
+; CHECK-NEXT:    --> {1,+,1}<nuw><nsw><%header> U: [1,1073741826) S: [1,1073741826) Exits: (1 + (0 smax (1 + %n.div.2)<nsw>))<nuw><nsw> LoopDispositions: { %header: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @test_4neg
+; CHECK-NEXT:  Loop %header: backedge-taken count is (0 smax (1 + %n.div.2)<nsw>)
+; CHECK-NEXT:  Loop %header: constant max backedge-taken count is i32 1073741824
+; CHECK-NEXT:  Loop %header: symbolic max backedge-taken count is (0 smax (1 + %n.div.2)<nsw>)
+; CHECK-NEXT:  Loop %header: Trip multiple is 1
+;
 entry:
   %cmp1 = icmp sge i32 %n, -2
   %n.div.2 = sdiv i32 %n, 2
@@ -164,8 +261,22 @@ exit:
 
 define void @test_ext_01(i32 %n) nounwind {
 ; Prove that (n > 1) ===> (n / 2 > 0).
-; CHECK:         Determining loop execution counts for: @test_ext_01
-; CHECK:         Loop %header: backedge-taken count is (-1 + (sext i32 %n.div.2 to i64))<nsw>
+; CHECK-LABEL: 'test_ext_01'
+; CHECK-NEXT:  Classifying expressions for: @test_ext_01
+; CHECK-NEXT:    %n.div.2 = sdiv i32 %n, 2
+; CHECK-NEXT:    --> %n.div.2 U: [-1073741824,1073741824) S: [-1073741824,1073741824)
+; CHECK-NEXT:    %n.div.2.ext = sext i32 %n.div.2 to i64
+; CHECK-NEXT:    --> (sext i32 %n.div.2 to i64) U: [-1073741824,1073741824) S: [-1073741824,1073741824)
+; CHECK-NEXT:    %indvar = phi i64 [ %indvar.next, %header ], [ 0, %entry ]
+; CHECK-NEXT:    --> {0,+,1}<nuw><nsw><%header> U: [0,1073741823) S: [0,1073741823) Exits: (-1 + (sext i32 %n.div.2 to i64))<nsw> LoopDispositions: { %header: Computable }
+; CHECK-NEXT:    %indvar.next = add i64 %indvar, 1
+; CHECK-NEXT:    --> {1,+,1}<nuw><nsw><%header> U: [1,1073741824) S: [1,1073741824) Exits: (sext i32 %n.div.2 to i64) LoopDispositions: { %header: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @test_ext_01
+; CHECK-NEXT:  Loop %header: backedge-taken count is (-1 + (sext i32 %n.div.2 to i64))<nsw>
+; CHECK-NEXT:  Loop %header: constant max backedge-taken count is i64 1073741822
+; CHECK-NEXT:  Loop %header: symbolic max backedge-taken count is (-1 + (sext i32 %n.div.2 to i64))<nsw>
+; CHECK-NEXT:  Loop %header: Trip multiple is 1
+;
 entry:
   %cmp1 = icmp sgt i32 %n, 1
   %n.div.2 = sdiv i32 %n, 2
@@ -185,8 +296,22 @@ exit:
 
 define void @test_ext_01neg(i32 %n) nounwind {
 ; Prove that (n > 0) =\=> (n / 2 > 0).
-; CHECK:         Determining loop execution counts for: @test_ext_01neg
-; CHECK:         Loop %header: backedge-taken count is (-1 + (1 smax (sext i32 %n.div.2 to i64)))<nsw>
+; CHECK-LABEL: 'test_ext_01neg'
+; CHECK-NEXT:  Classifying expressions for: @test_ext_01neg
+; CHECK-NEXT:    %n.div.2 = sdiv i32 %n, 2
+; CHECK-NEXT:    --> %n.div.2 U: [-1073741824,1073741824) S: [-1073741824,1073741824)
+; CHECK-NEXT:    %n.div.2.ext = sext i32 %n.div.2 to i64
+; CHECK-NEXT:    --> (sext i32 %n.div.2 to i64) U: [-1073741824,1073741824) S: [-1073741824,1073741824)
+; CHECK-NEXT:    %indvar = phi i64 [ %indvar.next, %header ], [ 0, %entry ]
+; CHECK-NEXT:    --> {0,+,1}<nuw><nsw><%header> U: [0,1073741823) S: [0,1073741823) Exits: (-1 + (1 smax (sext i32 %n.div.2 to i64)))<nsw> LoopDispositions: { %header: Computable }
+; CHECK-NEXT:    %indvar.next = add i64 %indvar, 1
+; CHECK-NEXT:    --> {1,+,1}<nuw><nsw><%header> U: [1,1073741824) S: [1,1073741...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/123050


More information about the llvm-commits mailing list