[PATCH] D156579: InstCombine: Fold fneg (ldexp x, n) -> ldexp (fneg x), n

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 28 18:00:06 PDT 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:2532
 
-  if (match(FNeg, m_OneUse(m_FDiv(m_Value(X), m_Value(Y)))))
+  if (match(FNeg, m_FDiv(m_Value(X), m_Value(Y))))
     return BinaryOperator::CreateFDivFMF(Builder.CreateFNegFMF(X, &I), Y, &I);
----------------
Seems like 2 changes at once? The change to oneuse checks of `(fneg (fmul/fdiv))` and the new transform. Maybe split?


================
Comment at: llvm/test/Transforms/InstCombine/fneg.ll:989
+  ret float %neg
+}
+
----------------
Can you precommit the tests?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156579/new/

https://reviews.llvm.org/D156579



More information about the llvm-commits mailing list