[LLVMbugs] Reassociation Transform

Chris Lattner sabre at nondot.org
Thu Oct 31 09:25:15 PST 2002

>    3. ReassociateExpr was changing (a+b)+c into a+(b+c), which is a
>       problem of the definition of c does not dominate (b+c).  I fixed
>       this by creating a new instruction for (b+c) and inserting it just
>       before the instruction that calculates a+(b+c).  I'm confident
>       that this approach is correct, but may increase register pressure
>       since it may extend the live ranges of b&c.
>    4. I wiggled the main loop in ReassociateBB around a bit to try and
>       preserve instruction names.  Placing the Sub test before the
>       reassociate test makes the iterator manipulation simpler.

Sounds great to me.  Note that this patch exposes a latent bug in
BinaryOperator::isNeg, so make sure you apply this as well:

Here's the reassociate patch:

Here we reenable reassociate in gccas:

... and in the sparc backend:

Thanks again!



More information about the llvm-bugs mailing list