On 03/17/2015 06:32 AM, Benedikt Huber wrote:
Hi,
I have a problem with a transformation pass I wrote.
The pass is meant to pipeline and unroll lookups in linked lists.
After my pass is run, gcc renames a variable, which leads to wrong results.
Part of my pass's dump, which is as I want it.
...
<bb 19>:
list_38 = list_10->next;
_22 = list_10->info;
_36 = _22->idx;
if (_5 != _36)
goto <bb 16>;
else
goto <bb 14>;
<bb 16>:
goto <bb 12>;
<bb 14>:
# list_13 = PHI <list_6(D)(6), list_34(13), 0B(12), 0B(5), 0B(18),
list_10(19)>
...
Corresponding part of the following pass. (list_join.c.148t.fab1)
..
SSA replacement table
N_i -> { O_1 ... O_j } means that N_i replaces O_1, ..., O_j
_1 -> { _17 }
_12 -> { _16 }
_14 -> { _18 }
_22 -> { _7 }
_25 -> { _19 }
_36 -> { _8 }
list_38 -> { list_10 }
list_41 -> { list_15 }
_42 -> { _20 }
...
<bb 19>:
list_38 = list_10->next;
_22 = list_38->info;
_36 = _22->idx;
if (_5 != _36)
goto <bb 16>;
else
goto <bb 14>;
<bb 16>:
goto <bb 12>;
<bb 14>:
# list_13 = PHI <list_6(D)(6), list_34(13), 0B(12), 0B(5), 0B(18),
list_38(19)>
...
As you can see, gcc renames list_10 to list_38 in two places, which is not what
I want.
Why does gcc think this is possible. It seems to me that I need to update some
data structure
which I don't know of. What am I missing?
I already did an updated_stmt in the places where I edit gimple statements.
If I specify TODO_update_ssa, the same renaming already takes place in my pass.
bb 19 is a copy of another basic block, maybe this is of relevance.
Fundamentally SSA_NAMEs appearing in the graph are allowed only a single
static assignment. Thus if you copy a block all SSA_NAMEs in the block
have to go through an SSA update to ensure that each has one and only
one single static assignment.
jeff