Skip to content

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
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
2 changes: 2 additions & 0 deletions llvm/lib/Analysis/ValueTracking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 6 additions & 6 deletions llvm/test/Transforms/InstCombine/freeze-fp-ops.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down