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

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 05:16:27 PST 2025


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

>From 0949af04cd87f8404770de835cc9873d37c77962 Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <ramkumar.ramachandra at codasip.com>
Date: Wed, 15 Jan 2025 13:00:21 +0000
Subject: [PATCH 1/2] SCEV: regen some tests with UTC (NFC)

---
 .../ScalarEvolution/2007-08-06-Unsigned.ll    |  43 ++-
 .../ScalarEvolution/implied-via-addition.ll   |  52 +++-
 .../ScalarEvolution/implied-via-division.ll   | 275 +++++++++++++++---
 .../ScalarEvolution/infer-prestart-no-wrap.ll | 115 +++++++-
 4 files changed, 409 insertions(+), 76 deletions(-)

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,1073741824) Exits: (1 smax (sext i32 %n.div.2 to i64)) LoopDispositions: { %header: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @test_ext_01neg
+; CHECK-NEXT:  Loop %header: backedge-taken count is (-1 + (1 smax (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 + (1 smax (sext i32 %n.div.2 to i64)))<nsw>
+; CHECK-NEXT:  Loop %header: Trip multiple is 1
+;
 entry:
   %cmp1 = icmp sgt i32 %n, 0
   %n.div.2 = sdiv i32 %n, 2
@@ -206,8 +331,22 @@ exit:
 
 define void @test_ext_02(i32 %n) nounwind {
 ; Prove that (n >= 2) ===> (n / 2 > 0).
-; CHECK:         Determining loop execution counts for: @test_ext_02
-; CHECK:         Loop %header: backedge-taken count is (-1 + (sext i32 %n.div.2 to i64))<nsw>
+; CHECK-LABEL: 'test_ext_02'
+; CHECK-NEXT:  Classifying expressions for: @test_ext_02
+; 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_02
+; 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 sge i32 %n, 2
   %n.div.2 = sdiv i32 %n, 2
@@ -227,8 +366,22 @@ exit:
 
 define void @test_ext_02neg(i32 %n) nounwind {
 ; Prove that (n >= 1) =\=> (n / 2 > 0).
-; CHECK:         Determining loop execution counts for: @test_ext_02neg
-; CHECK:         Loop %header: backedge-taken count is (-1 + (1 smax (sext i32 %n.div.2 to i64)))<nsw>
+; CHECK-LABEL: 'test_ext_02neg'
+; CHECK-NEXT:  Classifying expressions for: @test_ext_02neg
+; 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,1073741824) Exits: (1 smax (sext i32 %n.div.2 to i64)) LoopDispositions: { %header: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @test_ext_02neg
+; CHECK-NEXT:  Loop %header: backedge-taken count is (-1 + (1 smax (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 + (1 smax (sext i32 %n.div.2 to i64)))<nsw>
+; CHECK-NEXT:  Loop %header: Trip multiple is 1
+;
 entry:
   %cmp1 = icmp sge i32 %n, 1
   %n.div.2 = sdiv i32 %n, 2
@@ -248,8 +401,22 @@ exit:
 
 define void @test_ext_03(i32 %n) nounwind {
 ; Prove that (n > -2) ===> (n / 2 >= 0).
-; CHECK:         Determining loop execution counts for: @test_ext_03
-; CHECK:         Loop %header: backedge-taken count is (1 + (sext i32 %n.div.2 to i64))<nsw>
+; CHECK-LABEL: 'test_ext_03'
+; CHECK-NEXT:  Classifying expressions for: @test_ext_03
+; 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,1073741825) S: [0,1073741825) 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,1073741826) S: [1,1073741826) Exits: (2 + (sext i32 %n.div.2 to i64))<nsw> LoopDispositions: { %header: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @test_ext_03
+; 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 1073741824
+; 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, -2
   %n.div.2 = sdiv i32 %n, 2
@@ -269,8 +436,22 @@ exit:
 
 define void @test_ext_03neg(i32 %n) nounwind {
 ; Prove that (n > -3) =\=> (n / 2 >= 0).
-; CHECK:         Determining loop execution counts for: @test_ext_03neg
-; CHECK:         Loop %header: backedge-taken count is (0 smax (1 + (sext i32 %n.div.2 to i64))<nsw>)
+; CHECK-LABEL: 'test_ext_03neg'
+; CHECK-NEXT:  Classifying expressions for: @test_ext_03neg
+; 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,1073741825) S: [0,1073741825) Exits: (0 smax (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,1073741826) S: [1,1073741826) Exits: (1 + (0 smax (1 + (sext i32 %n.div.2 to i64))<nsw>))<nuw><nsw> LoopDispositions: { %header: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @test_ext_03neg
+; CHECK-NEXT:  Loop %header: backedge-taken count is (0 smax (1 + (sext i32 %n.div.2 to i64))<nsw>)
+; CHECK-NEXT:  Loop %header: constant max backedge-taken count is i64 1073741824
+; CHECK-NEXT:  Loop %header: symbolic max backedge-taken count is (0 smax (1 + (sext i32 %n.div.2 to i64))<nsw>)
+; CHECK-NEXT:  Loop %header: Trip multiple is 1
+;
 entry:
   %cmp1 = icmp sgt i32 %n, -3
   %n.div.2 = sdiv i32 %n, 2
@@ -290,8 +471,22 @@ exit:
 
 define void @test_ext_04(i32 %n) nounwind {
 ; Prove that (n >= -1) ===> (n / 2 >= 0).
-; CHECK:         Determining loop execution counts for: @test_ext_04
-; CHECK:         Loop %header: backedge-taken count is (1 + (sext i32 %n.div.2 to i64))<nsw>
+; CHECK-LABEL: 'test_ext_04'
+; CHECK-NEXT:  Classifying expressions for: @test_ext_04
+; 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,1073741825) S: [0,1073741825) 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,1073741826) S: [1,1073741826) Exits: (2 + (sext i32 %n.div.2 to i64))<nsw> LoopDispositions: { %header: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @test_ext_04
+; 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 1073741824
+; 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 sge i32 %n, -1
   %n.div.2 = sdiv i32 %n, 2
@@ -311,8 +506,22 @@ exit:
 
 define void @test_ext_04neg(i32 %n) nounwind {
 ; Prove that (n >= -2) =\=> (n / 2 >= 0).
-; CHECK:         Determining loop execution counts for: @test_ext_04neg
-; CHECK:         Loop %header: backedge-taken count is (0 smax (1 + (sext i32 %n.div.2 to i64))<nsw>)
+; CHECK-LABEL: 'test_ext_04neg'
+; CHECK-NEXT:  Classifying expressions for: @test_ext_04neg
+; 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,1073741825) S: [0,1073741825) Exits: (0 smax (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,1073741826) S: [1,1073741826) Exits: (1 + (0 smax (1 + (sext i32 %n.div.2 to i64))<nsw>))<nuw><nsw> LoopDispositions: { %header: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @test_ext_04neg
+; CHECK-NEXT:  Loop %header: backedge-taken count is (0 smax (1 + (sext i32 %n.div.2 to i64))<nsw>)
+; CHECK-NEXT:  Loop %header: constant max backedge-taken count is i64 1073741824
+; CHECK-NEXT:  Loop %header: symbolic max backedge-taken count is (0 smax (1 + (sext i32 %n.div.2 to i64))<nsw>)
+; CHECK-NEXT:  Loop %header: Trip multiple is 1
+;
 entry:
   %cmp1 = icmp sge i32 %n, -2
   %n.div.2 = sdiv i32 %n, 2
diff --git a/llvm/test/Analysis/ScalarEvolution/infer-prestart-no-wrap.ll b/llvm/test/Analysis/ScalarEvolution/infer-prestart-no-wrap.ll
index a8b891b5afb232..677463ee632257 100644
--- a/llvm/test/Analysis/ScalarEvolution/infer-prestart-no-wrap.ll
+++ b/llvm/test/Analysis/ScalarEvolution/infer-prestart-no-wrap.ll
@@ -1,7 +1,29 @@
-; ; RUN: opt -disable-output "-passes=print<scalar-evolution>" < %s 2>&1 | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -disable-output -passes="print<scalar-evolution>" < %s 2>&1 | FileCheck %s
 
 define void @infer.sext.0(ptr %c, i32 %start, ptr %buf) {
-; CHECK-LABEL: Classifying expressions for: @infer.sext.0
+; CHECK-LABEL: 'infer.sext.0'
+; CHECK-NEXT:  Classifying expressions for: @infer.sext.0
+; CHECK-NEXT:    %counter = phi i32 [ 0, %entry ], [ %counter.inc, %loop ]
+; CHECK-NEXT:    --> {0,+,1}<nuw><nsw><%loop> U: [0,2) S: [0,2) Exits: 1 LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %idx = phi i32 [ %start, %entry ], [ %idx.inc, %loop ]
+; CHECK-NEXT:    --> {%start,+,1}<nsw><%loop> U: full-set S: full-set Exits: (1 + %start) LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %idx.inc = add nsw i32 %idx, 1
+; CHECK-NEXT:    --> {(1 + %start)<nsw>,+,1}<nsw><%loop> U: full-set S: full-set Exits: (2 + %start) LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %idx.inc.sext = sext i32 %idx.inc to i64
+; CHECK-NEXT:    --> {(1 + (sext i32 %start to i64))<nsw>,+,1}<nsw><%loop> U: [-2147483647,2147483650) S: [-2147483647,2147483650) Exits: (2 + (sext i32 %start to i64))<nsw> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %buf.gep = getelementptr inbounds i32, ptr %buf, i32 %idx.inc
+; CHECK-NEXT:    --> {(4 + (4 * (sext i32 %start to i64))<nsw> + %buf),+,4}<nw><%loop> U: full-set S: full-set Exits: (8 + (4 * (sext i32 %start to i64))<nsw> + %buf) LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %val = load i32, ptr %buf.gep, align 4
+; CHECK-NEXT:    --> %val U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
+; CHECK-NEXT:    %counter.inc = add i32 %counter, 1
+; CHECK-NEXT:    --> {1,+,1}<nuw><nsw><%loop> U: [1,3) S: [1,3) Exits: 2 LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @infer.sext.0
+; CHECK-NEXT:  Loop %loop: backedge-taken count is i32 1
+; CHECK-NEXT:  Loop %loop: constant max backedge-taken count is i32 1
+; CHECK-NEXT:  Loop %loop: symbolic max backedge-taken count is i32 1
+; CHECK-NEXT:  Loop %loop: Trip multiple is 2
+;
  entry:
   br label %loop
 
@@ -10,8 +32,6 @@ define void @infer.sext.0(ptr %c, i32 %start, ptr %buf) {
   %idx = phi i32 [ %start, %entry ], [ %idx.inc, %loop ]
   %idx.inc = add nsw i32 %idx, 1
   %idx.inc.sext = sext i32 %idx.inc to i64
-; CHECK: %idx.inc.sext = sext i32 %idx.inc to i64
-; CHECK-NEXT: -->  {(1 + (sext i32 %start to i64))<nsw>,+,1}<nsw><%loop>
 
   %buf.gep = getelementptr inbounds i32, ptr %buf, i32 %idx.inc
   %val = load i32, ptr %buf.gep
@@ -25,7 +45,28 @@ define void @infer.sext.0(ptr %c, i32 %start, ptr %buf) {
 }
 
 define void @infer.zext.0(ptr %c, i32 %start, ptr %buf) {
-; CHECK-LABEL: Classifying expressions for: @infer.zext.0
+; CHECK-LABEL: 'infer.zext.0'
+; CHECK-NEXT:  Classifying expressions for: @infer.zext.0
+; CHECK-NEXT:    %counter = phi i32 [ 0, %entry ], [ %counter.inc, %loop ]
+; CHECK-NEXT:    --> {0,+,1}<nuw><nsw><%loop> U: [0,2) S: [0,2) Exits: 1 LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %idx = phi i32 [ %start, %entry ], [ %idx.inc, %loop ]
+; CHECK-NEXT:    --> {%start,+,1}<nuw><%loop> U: full-set S: full-set Exits: (1 + %start) LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %idx.inc = add nuw i32 %idx, 1
+; CHECK-NEXT:    --> {(1 + %start)<nuw>,+,1}<nuw><%loop> U: [1,0) S: [1,0) Exits: (2 + %start) LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %idx.inc.sext = zext i32 %idx.inc to i64
+; CHECK-NEXT:    --> {(1 + (zext i32 %start to i64))<nuw><nsw>,+,1}<nuw><%loop> U: [1,4294967298) S: [1,4294967298) Exits: (2 + (zext i32 %start to i64))<nuw><nsw> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %buf.gep = getelementptr inbounds i32, ptr %buf, i32 %idx.inc
+; CHECK-NEXT:    --> ((4 * (sext i32 {(1 + %start)<nuw>,+,1}<nuw><%loop> to i64))<nsw> + %buf) U: full-set S: full-set Exits: ((4 * (sext i32 (2 + %start) to i64))<nsw> + %buf) LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %val = load i32, ptr %buf.gep, align 4
+; CHECK-NEXT:    --> %val U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
+; CHECK-NEXT:    %counter.inc = add i32 %counter, 1
+; CHECK-NEXT:    --> {1,+,1}<nuw><nsw><%loop> U: [1,3) S: [1,3) Exits: 2 LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @infer.zext.0
+; CHECK-NEXT:  Loop %loop: backedge-taken count is i32 1
+; CHECK-NEXT:  Loop %loop: constant max backedge-taken count is i32 1
+; CHECK-NEXT:  Loop %loop: symbolic max backedge-taken count is i32 1
+; CHECK-NEXT:  Loop %loop: Trip multiple is 2
+;
  entry:
   br label %loop
 
@@ -34,8 +75,6 @@ define void @infer.zext.0(ptr %c, i32 %start, ptr %buf) {
   %idx = phi i32 [ %start, %entry ], [ %idx.inc, %loop ]
   %idx.inc = add nuw i32 %idx, 1
   %idx.inc.sext = zext i32 %idx.inc to i64
-; CHECK: %idx.inc.sext = zext i32 %idx.inc to i64
-; CHECK-NEXT: -->  {(1 + (zext i32 %start to i64))<nuw><nsw>,+,1}<nuw><%loop>
 
   %buf.gep = getelementptr inbounds i32, ptr %buf, i32 %idx.inc
   %val = load i32, ptr %buf.gep
@@ -49,7 +88,25 @@ define void @infer.zext.0(ptr %c, i32 %start, ptr %buf) {
 }
 
 define void @infer.sext.1(i32 %start, ptr %c) {
-; CHECK-LABEL: Classifying expressions for: @infer.sext.1
+; CHECK-LABEL: 'infer.sext.1'
+; CHECK-NEXT:  Classifying expressions for: @infer.sext.1
+; CHECK-NEXT:    %start.mul = mul i32 %start, 4
+; CHECK-NEXT:    --> (4 * %start) U: [0,-3) S: [-2147483648,2147483645)
+; CHECK-NEXT:    %start.real = add i32 %start.mul, 2
+; CHECK-NEXT:    --> (2 + (4 * %start))<nuw><nsw> U: [2,-1) S: [-2147483646,2147483647)
+; CHECK-NEXT:    %idx = phi i32 [ %start.real, %entry ], [ %idx.inc, %loop ]
+; CHECK-NEXT:    --> {(2 + (4 * %start))<nuw><nsw>,+,2}<nsw><%loop> U: [0,-1) S: [-2147483646,2147483647) Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %idx.sext = sext i32 %idx to i64
+; CHECK-NEXT:    --> {(2 + (sext i32 (4 * %start) to i64))<nuw><nsw>,+,2}<nsw><%loop> U: [0,-1) S: [-2147483646,9223372036854775807) Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %idx.inc = add nsw i32 %idx, 2
+; CHECK-NEXT:    --> {(4 + (4 * %start)),+,2}<nw><%loop> U: [0,-1) S: [-2147483648,2147483647) Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %condition = load i1, ptr %c, align 1
+; CHECK-NEXT:    --> %condition U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
+; CHECK-NEXT:  Determining loop execution counts for: @infer.sext.1
+; 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:
   %start.mul = mul i32 %start, 4
   %start.real = add i32 %start.mul, 2
@@ -58,8 +115,6 @@ define void @infer.sext.1(i32 %start, ptr %c) {
  loop:
   %idx = phi i32 [ %start.real, %entry ], [ %idx.inc, %loop ]
   %idx.sext = sext i32 %idx to i64
-; CHECK: %idx.sext = sext i32 %idx to i64
-; CHECK-NEXT:  -->  {(2 + (sext i32 (4 * %start) to i64))<nuw><nsw>,+,2}<nsw><%loop>
   %idx.inc = add nsw i32 %idx, 2
   %condition = load i1, ptr %c
   br i1 %condition, label %exit, label %loop
@@ -69,7 +124,23 @@ define void @infer.sext.1(i32 %start, ptr %c) {
 }
 
 define void @infer.sext.2(ptr %c, i8 %start) {
-; CHECK-LABEL: Classifying expressions for: @infer.sext.2
+; CHECK-LABEL: 'infer.sext.2'
+; CHECK-NEXT:  Classifying expressions for: @infer.sext.2
+; CHECK-NEXT:    %start.inc = add i8 %start, 1
+; CHECK-NEXT:    --> (1 + %start) U: full-set S: full-set
+; CHECK-NEXT:    %idx = phi i8 [ %start.inc, %entry ], [ %idx.inc, %loop ]
+; CHECK-NEXT:    --> {(1 + %start),+,1}<nsw><%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %idx.sext = sext i8 %idx to i16
+; CHECK-NEXT:    --> {(1 + (sext i8 %start to i16))<nsw>,+,1}<nsw><%loop> U: [-127,-32768) S: [-127,-32768) Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %idx.inc = add nsw i8 %idx, 1
+; CHECK-NEXT:    --> {(2 + %start),+,1}<nw><%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %condition = load volatile i1, ptr %c, align 1
+; CHECK-NEXT:    --> %condition U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
+; CHECK-NEXT:  Determining loop execution counts for: @infer.sext.2
+; 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:
   %start.inc = add i8 %start, 1
   %entry.condition = icmp slt i8 %start, 127
@@ -78,8 +149,6 @@ define void @infer.sext.2(ptr %c, i8 %start) {
  loop:
   %idx = phi i8 [ %start.inc, %entry ], [ %idx.inc, %loop ]
   %idx.sext = sext i8 %idx to i16
-; CHECK: %idx.sext = sext i8 %idx to i16
-; CHECK-NEXT: -->  {(1 + (sext i8 %start to i16))<nsw>,+,1}<nsw><%loop>
   %idx.inc = add nsw i8 %idx, 1
   %condition = load volatile i1, ptr %c
   br i1 %condition, label %exit, label %loop
@@ -89,7 +158,23 @@ define void @infer.sext.2(ptr %c, i8 %start) {
 }
 
 define void @infer.zext.1(ptr %c, i8 %start) {
-; CHECK-LABEL: Classifying expressions for: @infer.zext.1
+; CHECK-LABEL: 'infer.zext.1'
+; CHECK-NEXT:  Classifying expressions for: @infer.zext.1
+; CHECK-NEXT:    %start.inc = add i8 %start, 1
+; CHECK-NEXT:    --> (1 + %start) U: full-set S: full-set
+; CHECK-NEXT:    %idx = phi i8 [ %start.inc, %entry ], [ %idx.inc, %loop ]
+; CHECK-NEXT:    --> {(1 + %start),+,1}<nuw><%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %idx.zext = zext i8 %idx to i16
+; CHECK-NEXT:    --> {(1 + (zext i8 %start to i16))<nuw><nsw>,+,1}<nuw><%loop> U: [1,0) S: [1,0) Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %idx.inc = add nuw i8 %idx, 1
+; CHECK-NEXT:    --> {(2 + %start),+,1}<nw><%loop> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %condition = load volatile i1, ptr %c, align 1
+; CHECK-NEXT:    --> %condition U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
+; CHECK-NEXT:  Determining loop execution counts for: @infer.zext.1
+; 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:
   %start.inc = add i8 %start, 1
   %entry.condition = icmp ult i8 %start, 255
@@ -98,8 +183,6 @@ define void @infer.zext.1(ptr %c, i8 %start) {
  loop:
   %idx = phi i8 [ %start.inc, %entry ], [ %idx.inc, %loop ]
   %idx.zext = zext i8 %idx to i16
-; CHECK: %idx.zext = zext i8 %idx to i16
-; CHECK-NEXT: -->  {(1 + (zext i8 %start to i16))<nuw><nsw>,+,1}<nuw><%loop>
   %idx.inc = add nuw i8 %idx, 1
   %condition = load volatile i1, ptr %c
   br i1 %condition, label %exit, label %loop

>From 57dcc03e3b6ec6adba64a45ae220da58b2c31307 Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <ramkumar.ramachandra at codasip.com>
Date: Wed, 15 Jan 2025 13:15:21 +0000
Subject: [PATCH 2/2] SCEV/test: address review

---
 .../ScalarEvolution/2007-08-06-Unsigned.ll    |  10 +-
 .../ScalarEvolution/implied-via-division.ll   | 131 +-----------------
 .../IndVarSimplify}/implied-via-addition.ll   |   0
 3 files changed, 4 insertions(+), 137 deletions(-)
 rename llvm/test/{Analysis/ScalarEvolution => Transforms/IndVarSimplify}/implied-via-addition.ll (100%)

diff --git a/llvm/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll b/llvm/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll
index 43f5b95e19b502..26f60c00ae1bff 100644
--- a/llvm/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll
+++ b/llvm/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll
@@ -1,16 +1,10 @@
 ; 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
+; RUN: opt < %s -passes="print<scalar-evolution>" -disable-output \
+; RUN:   -scalar-evolution-classify-expressions=0 2>&1 | FileCheck %s
 ; PR1597
 
 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
diff --git a/llvm/test/Analysis/ScalarEvolution/implied-via-division.ll b/llvm/test/Analysis/ScalarEvolution/implied-via-division.ll
index b4e6076a34cd36..fbe69b4b188977 100644
--- a/llvm/test/Analysis/ScalarEvolution/implied-via-division.ll
+++ b/llvm/test/Analysis/ScalarEvolution/implied-via-division.ll
@@ -1,18 +1,12 @@
 ; 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
+; RUN: opt < %s -disable-output -passes="print<scalar-evolution>" \
+; RUN:   -scalar-evolution-classify-expressions=0 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-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
@@ -38,13 +32,6 @@ exit:
 define void @test_1neg(i32 %n) nounwind {
 ; Prove that (n > 0) =\=> (n / 2 > 0).
 ; 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
@@ -70,13 +57,6 @@ exit:
 define void @test_2(i32 %n) nounwind {
 ; Prove that (n >= 2) ===> (n / 2 > 0).
 ; 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
@@ -102,13 +82,6 @@ exit:
 define void @test_2neg(i32 %n) nounwind {
 ; Prove that (n >= 1) =\=> (n / 2 > 0).
 ; 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
@@ -134,13 +107,6 @@ exit:
 define void @test_3(i32 %n) nounwind {
 ; Prove that (n > -2) ===> (n / 2 >= 0).
 ; 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
@@ -166,13 +132,6 @@ exit:
 define void @test_3neg(i32 %n) nounwind {
 ; Prove that (n > -3) =\=> (n / 2 >= 0).
 ; 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
@@ -198,13 +157,6 @@ exit:
 define void @test_4(i32 %n) nounwind {
 ; Prove that (n >= -1) ===> (n / 2 >= 0).
 ; 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
@@ -230,13 +182,6 @@ exit:
 define void @test_4neg(i32 %n) nounwind {
 ; Prove that (n >= -2) =\=> (n / 2 >= 0).
 ; 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
@@ -262,15 +207,6 @@ exit:
 define void @test_ext_01(i32 %n) nounwind {
 ; Prove that (n > 1) ===> (n / 2 > 0).
 ; 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
@@ -297,15 +233,6 @@ exit:
 define void @test_ext_01neg(i32 %n) nounwind {
 ; Prove that (n > 0) =\=> (n / 2 > 0).
 ; 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,1073741824) Exits: (1 smax (sext i32 %n.div.2 to i64)) LoopDispositions: { %header: Computable }
 ; CHECK-NEXT:  Determining loop execution counts for: @test_ext_01neg
 ; CHECK-NEXT:  Loop %header: backedge-taken count is (-1 + (1 smax (sext i32 %n.div.2 to i64)))<nsw>
 ; CHECK-NEXT:  Loop %header: constant max backedge-taken count is i64 1073741822
@@ -332,15 +259,6 @@ exit:
 define void @test_ext_02(i32 %n) nounwind {
 ; Prove that (n >= 2) ===> (n / 2 > 0).
 ; CHECK-LABEL: 'test_ext_02'
-; CHECK-NEXT:  Classifying expressions for: @test_ext_02
-; 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_02
 ; 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
@@ -367,15 +285,6 @@ exit:
 define void @test_ext_02neg(i32 %n) nounwind {
 ; Prove that (n >= 1) =\=> (n / 2 > 0).
 ; CHECK-LABEL: 'test_ext_02neg'
-; CHECK-NEXT:  Classifying expressions for: @test_ext_02neg
-; 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,1073741824) Exits: (1 smax (sext i32 %n.div.2 to i64)) LoopDispositions: { %header: Computable }
 ; CHECK-NEXT:  Determining loop execution counts for: @test_ext_02neg
 ; CHECK-NEXT:  Loop %header: backedge-taken count is (-1 + (1 smax (sext i32 %n.div.2 to i64)))<nsw>
 ; CHECK-NEXT:  Loop %header: constant max backedge-taken count is i64 1073741822
@@ -402,15 +311,6 @@ exit:
 define void @test_ext_03(i32 %n) nounwind {
 ; Prove that (n > -2) ===> (n / 2 >= 0).
 ; CHECK-LABEL: 'test_ext_03'
-; CHECK-NEXT:  Classifying expressions for: @test_ext_03
-; 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,1073741825) S: [0,1073741825) 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,1073741826) S: [1,1073741826) Exits: (2 + (sext i32 %n.div.2 to i64))<nsw> LoopDispositions: { %header: Computable }
 ; CHECK-NEXT:  Determining loop execution counts for: @test_ext_03
 ; 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 1073741824
@@ -437,15 +337,6 @@ exit:
 define void @test_ext_03neg(i32 %n) nounwind {
 ; Prove that (n > -3) =\=> (n / 2 >= 0).
 ; CHECK-LABEL: 'test_ext_03neg'
-; CHECK-NEXT:  Classifying expressions for: @test_ext_03neg
-; 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,1073741825) S: [0,1073741825) Exits: (0 smax (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,1073741826) S: [1,1073741826) Exits: (1 + (0 smax (1 + (sext i32 %n.div.2 to i64))<nsw>))<nuw><nsw> LoopDispositions: { %header: Computable }
 ; CHECK-NEXT:  Determining loop execution counts for: @test_ext_03neg
 ; CHECK-NEXT:  Loop %header: backedge-taken count is (0 smax (1 + (sext i32 %n.div.2 to i64))<nsw>)
 ; CHECK-NEXT:  Loop %header: constant max backedge-taken count is i64 1073741824
@@ -472,15 +363,6 @@ exit:
 define void @test_ext_04(i32 %n) nounwind {
 ; Prove that (n >= -1) ===> (n / 2 >= 0).
 ; CHECK-LABEL: 'test_ext_04'
-; CHECK-NEXT:  Classifying expressions for: @test_ext_04
-; 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,1073741825) S: [0,1073741825) 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,1073741826) S: [1,1073741826) Exits: (2 + (sext i32 %n.div.2 to i64))<nsw> LoopDispositions: { %header: Computable }
 ; CHECK-NEXT:  Determining loop execution counts for: @test_ext_04
 ; 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 1073741824
@@ -507,15 +389,6 @@ exit:
 define void @test_ext_04neg(i32 %n) nounwind {
 ; Prove that (n >= -2) =\=> (n / 2 >= 0).
 ; CHECK-LABEL: 'test_ext_04neg'
-; CHECK-NEXT:  Classifying expressions for: @test_ext_04neg
-; 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,1073741825) S: [0,1073741825) Exits: (0 smax (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,1073741826) S: [1,1073741826) Exits: (1 + (0 smax (1 + (sext i32 %n.div.2 to i64))<nsw>))<nuw><nsw> LoopDispositions: { %header: Computable }
 ; CHECK-NEXT:  Determining loop execution counts for: @test_ext_04neg
 ; CHECK-NEXT:  Loop %header: backedge-taken count is (0 smax (1 + (sext i32 %n.div.2 to i64))<nsw>)
 ; CHECK-NEXT:  Loop %header: constant max backedge-taken count is i64 1073741824
diff --git a/llvm/test/Analysis/ScalarEvolution/implied-via-addition.ll b/llvm/test/Transforms/IndVarSimplify/implied-via-addition.ll
similarity index 100%
rename from llvm/test/Analysis/ScalarEvolution/implied-via-addition.ll
rename to llvm/test/Transforms/IndVarSimplify/implied-via-addition.ll



More information about the llvm-commits mailing list