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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 13 23:10:18 PDT 2024


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

It's a bit clumsy to have to match the two. If we're going to have dedicated matchers for it, is it worth having an OrdOrUnord variant? 

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


More information about the llvm-commits mailing list