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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 16 09:21:08 PDT 2026


================
@@ -3347,6 +3347,106 @@ static Instruction *foldSelectWithFCmpToFabs(SelectInst &SI,
   return ChangedFMF ? &SI : nullptr;
 }
 
+static bool matchIsNaNTest(FCmpInst *Cmp, Value *X, bool MatchIsNaN,
+                           InstCombinerImpl &IC) {
+  FCmpInst::Predicate ExpectedPred =
----------------
arsenm wrote:

Do you actually need to handle both cases? I thought instcombine was biased towards replacing select fcmps with the ordered compares 

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


More information about the llvm-commits mailing list