This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [vta, graphite?] propagate degenerate phi nodes into debug stmts
On Mon, Nov 16, 2009 at 9:41 PM, Alexandre Oliva <aoliva@redhat.com> wrote:
> On Nov ?8, 2009, Richard Guenther <richard.guenther@gmail.com> wrote:
>
>> For the rest it would be better to re-organize the code as
>
>> ? ?else if (gimple_code (def_stmt) == PHI_NODE)
>> ? ? ?{
>> ? ? ? ? value = degenerate_phi_result (def_stmt);
>> ? ? ? ? if (value
>> ? ? ? ? ? ? && walk_tree (&value, find_released_ssa_name, NULL, NULL))
>> ? ? ? ? ? value = NULL_TREE;
>> ? ? ?}
>
>> that looks simpler and it avoids walking PHI args uselessly.
>
> That doesn't work. ?We crash deep within degenerate_phi_result given
> expressions containing released SSA names. ?It's the same reason why we
> have to test for released SSA names before calling
> gimple_assign_rhs_to_tree: IIRC it has to do with testing whether the
> already-NULL type of the SSA name is a pointer type.
Well, just adjust degenerate_phi_result to do instead of calling
operand_equal_p
else if (TREE_CODE (arg) != TREE_CODE (val)
|| (TREE_CODE (arg) == SSA_NAME
&& arg != val)
|| !operand_equal_p (arg, val, 0))
break;
that should fix it. Alternatively add the SSA_NAME shortcut
to operand_equal_p.
> Regardless, I reorganized the code so as to not have to test for
> PHI_NODEs as often. ?There were two unrelated code paths intermixed with
> tests every now and again. ?Now they're two separate code flows.
>
>> @@ -479,6 +508,13 @@ insert_debug_temps_for_defs (gimple_stmt
>
>> ? ?stmt = gsi_stmt (*gsi);
>
>> + ?if (gimple_code (stmt) == GIMPLE_PHI)
>> + ? ?{
>> + ? ? ?tree var = gimple_phi_result (stmt);
>> + ? ? ?insert_debug_temp_for_var_def (gsi, var);
>> + ? ? ?return;
>> + ? ?}
>> +
>
>> This looks odd. ?SSA DEF operand iteration should walk the PHI defs
>> as well, so the change should not be necessary.
>
> I thought so, too, but by the time we get there, the operands of the PHI
> stmt have already been disconnected.
It shouldn't be. Please try to figure out why instead.
Thanks,
Richard.
> Here's what I'm going to test now.
>
>
>
> --
> Alexandre Oliva, freedom fighter ? ?http://FSFLA.org/~lxoliva/
> You must be the change you wish to see in the world. -- Gandhi
> Be Free! -- http://FSFLA.org/ ? FSF Latin America board member
> Free Software Evangelist ? ? ?Red Hat Brazil Compiler Engineer
>
>