Skip to content

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented May 6, 2025

No description provided.

@arsenm arsenm added the llvm:analysis Includes value tracking, cost tables and constant folding label May 6, 2025 — with Graphite App
@arsenm arsenm marked this pull request as ready for review May 6, 2025 17:43
@arsenm arsenm requested a review from nikic as a code owner May 6, 2025 17:43
Copy link
Contributor Author

arsenm commented May 6, 2025

@llvmbot llvmbot added llvm:instcombine Covers the InstCombine, InstSimplify and AggressiveInstCombine passes llvm:transforms labels May 6, 2025
@llvmbot
Copy link
Member

llvmbot commented May 6, 2025

@llvm/pr-subscribers-llvm-transforms

@llvm/pr-subscribers-llvm-analysis

Author: Matt Arsenault (arsenm)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/138729.diff

2 Files Affected:

  • (modified) llvm/lib/Analysis/ValueTracking.cpp (+2)
  • (modified) llvm/test/Transforms/InstCombine/freeze-fp-ops.ll (+6-6)
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

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor Author

arsenm commented May 6, 2025

Merge activity

  • May 6, 4:19 PM EDT: A user started a stack merge that includes this pull request via Graphite.
  • May 6, 4:25 PM EDT: Graphite rebased this pull request as part of a merge.
  • May 6, 4:26 PM EDT: @arsenm merged this pull request with Graphite.

@arsenm arsenm force-pushed the users/arsenm/instcombine/add-baseline-tests-minimumnum-maximumnum-freeze branch from 9c7a03f to 9e6aa16 Compare May 6, 2025 20:21
Base automatically changed from users/arsenm/instcombine/add-baseline-tests-minimumnum-maximumnum-freeze to main May 6, 2025 20:24
@arsenm arsenm force-pushed the users/arsenm/valuetracking/handle-minimumnum-maximumnum-canCreateUndefOrPoison branch from 7fcb159 to ee4414e Compare May 6, 2025 20:24
@arsenm arsenm merged commit 51e157f into main May 6, 2025
4 of 5 checks passed
@arsenm arsenm deleted the users/arsenm/valuetracking/handle-minimumnum-maximumnum-canCreateUndefOrPoison branch May 6, 2025 20:26
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
Labels
llvm:analysis Includes value tracking, cost tables and constant folding llvm:instcombine Covers the InstCombine, InstSimplify and AggressiveInstCombine passes llvm:transforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants