[PATCH] Reassociate in favor of grouping previously paired operands

Daniel Berlin dberlin at dberlin.org
Mon Jun 8 16:54:31 PDT 2015


On Mon, Jun 8, 2015 at 4:23 PM, Xuetian Weng <xweng at google.com> wrote:
> Related discussion and original patch on llvmdev.
>
> http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-May/085246.html
>
> There are some differences between the original patch and this version:
>
> 1. Because OptimizeExpression has some assumptions about the order of linearized ops, in this version the order of operands is adjusted after calling function OptimizeExpression.
> 2. Because RewriteExprTree can only pair the last two operands in Ops, in this patch the order of operands is not adjusted by rank but by simply moving one pair of operands to the end of Ops.

This seems a bit more dangerous?
In effect, you are changing the rank.  Tying this to rewritexprtree's
current implementation seems like asking for bugs in the fuure
> 3. Paired operands are indexed with their corresponding Opcode and Instruction. So (add a, b) will not make a, b together in a multiplication expression.

What is the downside to trying to keep operands together that appear
together in some other operation?

By doing this, you are effectively giving an operand different ranks
in different operations.

> 7. Last pairing map is cleared after processing every basic block.

Why?
This just seems wrong?



More information about the llvm-commits mailing list