-
Notifications
You must be signed in to change notification settings - Fork 15.3k
SCEV: re-org a test, regen via UTC #126237
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
|
@llvm/pr-subscribers-llvm-analysis @llvm/pr-subscribers-llvm-transforms Author: Ramkumar Ramachandra (artagnon) ChangesFull diff: https://github.com/llvm/llvm-project/pull/126237.diff 2 Files Affected:
diff --git a/llvm/test/Analysis/ScalarEvolution/infer-via-ranges.ll b/llvm/test/Analysis/ScalarEvolution/infer-via-ranges.ll
index 9aa096b952be5d6..9cf3e06d58a88db 100644
--- a/llvm/test/Analysis/ScalarEvolution/infer-via-ranges.ll
+++ b/llvm/test/Analysis/ScalarEvolution/infer-via-ranges.ll
@@ -1,22 +1,31 @@
-; RUN: opt -passes=indvars -S < %s | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -passes='print<scalar-evolution>' \
+; RUN: -scalar-evolution-classify-expressions=0 -disable-output %s 2>&1 | FileCheck %s
define void @infer_via_ranges(ptr %arr, i32 %n) {
-; CHECK-LABEL: @infer_via_ranges
+; CHECK-LABEL: 'infer_via_ranges'
+; CHECK-NEXT: Determining loop execution counts for: @infer_via_ranges
+; CHECK-NEXT: Loop %loop: <multiple exits> backedge-taken count is ((-1 + %n) umin %n)
+; CHECK-NEXT: exit count for loop: %n
+; CHECK-NEXT: exit count for in.bounds: (-1 + %n)
+; CHECK-NEXT: Loop %loop: constant max backedge-taken count is i32 -2147483648
+; CHECK-NEXT: Loop %loop: symbolic max backedge-taken count is ((-1 + %n) umin %n)
+; CHECK-NEXT: symbolic max exit count for loop: %n
+; CHECK-NEXT: symbolic max exit count for in.bounds: (-1 + %n)
+; CHECK-NEXT: Loop %loop: Trip multiple is 1
+;
entry:
%first.itr.check = icmp sgt i32 %n, 0
%start = sub i32 %n, 1
br i1 %first.itr.check, label %loop, label %exit
loop:
-; CHECK-LABEL: loop:
%idx = phi i32 [ %start, %entry ] , [ %idx.dec, %in.bounds ]
%idx.dec = sub i32 %idx, 1
%abc = icmp sge i32 %idx, 0
-; CHECK: br i1 true, label %in.bounds, label %out.of.bounds
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
-; CHECK-LABEL: in.bounds:
%addr = getelementptr i32, ptr %arr, i32 %idx
store i32 0, ptr %addr
%next = icmp sgt i32 %idx.dec, -1
diff --git a/llvm/test/Transforms/IndVarSimplify/infer-via-ranges.ll b/llvm/test/Transforms/IndVarSimplify/infer-via-ranges.ll
new file mode 100644
index 000000000000000..effae2322dba39a
--- /dev/null
+++ b/llvm/test/Transforms/IndVarSimplify/infer-via-ranges.ll
@@ -0,0 +1,51 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -passes=indvars -S < %s | FileCheck %s
+
+define void @infer_via_ranges(ptr %arr, i32 %n) {
+; CHECK-LABEL: define void @infer_via_ranges(
+; CHECK-SAME: ptr [[ARR:%.*]], i32 [[N:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: [[FIRST_ITR_CHECK:%.*]] = icmp sgt i32 [[N]], 0
+; CHECK-NEXT: [[START:%.*]] = sub i32 [[N]], 1
+; CHECK-NEXT: br i1 [[FIRST_ITR_CHECK]], label %[[LOOP_PREHEADER:.*]], label %[[EXIT:.*]]
+; CHECK: [[LOOP_PREHEADER]]:
+; CHECK-NEXT: br label %[[LOOP:.*]]
+; CHECK: [[LOOP]]:
+; CHECK-NEXT: [[IDX:%.*]] = phi i32 [ [[IDX_DEC:%.*]], %[[IN_BOUNDS:.*]] ], [ [[START]], %[[LOOP_PREHEADER]] ]
+; CHECK-NEXT: [[IDX_DEC]] = sub nsw i32 [[IDX]], 1
+; CHECK-NEXT: br i1 true, label %[[IN_BOUNDS]], label %[[OUT_OF_BOUNDS:.*]]
+; CHECK: [[IN_BOUNDS]]:
+; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, ptr [[ARR]], i32 [[IDX]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR]], align 4
+; CHECK-NEXT: [[NEXT:%.*]] = icmp sgt i32 [[IDX_DEC]], -1
+; CHECK-NEXT: br i1 [[NEXT]], label %[[LOOP]], label %[[EXIT_LOOPEXIT:.*]]
+; CHECK: [[OUT_OF_BOUNDS]]:
+; CHECK-NEXT: ret void
+; CHECK: [[EXIT_LOOPEXIT]]:
+; CHECK-NEXT: br label %[[EXIT]]
+; CHECK: [[EXIT]]:
+; CHECK-NEXT: ret void
+;
+ entry:
+ %first.itr.check = icmp sgt i32 %n, 0
+ %start = sub i32 %n, 1
+ br i1 %first.itr.check, label %loop, label %exit
+
+ loop:
+ %idx = phi i32 [ %start, %entry ] , [ %idx.dec, %in.bounds ]
+ %idx.dec = sub i32 %idx, 1
+ %abc = icmp sge i32 %idx, 0
+ br i1 %abc, label %in.bounds, label %out.of.bounds
+
+ in.bounds:
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
+ %next = icmp sgt i32 %idx.dec, -1
+ br i1 %next, label %loop, label %exit
+
+ out.of.bounds:
+ ret void
+
+ exit:
+ ret void
+}
|
bjope
approved these changes
Feb 7, 2025
Collaborator
bjope
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG
Icohedron
pushed a commit
to Icohedron/llvm-project
that referenced
this pull request
Feb 11, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.