[PATCH] Add un-distribution capabilities to tree reassoc (3rd try)

Xinliang David Li davidxl@google.com
Fri Aug 15 16:52:00 GMT 2008


Richard Guenther wrote:
> On Thu, 14 Aug 2008, Xinliang David Li wrote:
> 
>>>>>          lhs = gimple_assign_lhs (stmt);
>>>>>          rhs1 = gimple_assign_rhs1 (stmt);
>>>>> --- 1760,1775 ----
>>>>>          /* If this was part of an already processed statement,
>>>>>             we don't need to touch it again. */
>>>>>          if (gimple_visited_p (stmt))
>>>>> !           {
>>>>> !             /* This statement might have become dead because of
>>>>> previous
>>>>> !                reassociations.  */
>>>>> !             if (has_zero_uses (gimple_get_lhs (stmt)))
>>>>> !               {
>>>>> !                 gsi_remove (&gsi, true);
>>>>> !                 release_defs (stmt);
>> There seem to be a minor problem -- there needs to be an gsi_end_p check   and
>> break after the removal.
> 
> Just by visual inspection or do you have a testcase?  As we are walking
> from the end of the basic-block to the beginning we shouldn't hit the
> last statement again (note this is guarded by gimple_visited_p).
> 
> Richard.

A statement in dependence chain (lhs subtrees) of the linearized tree 
can become dead due to the OPS list optimizations (including the 
factorization work you did) -- if such a statement is in the first stmt 
in the bb after the phis, gsi_remove will cause the iterator to point to 
the end marker.

The problem is only triggered by some of my independent changes which I 
have not submitted.

Thanks,

David



More information about the Gcc-patches mailing list