[PATCH] D62629: [InstCombine] Update fptrunc (fneg x)) -> (fneg (fptrunc x) for unary FNeg

Cameron McInally via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 29 14:22:09 PDT 2019


cameron.mcinally created this revision.
cameron.mcinally added reviewers: spatel, craig.topper, arsenm, kpn, andrew.w.kaylor.
Herald added subscribers: llvm-commits, hiraditya, wdng.
Herald added a project: LLVM.
craig.topper added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:1625
+    Value *InnerTrunc = Builder.CreateFPTrunc(X, Ty);
+    return BinaryOperator::CreateFNegFMF(InnerTrunc, cast<Instruction>(Op));
   }
----------------
If you started with a unary fneg, shouldn't we end up with a unary fneg?


Move the binary FNEG combine so that it also applies to unary FNeg.


Repository:
  rL LLVM

https://reviews.llvm.org/D62629

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
  llvm/test/Transforms/InstCombine/fpcast.ll
  llvm/test/Transforms/InstCombine/fpextend.ll
  llvm/test/Transforms/InstCombine/fsub.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62629.202054.patch
Type: text/x-patch
Size: 5385 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190529/56f75d60/attachment.bin>


More information about the llvm-commits mailing list