[InstCombine] fneg(X + C) --> -C - X
authorSanjay Patel <spatel@rotateright.com>
Wed, 22 Jan 2020 14:29:19 +0000 (09:29 -0500)
committerSanjay Patel <spatel@rotateright.com>
Wed, 22 Jan 2020 14:48:43 +0000 (09:48 -0500)
commit0ade2abdb01f4a16b1f08d1a78d664b9e9d5f3b5
treed4960f9035b9e9a002dd622df163512c90450f7a
parentdc69265eea888e8c6255aebcdd6650420dd00cfb
[InstCombine] fneg(X + C) --> -C - X

This is 1 of the potential folds uncovered by extending D72521.

We don't seem to do this in the backend either (unless I'm not
seeing some target-specific transform).

icc and gcc (appears to be target-specific) do this transform.

Differential Revision: https://reviews.llvm.org/D73057
llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
llvm/test/Transforms/InstCombine/fneg.ll