[llvm] [InstCombine] Don't convert a compare+select into a minnum/maxnum intrinsic that can't be lowered back to a compare+select (PR #177821)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 25 00:35:55 PST 2026
================
@@ -4357,7 +4357,21 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) {
// Canonicalize select of FP values where NaN and -0.0 are not valid as
// minnum/maxnum intrinsics.
- if (SIFPOp->hasNoNaNs() &&
+ if (FCmp && SIFPOp->hasNoNaNs() &&
+ // In order to preserve the nnan flag on the generated intrinsic call,
+ // the nnan flag must be present on both the compare *and* the select
----------------
nikic wrote:
This doesn't sound right: Shouldn't we require the nnan flag *only* on the fcmp? Poison in the select condition will propagate.
https://github.com/llvm/llvm-project/pull/177821
More information about the llvm-commits
mailing list