Skip to content

Conversation

@nikic
Copy link
Contributor

@nikic nikic commented Nov 25, 2024

This shouldn't be necessary anymore now that SPF patterns are canonicalized to intrinsics.

This shouldn't be necessary anymore now that SPF patterns are
canonicalized to intrinsics.
@nikic nikic marked this pull request as ready for review November 25, 2024 10:45
@nikic nikic requested review from dtcxzyw and goldsteinn November 25, 2024 10:46
@llvmbot llvmbot added llvm:instcombine Covers the InstCombine, InstSimplify and AggressiveInstCombine passes llvm:transforms labels Nov 25, 2024
@nikic
Copy link
Contributor Author

nikic commented Nov 25, 2024

No changes on llvm-opt-benchmark.

@llvmbot
Copy link
Member

llvmbot commented Nov 25, 2024

@llvm/pr-subscribers-llvm-transforms

Author: Nikita Popov (nikic)

Changes

This shouldn't be necessary anymore now that SPF patterns are canonicalized to intrinsics.


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

1 Files Affected:

  • (modified) llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp (-9)
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
index 6c2554ea73b7f8..7221c987b98219 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -786,15 +786,6 @@ Instruction *InstCombinerImpl::visitTrunc(TruncInst &Trunc) {
     }
   }
 
-  // Test if the trunc is the user of a select which is part of a
-  // minimum or maximum operation. If so, don't do any more simplification.
-  // Even simplifying demanded bits can break the canonical form of a
-  // min/max.
-  Value *LHS, *RHS;
-  if (SelectInst *Sel = dyn_cast<SelectInst>(Src))
-    if (matchSelectPattern(Sel, LHS, RHS).Flavor != SPF_UNKNOWN)
-      return nullptr;
-
   // See if we can simplify any instructions used by the input whose sole
   // purpose is to compute bits we don't care about.
   if (SimplifyDemandedInstructionBits(Trunc))

Copy link
Member

@dtcxzyw dtcxzyw left a comment

Choose a reason for hiding this comment

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

LGTM.

@nikic nikic merged commit 4d8eb00 into llvm:main Nov 25, 2024
13 checks passed
@nikic nikic deleted the instcombine-trunc-spf branch November 25, 2024 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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