[llvm] [InstCombine] Fold copysign of selects from sign comparison to sign operand (PR #85627)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 00:31:26 PDT 2024


================
@@ -2479,6 +2479,42 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
     if (match(Mag, m_FAbs(m_Value(X))) || match(Mag, m_FNeg(m_Value(X))))
       return replaceOperand(*II, 0, X);
 
+    Value *A, *B;
+    CmpInst::Predicate Pred;
+    const APFloat *TC, *FC;
+    if (!match(Sign, m_Select((m_And(m_FCmp(Pred, m_Value(A), m_PosZeroFP()),
+                                     m_Value(B))),
----------------
arsenm wrote:

```suggestion
    if (!match(Sign, m_Select(m_And(m_FCmp(Pred, m_Value(A), m_PosZeroFP()),
                                     m_Value(B)),
```

Extra pair of parentheses?

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


More information about the llvm-commits mailing list