Skip to content

SCEV: regen some tests with UTC #123050

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 22 additions & 15 deletions llvm/test/Analysis/ScalarEvolution/2007-08-06-Unsigned.ll
Original file line number Diff line number Diff line change
@@ -1,32 +1,39 @@
; 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 \
; RUN: -scalar-evolution-classify-expressions=0 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: 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
}
50 changes: 0 additions & 50 deletions llvm/test/Analysis/ScalarEvolution/implied-via-addition.ll

This file was deleted.

148 changes: 115 additions & 33 deletions llvm/test/Analysis/ScalarEvolution/implied-via-division.ll
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
; 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>" \
; 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: 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: 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
Expand All @@ -24,8 +31,13 @@ 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: 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
Expand All @@ -44,8 +56,13 @@ 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: 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
Expand All @@ -64,8 +81,13 @@ 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: 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
Expand All @@ -84,8 +106,13 @@ 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: 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
Expand All @@ -104,8 +131,13 @@ 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: 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
Expand All @@ -124,8 +156,13 @@ 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: 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
Expand All @@ -144,8 +181,13 @@ 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: 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
Expand All @@ -164,8 +206,13 @@ 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: 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
Expand All @@ -185,8 +232,13 @@ 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: 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
Expand All @@ -206,8 +258,13 @@ 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: 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
Expand All @@ -227,8 +284,13 @@ 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: 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
Expand All @@ -248,8 +310,13 @@ 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: 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
Expand All @@ -269,8 +336,13 @@ 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: 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
Expand All @@ -290,8 +362,13 @@ 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: 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
Expand All @@ -311,8 +388,13 @@ 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: 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
Expand Down
Loading
Loading