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

Harrison Hao via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 3 09:21:32 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);
----------------
harrisonGPU wrote:

Case 1 is the positive test: the new fdiv keeps ninf. Case 2 is the negative test: the fadd's ninf must not be propagated to the new fdiv.

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


More information about the llvm-commits mailing list