[PATCH 1/3] Call recompute_tree_invariant_for_addr_expr when replacing a constant in an ADDR_EXPR.

Sebastian Pop sebpop@gmail.com
Wed Nov 24 01:10:00 GMT 2010


On Tue, Nov 23, 2010 at 06:45, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Tue, Nov 23, 2010 at 12:18 AM, Sebastian Pop <sebpop@gmail.com> wrote:
>> Committed to the graphite branch.
>>
>> 2010-11-22  Sebastian Pop  <sebastian.pop@amd.com>
>>
>>        * sese.c (rename_uses): Call recompute_tree_invariant_for_addr_expr
>>        when replacing a constant in an ADDR_EXPR.
>> ---
>>  gcc/ChangeLog.graphite |    5 +++++
>>  gcc/sese.c             |   13 +++++++++++++
>>  2 files changed, 18 insertions(+), 0 deletions(-)
>>
>> diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
>> index c2da86f..e5df72e 100644
>> --- a/gcc/ChangeLog.graphite
>> +++ b/gcc/ChangeLog.graphite
>> @@ -1,3 +1,8 @@
>> +2010-11-22  Sebastian Pop  <sebastian.pop@amd.com>
>> +
>> +       * sese.c (rename_uses): Call recompute_tree_invariant_for_addr_expr
>> +       when replacing a constant in an ADDR_EXPR.
>> +
>>  2010-10-20  Sebastian Pop  <sebastian.pop@amd.com>
>>
>>        * graphite-blocking.c (lst_do_strip_mine_loop): Extra parameter
>> diff --git a/gcc/sese.c b/gcc/sese.c
>> index ffcb51c..dbb0cd7 100644
>> --- a/gcc/sese.c
>> +++ b/gcc/sese.c
>> @@ -547,6 +547,19 @@ rename_uses (gimple copy, htab_t rename_map, gimple_stmt_iterator *gsi_tgt,
>>                                       true, NULL_TREE);
>>       gsi_insert_seq_before (gsi_tgt, stmts, GSI_SAME_STMT);
>>       replace_exp (use_p, new_expr);
>> +
>> +
>> +      if (TREE_CODE (new_expr) == INTEGER_CST)
>> +       {
>> +         tree lhs = gimple_assign_lhs (copy);
>> +         tree rhs = gimple_assign_rhs1 (copy);
>> +
>> +         if (TREE_CODE (lhs) == ADDR_EXPR)
>
> The lhs of an assign can never be ADDR_EXPR.
>

I removed this.

>> +           recompute_tree_invariant_for_addr_expr (lhs);
>> +         if (TREE_CODE (rhs) == ADDR_EXPR)
>> +           recompute_tree_invariant_for_addr_expr (rhs);
>
> And I'm confused anyway - of new_expr is an INTEGER_CST, how
> come it is an ADDR_EXPR?
>

rhs is an ADDR_EXPR and we replace some SSA_NAME that indexes into
that array with a constant:
for instance, I had an ICE when replacing "i" with "9" in A[i], as in
the new form, A[9] is invariant.

Sebastian



More information about the Gcc-patches mailing list