[PATCH] D62013: [InstSimplify] Add unary fneg to `fsub 0.0, (fneg X) ==> X` transform

Cameron McInally via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 16 11:40:32 PDT 2019


cameron.mcinally marked an inline comment as done.
cameron.mcinally added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:4372
 
-  // fsub 0.0, (fsub 0.0, X) ==> X if signed zeros are ignored.
+  // fsub 0.0, (fneg X) ==> X if signed zeros are ignored.
   if (FMF.noSignedZeros() && match(Op0, m_AnyZeroFP()) &&
----------------
arsenm wrote:
> Should keep the original comment, and add another line for the fneg case since both are handled
That's a fair change. 

There is some clunkiness here though, since an FSub(+-0.0. X) should match to an FNeg under NSZ. However, the PatternMatcher doesn't currently have a good way to match that pattern when the FMFs are inferred from a different instruction. Just FYI.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62013





More information about the llvm-commits mailing list