[PATCH] D50417: [InstCombine] fold fneg into constant operand of fmul/fdiv

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 7 16:29:13 PDT 2018


spatel created this revision.
spatel added reviewers: mcberg2017, arsenm, wristow.
Herald added subscribers: wdng, mcrosier.

I think this is the missing IR fold noted in https://reviews.llvm.org/D50195, but AFAICT, we don't need any fast-math to enable the transform. FP negation can always be folded into an fmul/fdiv constant to eliminate the fneg.

I've limited this to one-use to ensure that we are eliminating an instruction rather than replacing fneg by a potentially expensive fdiv or fmul.


https://reviews.llvm.org/D50417

Files:
  lib/Transforms/InstCombine/InstCombineAddSub.cpp
  test/Transforms/InstCombine/fneg.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50417.159621.patch
Type: text/x-patch
Size: 6663 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180807/5e0c6108/attachment.bin>


More information about the llvm-commits mailing list