[llvm-commits] [PATCH][FastMath, InstCombine] Fadd/Fsub optimizations

Eli Friedman eli.friedman at gmail.com
Mon Dec 17 15:28:10 PST 2012


On Mon, Dec 17, 2012 at 3:10 PM, Shuxin Yang <shuxin.llvm at gmail.com> wrote:
> HI, Eli:
>
>
>      I understand the idea.  Actually each individual is no-brainer,
> however, the # of combination is
> big.  Take this case as example,  we need to clone similar code for fsub. In
> the case of (x+y) + (y-x),
> what if the both (x+y) and (y-x) have multiple use, simplify this expr into
> 2*y does not save instruction
> at all.

Even if it doesn't save any instructions by itself, we still want to
do it: it could lead to further simplifications, and it leads to a
shallower instruction tree, which allows for more flexible scheduling.

> On the other hand, you change need to take two steps to simplify the expr,
> my change is able to handle in one shot.

Yes, your change does have the advantage that it's much more
straightforward to reason about what it does and does not simplify.

-Eli



More information about the llvm-commits mailing list