[llvm] [InstCombine] Drop wrong ninf for `(-X / Y) + Z` (PR #228684)

via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 3 12:12:18 PDT 2026


================
@@ -2167,7 +2167,9 @@ Instruction *InstCombinerImpl::visitFAdd(BinaryOperator &I) {
                          m_Value(Z))) ||
       match(&I, m_c_FAdd(m_OneUse(m_FDiv(m_Value(X), m_FNeg(m_Value(Y)))),
                          m_Value(Z)))) {
-    Value *XY = Builder.CreateFDivFMF(X, Y, &I);
+    Value *Div = I.getOperand(0);
----------------
suogesi wrote:

It turns out that this fix is bad because `match` expression can swap operators so the first operator is not always `fdiv` instruction. I'm using `dyn_cast` to check `LHS` and `RHS` now.

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


More information about the llvm-commits mailing list