HomePhabricator

[InstCombine] Negator: 0 - (X + Y) --> (-X) - Y iff a single operand negated

Authored by lebedev.ri on Aug 5 2020, 9:17 AM.

Description

[InstCombine] Negator: 0 - (X + Y) --> (-X) - Y iff a single operand negated

This was the most obvious regression in
f5df5cd5586ae9cfb2d9e53704dfc76f47aff149.f5df5cd5586ae9cfb2d9e53704dfc76f47aff149

We really don't want to do this if the original/outermost subtraction
isn't a negation, and therefore doesn't go away - just sinking negation
isn't a win. We are actually appear to be missing folds so hoist it.

https://rise4fun.com/Alive/tiVe

Details

Committed
lebedev.riAug 5 2020, 10:01 AM
Parents
rG26f79e258ffd: [NFC][InstCombine] Tests for negation of `add` w/ single negatible operand
Branches
Unknown
Tags
Unknown