Patchwork Modify TER to not propagate expressions across call

login
register
mail settings
Submitter Pat Haugen
Date Oct. 20, 2010, 7:03 p.m.
Message ID <4CBF3D1F.3090901@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/68465/
State New
Headers show

Comments

Pat Haugen - Oct. 20, 2010, 7:03 p.m.
On 10/19/2010 5:21 AM, Richard Guenther wrote:
> 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).
>

Bootstrap/regtest went fine. Fixed the formatting problems and committed 
the following as rev 165733.


2010-10-20  Pat Haugen <pthaugen@us.ibm.com>

     * tree-ssa-ter.c (find_replaceable_in_bb): Allow replacement over
     call for single operand expression.

               else
                 mark_replaceable (tab, use, stmt_replaceable);

Patch

Index: gcc/tree-ssa-ter.c
===================================================================
--- gcc/tree-ssa-ter.c  (revision 165699)
+++ gcc/tree-ssa-ter.c  (working copy)
@@ -644,8 +644,10 @@  find_replaceable_in_bb (temp_expr_table_
                  def variable has the same root variable as something 
in the
                  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)
+             if (gimple_has_volatile_ops (stmt) || same_root_var
+                 || (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);