This is an archive of the discontinued LLVM Phabricator instance.

DAG: Fold fma (fneg x), K, y -> fma x, -K, y
ClosedPublic

Authored by arsenm on Oct 25 2017, 2:40 AM.

Details

Reviewers
escha
RKSimon

Diff Detail

Event Timeline

arsenm created this revision.Oct 25 2017, 2:40 AM
RKSimon added a subscriber: RKSimon.
RKSimon added inline comments.
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
10128

Do we need a OneUse test on FNEG(N0)?

arsenm updated this revision to Diff 120222.Oct 25 2017, 3:17 AM

Fix PPC test failures

lib/CodeGen/SelectionDAG/DAGCombiner.cpp
10128

I don't think so because this eliminates a use of fneg.

RKSimon added inline comments.Oct 25 2017, 7:23 AM
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
10128

Do we need a OneUse test on FNEG(N0)?

I don't think so because this eliminates a use of fneg.

OK - what about permitting negations of FpImmLegal constants if the negated value is FpImmLegal too?

arsenm added inline comments.Oct 25 2017, 7:34 AM
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
10128

As far as I can tell no target does anything that would allow the negated value to become legal, so it doesn't seem worth the effort

spatel added a subscriber: spatel.Oct 26 2017, 1:23 PM
RKSimon accepted this revision.Oct 26 2017, 2:12 PM

LGTM

This revision is now accepted and ready to land.Oct 26 2017, 2:12 PM
arsenm closed this revision.Oct 27 2017, 2:06 AM

r316753