On 10/26/2015 11:40 AM, Kyrill Tkachov wrote:
In the FORM_POST_ADD case the pass transforms:
*a
...
b <- a + c
into
b <- a
...
*(b += c) post
However, the code in attempt_change that compares the costs of the
before and after sequences
has an oversight. When calculating the cost of the new sequence it
doesn't take into account the cost of the
b <- a move. This patch fixes the calculation by calling seq_cost on the
result of the emit_move_insn call
we do to emit that move.
But isn't that balanced by the fact that it doesn't seem to take into
account the gain of removing the inc_insn either? So I think this can't
be right.
+ new_mov_cost = seq_cost (mov_insn, speed);
+ }
+
+ new_cost = new_mem_cost + new_mov_cost;
Here I'd just replace the first line with
new_cost += seq_cost (...)
and lose the extra variable.
I seem to recall Richard had a rewrite of all the autoinc code. I wonder
what happened to that?
Bernd