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

via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 3 09:02:12 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:

There are 4 combinations about `ninf`:

1. div with `ninf`, add with `ninf`.
2. div without `ninf`, add with `ninf`.
3. div with `ninf`, add without `ninf`.
4. div without `ninf`, add without `ninf`.

This PR is trying to fix 2. For this pass, I want to know which of them should be called "positive test" and which of them should be called "negative test"?

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


More information about the llvm-commits mailing list