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

Eli Friedman eli.friedman at gmail.com
Wed Dec 12 18:41:43 PST 2012


On Wed, Dec 12, 2012 at 4:58 PM, Shuxin Yang <shuxin.llvm at gmail.com> wrote:
> I just re-read the InstCombiner::SimplifyAssociateOrCommutative().
> It is pretty simple, it can only handle adjacent instructions with exactly
> the same opcode.
> (1*5 * x) - x is certainly beyond its scope.

instcombine uses a different codepath to handle (5*x) - x in
particular; see dyn_castFoldableMul in InstCombineAddSub.cpp .  And
InstCombiner::SimplifyUsingDistributiveLaws can handle 5*x+5*x.  (Not
sure what the 1 is doing in your example.)

> Do we need to expand it to be more capable?  I don't like this idea because

We are capable of performing all the transformations from your
original email on integer +/-/*.

-Eli



More information about the llvm-commits mailing list