[llvm] [InstCombine] Fold select of ordered fcmps of fabs over `isKnownNeverNaN`-selects to a single select (PR #192182)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 21 04:30:15 PDT 2026


================
@@ -3347,6 +3347,89 @@ static Instruction *foldSelectWithFCmpToFabs(SelectInst &SI,
   return ChangedFMF ? &SI : nullptr;
 }
 
+static bool matchIsNotNaNTest(Value *Cond, Value *X, InstCombinerImpl &IC) {
+  Instruction *CmpI;
+  Value *Cmp0, *Cmp1;
+  if (!match(Cond, m_OneUse(m_Instruction(
+                       CmpI, m_SpecificFCmp(FCmpInst::FCMP_ORD, m_Value(Cmp0),
+                                            m_Value(Cmp1))))))
+    return false;
+
+  if (Cmp0 == X && Cmp1 == X)
+    return true;
----------------
imkiva wrote:

Thanks. Fixed

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


More information about the llvm-commits mailing list