[llvm] [InstCombine] Extend fcmp+select folding to minnum/maxnum intrinsics (PR #112088)

Alexey Bader via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 14 09:19:15 PDT 2024


================
@@ -3834,11 +3834,13 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) {
     // minnum/maxnum intrinsics.
     if (SIFPOp->hasNoNaNs() && SIFPOp->hasNoSignedZeros()) {
       Value *X, *Y;
----------------
bader wrote:

> It's not incorrect, but it doesn't decrease the number of instructions (and extends lifetimes of the inputs)

I agree that it doesn't decrease the number of instructions, but select uses the same inputs as llvm intrinsics + result of `fcmp`. llvm intrinsics doesn't have a dependency on `fcmp`, which should be better. Right?

https://github.com/llvm/llvm-project/pull/112088


More information about the llvm-commits mailing list