HomePhabricator

[DAGCombiner] cancel fnegs from multiplied operands of FMA

Authored by spatel on Aug 27 2019, 8:17 AM.

Description

[DAGCombiner] cancel fnegs from multiplied operands of FMA

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

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

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

And it might be beneficial to make the constraint less conservative (eg, if both
operands are cheap, but not necessarily cheaper), but that causes infinite looping
for the existing fmul transform.

Differential Revision: https://reviews.llvm.org/D66755

llvm-svn: 370071

Details

Committed
spatelAug 27 2019, 8:17 AM
Differential Revision
D66755: [DAGCombiner] cancel fnegs from multiplied operands of FMA
Parents
rGfc056950aa02: Handle local commons for XCOFF object file writing
Branches
Unknown
Tags
Unknown