-
Notifications
You must be signed in to change notification settings - Fork 13.4k
ValueTracking: Handle minimumnum/maximumnum in canCreateUndefOrPoison #138729
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
arsenm
merged 1 commit into
main
from
users/arsenm/valuetracking/handle-minimumnum-maximumnum-canCreateUndefOrPoison
May 6, 2025
Merged
ValueTracking: Handle minimumnum/maximumnum in canCreateUndefOrPoison #138729
arsenm
merged 1 commit into
main
from
users/arsenm/valuetracking/handle-minimumnum-maximumnum-canCreateUndefOrPoison
May 6, 2025
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
This stack of pull requests is managed by Graphite. Learn more about stacking. |
@llvm/pr-subscribers-llvm-transforms @llvm/pr-subscribers-llvm-analysis Author: Matt Arsenault (arsenm) ChangesFull diff: https://github.com/llvm/llvm-project/pull/138729.diff 2 Files Affected:
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 256e77b40a97f..cdedc65dd48ad 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -7723,6 +7723,8 @@ static bool canCreateUndefOrPoison(const Operator *Op, UndefPoisonKind Kind,
case Intrinsic::maxnum:
case Intrinsic::minimum:
case Intrinsic::maximum:
+ case Intrinsic::minimumnum:
+ case Intrinsic::maximumnum:
case Intrinsic::is_fpclass:
case Intrinsic::ldexp:
case Intrinsic::frexp:
diff --git a/llvm/test/Transforms/InstCombine/freeze-fp-ops.ll b/llvm/test/Transforms/InstCombine/freeze-fp-ops.ll
index 8bee84f23e147..d1a36dcef4d65 100644
--- a/llvm/test/Transforms/InstCombine/freeze-fp-ops.ll
+++ b/llvm/test/Transforms/InstCombine/freeze-fp-ops.ll
@@ -508,9 +508,9 @@ define float @freeze_maximum(float %arg0, float noundef %arg1) {
define float @freeze_minimumnum(float %arg0, float noundef %arg1) {
; CHECK-LABEL: @freeze_minimumnum(
-; CHECK-NEXT: [[OP:%.*]] = call float @llvm.minimumnum.f32(float [[ARG0:%.*]], float noundef [[ARG1:%.*]])
-; CHECK-NEXT: [[FREEZE:%.*]] = freeze float [[OP]]
-; CHECK-NEXT: ret float [[FREEZE]]
+; CHECK-NEXT: [[FREEZE:%.*]] = freeze float [[OP:%.*]]
+; CHECK-NEXT: [[OP1:%.*]] = call float @llvm.minimumnum.f32(float [[FREEZE]], float noundef [[ARG1:%.*]])
+; CHECK-NEXT: ret float [[OP1]]
;
%op = call float @llvm.minimumnum.f32(float %arg0, float noundef %arg1)
%freeze = freeze float %op
@@ -519,9 +519,9 @@ define float @freeze_minimumnum(float %arg0, float noundef %arg1) {
define float @freeze_maximumnum(float %arg0, float noundef %arg1) {
; CHECK-LABEL: @freeze_maximumnum(
-; CHECK-NEXT: [[OP:%.*]] = call float @llvm.maximumnum.f32(float [[ARG0:%.*]], float noundef [[ARG1:%.*]])
-; CHECK-NEXT: [[FREEZE:%.*]] = freeze float [[OP]]
-; CHECK-NEXT: ret float [[FREEZE]]
+; CHECK-NEXT: [[FREEZE:%.*]] = freeze float [[OP:%.*]]
+; CHECK-NEXT: [[OP1:%.*]] = call float @llvm.maximumnum.f32(float [[FREEZE]], float noundef [[ARG1:%.*]])
+; CHECK-NEXT: ret float [[OP1]]
;
%op = call float @llvm.maximumnum.f32(float %arg0, float noundef %arg1)
%freeze = freeze float %op
|
nikic
approved these changes
May 6, 2025
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.
LGTM
9c7a03f
to
9e6aa16
Compare
Base automatically changed from
users/arsenm/instcombine/add-baseline-tests-minimumnum-maximumnum-freeze
to
main
May 6, 2025 20:24
7fcb159
to
ee4414e
Compare
GeorgeARM
pushed a commit
to GeorgeARM/llvm-project
that referenced
this pull request
May 7, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.