Modify TER to not propagate expressions across call

Message ID
State New
Headers show

Commit Message

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
> <>  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 <>

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

                 mark_replaceable (tab, use, stmt_replaceable);


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 
                  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
+                        == NULL_USE_OPERAND_P))
                 finished_with_expr (tab, ver, true);