This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombiner] cancel fnegs from multiplied operands of FMA
ClosedPublic

Authored by spatel on Aug 26 2019, 10:36 AM.

Details

Summary

(-X) * (-Y) + Z --> X * Y + Z

This is a missing optimization that shows up as a potential regression in D66050, so I think we should solve it first. We appear to be partly missing this fold in IR as well.

We do handle the simpler case of:
(-X) * (-Y) --> X * Y

Diff Detail

Event Timeline

spatel created this revision.Aug 26 2019, 10:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 26 2019, 10:36 AM
cameron.mcinally accepted this revision.Aug 26 2019, 1:19 PM

LGTM.

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
12282

Maybe a comment here? Not critical though...

Something like: -X * -Y + Z --> X * Y + Z

This revision is now accepted and ready to land.Aug 26 2019, 1:19 PM
This revision was automatically updated to reflect the committed changes.