]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2012-08-01 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 1 Aug 2012 11:48:56 +0000 (11:48 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 1 Aug 2012 11:48:56 +0000 (11:48 +0000)
* graphite-clast-to-gimple.c (translate_clast_user): Rename
virtual operands.
* sese.c (graphite_copy_stmts_from_block): Do not rename virtual
operands here.
* tree-call-cdce.c (tree_call_cdce): Use
mark_virtual_operands_for_renaming.
* tree-eh.c (sink_clobbers): Simplify.
* tree-flow.h (mark_sym_for_renaming): Remove.
(mark_virtual_operands_for_renaming): New function.
* tree-if-conv.c (tree_if_conversion): Use
mark_virtual_operands_for_renaming.
* tree-inline.c (update_ssa_across_abnormal_edges): Likewise.
* tree-into-ssa.c (mark_sym_for_renaming): Remove.
(mark_virtual_operands_for_renaming): New function.
* tree-loop-distribution.c (tree_loop_distribution): Use
mark_virtual_operands_for_renaming.
* tree-ssa-dce.c (mark_virtual_operand_for_renaming): Do not
update stmts, use mark_virtual_operands_for_renaming.
* tree-ssa-tail-merge.c (release_last_vdef): Remove.
(replace_block_by): Adjust.
(tail_merge_optimize): Use mark_virtual_operands_for_renaming.
* tree-tailcall.c (tree_optimize_tail_calls_1): Use
mark_virtual_operands_for_renaming.
* tree-vect-slp.c (vect_slp_transform_bb): Likewise.
* tree-vectorizer.c (vectorize_loops): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190034 138bc75d-0d04-0410-961f-82ee72b054a4

15 files changed:
gcc/ChangeLog
gcc/graphite-clast-to-gimple.c
gcc/sese.c
gcc/tree-call-cdce.c
gcc/tree-eh.c
gcc/tree-flow.h
gcc/tree-if-conv.c
gcc/tree-inline.c
gcc/tree-into-ssa.c
gcc/tree-loop-distribution.c
gcc/tree-ssa-dce.c
gcc/tree-ssa-tail-merge.c
gcc/tree-tailcall.c
gcc/tree-vect-slp.c
gcc/tree-vectorizer.c

index 1d7faf0a0b4b9b9ab28e9fff680f0b1d9bbdc627..6faadd93ae8b57e57cef8e0f58fc920a235a66ed 100644 (file)
@@ -1,3 +1,31 @@
+2012-08-01  Richard Guenther  <rguenther@suse.de>
+
+       * graphite-clast-to-gimple.c (translate_clast_user): Rename
+       virtual operands.
+       * sese.c (graphite_copy_stmts_from_block): Do not rename virtual
+       operands here.
+       * tree-call-cdce.c (tree_call_cdce): Use
+       mark_virtual_operands_for_renaming.
+       * tree-eh.c (sink_clobbers): Simplify.
+       * tree-flow.h (mark_sym_for_renaming): Remove.
+       (mark_virtual_operands_for_renaming): New function.
+       * tree-if-conv.c (tree_if_conversion): Use
+       mark_virtual_operands_for_renaming.
+       * tree-inline.c (update_ssa_across_abnormal_edges): Likewise.
+       * tree-into-ssa.c (mark_sym_for_renaming): Remove.
+       (mark_virtual_operands_for_renaming): New function.
+       * tree-loop-distribution.c (tree_loop_distribution): Use
+       mark_virtual_operands_for_renaming.
+       * tree-ssa-dce.c (mark_virtual_operand_for_renaming): Do not
+       update stmts, use mark_virtual_operands_for_renaming.
+       * tree-ssa-tail-merge.c (release_last_vdef): Remove.
+       (replace_block_by): Adjust.
+       (tail_merge_optimize): Use mark_virtual_operands_for_renaming.
+       * tree-tailcall.c (tree_optimize_tail_calls_1): Use
+       mark_virtual_operands_for_renaming.
+       * tree-vect-slp.c (vect_slp_transform_bb): Likewise.
+       * tree-vectorizer.c (vectorize_loops): Likewise.
+
 2012-08-01  Richard Guenther  <rguenther@suse.de>
 
        * tree-flow.h (struct gimple_df): Remove syms_to_rename member,
index 103a639b674927c311a36d9c2a39519cfd4eb256..42f96c716af07d778cbe63ad711f7497755eef41 100644 (file)
@@ -1099,6 +1099,7 @@ translate_clast_user (struct clast_user_stmt *stmt, edge next_e,
 
   new_bb = next_e->src;
   mark_bb_with_pbb (pbb, new_bb, bb_pbb_mapping);
+  mark_virtual_operands_for_renaming (cfun);
   update_ssa (TODO_update_ssa);
 
   return next_e;
index 03b9f3d62aa50afc0d20e0c6f3cda8721ee8c5d4..acae527b91bfcc72d9e78fedf247632af5f696c9 100644 (file)
@@ -604,7 +604,6 @@ graphite_copy_stmts_from_block (basic_block bb, basic_block new_bb,
         operands.  */
       copy = gimple_copy (stmt);
       gsi_insert_after (&gsi_tgt, copy, GSI_NEW_STMT);
-      mark_sym_for_renaming (gimple_vop (cfun));
 
       maybe_duplicate_eh_stmt (copy, stmt);
       gimple_duplicate_stmt_histograms (cfun, copy, cfun, stmt);
index 3ad241cf29ddd47ad8384e8e7a98a2bfb858c96e..06abda524878c7b1a168077b512f781d194c9641 100644 (file)
@@ -894,7 +894,7 @@ tree_call_cdce (void)
       free_dominance_info (CDI_POST_DOMINATORS);
       /* As we introduced new control-flow we need to insert PHI-nodes
          for the call-clobbers of the remaining call.  */
-      mark_sym_for_renaming (gimple_vop (cfun));
+      mark_virtual_operands_for_renaming (cfun);
       return (TODO_update_ssa | TODO_cleanup_cfg | TODO_ggc_collect
               | TODO_remove_unused_locals);
     }
index a5dce621d12e6a8e61884389431672387ff4c032..bd9294dedc5d41949d5f2a5648e703c3dfc3220b 100644 (file)
@@ -3250,22 +3250,18 @@ sink_clobbers (basic_block bb)
   for (gsi_prev (&gsi); !gsi_end_p (gsi); gsi_prev (&gsi))
     {
       gimple stmt = gsi_stmt (gsi);
-      tree vdef;
       if (is_gimple_debug (stmt))
        continue;
       if (gimple_code (stmt) == GIMPLE_LABEL)
        break;
       unlink_stmt_vdef (stmt);
       gsi_remove (&gsi, false);
-      vdef = gimple_vdef (stmt);
-      if (vdef && TREE_CODE (vdef) == SSA_NAME)
-       {
-         release_ssa_name (vdef);
-         vdef = SSA_NAME_VAR (vdef);
-         mark_sym_for_renaming (vdef);
-         gimple_set_vdef (stmt, vdef);
-         gimple_set_vuse (stmt, vdef);
-       }
+      /* Trigger the operand scanner to cause renaming for virtual
+         operands for this statement.
+        ???  Given the simple structure of this code manually
+        figuring out the reaching definition should not be too hard.  */
+      if (gimple_vuse (stmt))
+       gimple_set_vuse (stmt, NULL_TREE);
       gsi_insert_before (&dgsi, stmt, GSI_SAME_STMT);
     }
 
index 553f22e321e09895e7674203b5755a51c007db9f..04cd2a77669fa611befed891106d5a6d14ad3a3c 100644 (file)
@@ -565,7 +565,7 @@ bool need_ssa_update_p (struct function *);
 bool name_registered_for_update_p (tree);
 void release_ssa_name_after_update_ssa (tree);
 void compute_global_livein (bitmap, bitmap);
-void mark_sym_for_renaming (tree);
+void mark_virtual_operands_for_renaming (struct function *);
 tree get_current_def (tree);
 void set_current_def (tree, tree);
 
index 89747b3a275d91ea01567fd3d968a5b149d47d97..e8a65eab7589e58d78f08f9bf962d44cccb134d0 100644 (file)
@@ -1747,7 +1747,7 @@ tree_if_conversion (struct loop *loop)
   combine_blocks (loop);
 
   if (flag_tree_loop_if_convert_stores)
-    mark_sym_for_renaming (gimple_vop (cfun));
+    mark_virtual_operands_for_renaming (cfun);
 
   changed = true;
 
index 4088e755a8a9ade872207cbf80e265c804bc2c4e..7a9b7e0db9beb595400bc56896675a8eb9b310d9 100644 (file)
@@ -1870,7 +1870,7 @@ update_ssa_across_abnormal_edges (basic_block bb, basic_block ret_bb,
 
            if (!is_gimple_reg (PHI_RESULT (phi)))
              {
-               mark_sym_for_renaming (SSA_NAME_VAR (PHI_RESULT (phi)));
+               mark_virtual_operands_for_renaming (cfun);
                continue;
              }
 
index 0971d01f295da92203901c41dd0c819a57f6d174..995a3a79e32c66ea64562cae5468c9dd8b25976a 100644 (file)
@@ -2944,17 +2944,13 @@ register_new_name_mapping (tree new_tree, tree old)
 }
 
 
-/* Register symbol SYM to be renamed by update_ssa.  */
+/* Mark virtual operands of FN for renaming by update_ssa.  */
 
 void
-mark_sym_for_renaming (tree sym)
+mark_virtual_operands_for_renaming (struct function *fn)
 {
-  if (TREE_CODE (sym) == VAR_DECL
-      && VAR_DECL_IS_VIRTUAL_OPERAND (sym))
-    {
-      cfun->gimple_df->ssa_renaming_needed = 1;
-      cfun->gimple_df->rename_vops = 1;
-    }
+  fn->gimple_df->ssa_renaming_needed = 1;
+  fn->gimple_df->rename_vops = 1;
 }
 
 
index 18df9fbd249917560b2e620932f706798addbfe4..394a38c3dbae1c0c1653ca46972f420477fe33fb 100644 (file)
@@ -1515,7 +1515,7 @@ tree_loop_distribution (void)
 
   if (changed)
     {
-      mark_sym_for_renaming (gimple_vop (cfun));
+      mark_virtual_operands_for_renaming (cfun);
       rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
     }
 
index 4d1b620669f13254e8671d7f01cc2b779723609e..c1db16b7fec0a849830568e92d26a600f6ac04b0 100644 (file)
@@ -995,31 +995,32 @@ propagate_necessity (struct edge_list *el)
 }
 
 /* Replace all uses of NAME by underlying variable and mark it
-   for renaming.  */
+   for renaming.  This assumes the defining statement of NAME is
+   going to be removed.  */
 
 void
 mark_virtual_operand_for_renaming (tree name)
 {
+  tree name_var = SSA_NAME_VAR (name);
   bool used = false;
   imm_use_iterator iter;
   use_operand_p use_p;
   gimple stmt;
-  tree name_var;
 
-  name_var = SSA_NAME_VAR (name);
+  gcc_assert (VAR_DECL_IS_VIRTUAL_OPERAND (name_var));
   FOR_EACH_IMM_USE_STMT (stmt, iter, name)
     {
       FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
         SET_USE (use_p, name_var);
-      update_stmt (stmt);
       used = true;
     }
   if (used)
-    mark_sym_for_renaming (name_var);
+    mark_virtual_operands_for_renaming (cfun);
 }
 
-/* Replace all uses of result of PHI by underlying variable and mark it
-   for renaming.  */
+/* Replace all uses of the virtual PHI result by its underlying variable
+   and mark it for renaming.  This assumes the PHI node is going to be
+   removed.  */
 
 void
 mark_virtual_phi_result_for_renaming (gimple phi)
index 3912ed568b21109076cd4403adc0cc2ec2baab43..ab37336d0c47acbe4d7dbbfccefb576566ae7218 100644 (file)
@@ -812,37 +812,6 @@ same_succ_flush_bbs (bitmap bbs)
     same_succ_flush_bb (BASIC_BLOCK (i));
 }
 
-/* Release the last vdef in BB, either normal or phi result.  */
-
-static void
-release_last_vdef (basic_block bb)
-{
-  gimple_stmt_iterator i;
-
-  for (i = gsi_last_bb (bb); !gsi_end_p (i); gsi_prev_nondebug (&i))
-    {
-      gimple stmt = gsi_stmt (i);
-      if (gimple_vdef (stmt) == NULL_TREE)
-       continue;
-
-      mark_virtual_operand_for_renaming (gimple_vdef (stmt));
-      return;
-    }
-
-  for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
-    {
-      gimple phi = gsi_stmt (i);
-      tree res = gimple_phi_result (phi);
-
-      if (is_gimple_reg (res))
-       continue;
-
-      mark_virtual_phi_result_for_renaming (phi);
-      return;
-    }
-  
-}
-
 /* For deleted_bb_preds, find bbs with same successors.  */
 
 static void
@@ -1477,7 +1446,6 @@ replace_block_by (basic_block bb1, basic_block bb2)
   bb1->frequency = 0;
 
   /* Do updates that use bb1, before deleting bb1.  */
-  release_last_vdef (bb1);
   same_succ_flush_bb (bb1);
 
   delete_basic_block (bb1);
@@ -1654,7 +1622,7 @@ tail_merge_optimize (unsigned int todo)
        }
 
       todo |= (TODO_verify_ssa | TODO_verify_stmts | TODO_verify_flow);
-      mark_sym_for_renaming (gimple_vop (cfun));
+      mark_virtual_operands_for_renaming (cfun);
     }
 
   delete_worklist ();
index ec77c5fbeee2dadf93b5e6361eba80b7370c565a..5de583749f3ec73fcbfe4c3a892ceee120776a48 100644 (file)
@@ -1029,7 +1029,7 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls)
      header of the loop created by tail recursion elimination.  Do so
      by triggering the SSA renamer.  */
   if (phis_constructed)
-    mark_sym_for_renaming (gimple_vop (cfun));
+    mark_virtual_operands_for_renaming (cfun);
 
   if (changed)
     return TODO_cleanup_cfg | TODO_update_ssa_only_virtuals;
index 79a7e3a39c9dd9dd11efaed9143f51411d099229..782172fa80a17e1b30f4f7aa6fb23e308a7ce24e 100644 (file)
@@ -3149,7 +3149,7 @@ vect_slp_transform_bb (basic_block bb)
         }
     }
 
-  mark_sym_for_renaming (gimple_vop (cfun));
+  mark_virtual_operands_for_renaming (cfun);
   /* The memory tags and pointers in vectorized statements need to
      have their SSA forms updated.  FIXME, why can't this be delayed
      until all the loops have been transformed?  */
index 89a481e0354e0f78056a7b76f6075e03a9b919c0..6944d139470f43d78aa4987d303b9278259bc867 100644 (file)
@@ -223,7 +223,7 @@ vectorize_loops (void)
 
   /*  ----------- Finalize. -----------  */
 
-  mark_sym_for_renaming (gimple_vop (cfun));
+  mark_virtual_operands_for_renaming (cfun);
 
   for (i = 1; i < vect_loops_num; i++)
     {