Patchwork Modify TER to not propagate expressions across call

login
register
mail settings
Submitter Pat Haugen
Date Oct. 18, 2010, 10:16 p.m.
Message ID <4CBCC750.3030408@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/68243/
State New
Headers show

Comments

Pat Haugen - Oct. 18, 2010, 10:16 p.m.
On 10/18/2010 4:33 AM, Richard Guenther wrote:
>
>> The NOT operation used to be propagated into the AND operation; it isn't any
>> more after the patch.  Now this propagation was a complete win: an SSA name
>> was eliminated and lifetimes didn't change globally.
>>
>> Could the patch be tweaked so as to fix the pessimization this case?
> We could allow the TER if the operation just has a single operand as
> that doesn't pessimize register allocation across calls

The following appears to work, if it's the right approach I can 
bootstrap/regtest.

               else
                 mark_replaceable (tab, use, stmt_replaceable);
Richard Guenther - Oct. 19, 2010, 10:21 a.m.
On Tue, Oct 19, 2010 at 12:16 AM, Pat Haugen
<pthaugen@linux.vnet.ibm.com> wrote:
>  On 10/18/2010 4:33 AM, Richard Guenther wrote:
>>
>>> The NOT operation used to be propagated into the AND operation; it isn't
>>> any
>>> more after the patch.  Now this propagation was a complete win: an SSA
>>> name
>>> was eliminated and lifetimes didn't change globally.
>>>
>>> Could the patch be tweaked so as to fix the pessimization this case?
>>
>> We could allow the TER if the operation just has a single operand as
>> that doesn't pessimize register allocation across calls
>
> The following appears to work, if it's the right approach I can
> bootstrap/regtest.

Yes, that looks good.  Please fix formatting problems while you
are there (|| and && go on the next line, watch long lines).

Thanks,
Richard.

> Index: tree-ssa-ter.c
> ===================================================================
> --- tree-ssa-ter.c      (revision 165656)
> +++ tree-ssa-ter.c      (working copy)
> @@ -645,7 +645,8 @@ find_replaceable_in_bb (temp_expr_table_
>                 substitution list, or the def and use span a call such that
>                 we'll expand lifetimes across a call.  */
>              if (gimple_has_volatile_ops (stmt) || same_root_var ||
> -                 tab->call_cnt[ver] != cur_call_cnt)
> +                 (tab->call_cnt[ver] != cur_call_cnt &&
> +                  SINGLE_SSA_USE_OPERAND (SSA_NAME_DEF_STMT (use),
> SSA_OP_USE) == NULL_USE_OPERAND_P))
>                finished_with_expr (tab, ver, true);
>              else
>                mark_replaceable (tab, use, stmt_replaceable);
>
>
>

Patch

Index: tree-ssa-ter.c
===================================================================
--- tree-ssa-ter.c      (revision 165656)
+++ tree-ssa-ter.c      (working copy)
@@ -645,7 +645,8 @@  find_replaceable_in_bb (temp_expr_table_
                  substitution list, or the def and use span a call such 
that
                  we'll expand lifetimes across a call.  */
               if (gimple_has_volatile_ops (stmt) || same_root_var ||
-                 tab->call_cnt[ver] != cur_call_cnt)
+                 (tab->call_cnt[ver] != cur_call_cnt &&
+                  SINGLE_SSA_USE_OPERAND (SSA_NAME_DEF_STMT (use), 
SSA_OP_USE) == NULL_USE_OPERAND_P))
                 finished_with_expr (tab, ver, true);