diff mbox

[RFA,PR,tree-optimization/68619] Avoid direct cfg cleanups in tree-ssa-dom.c [4/3] v2

Message ID 5668B878.30204@redhat.com
State New
Headers show

Commit Message

Jeff Law Dec. 9, 2015, 11:25 p.m. UTC
Finally the mechanical changes necessary due to the API change in the 
walker.

Jeff
commit 02cea5bd751566459ba5da5c4ca3a567f72c9c16
Author: Jeff Law <law@redhat.com>
Date:   Wed Dec 9 15:52:17 2015 -0700

    	* compare-elim.c (find_comparison_dom_walker::before_dom_children):
    	Change return type to an edge.  Always return NULL.
    	* fwprop.c (single_def_use_dom_walker::before_dom_children): Likewise.
    	* gimple-ssa-strength-reduction.c
    	(find_candidates_dom_walker::before_dom_children): Likewise.
    	* ipa-prop.c (analysis_dom_walker::before_dom_children): Likewise.
    	(ipcp_modif_dom_walker::before_dom_children): Likewise.
    	* tree-into-ssa.c (rewrite_dom_walker::before_dom_children): Likewise.
    	(rewrite_update_dom_walker::before_dom_children): Likewise.
    	(mark_def_dom_children::before_dom_children): Likewise.
    	* tree-ssa-dse.c (dse_dom_walker::before_dom_children): Likewise.
    	* tree-ssa-loop-im.c
    	(invariantness_dom_walker::before_dom_children): Likewise.
    	(move_computations_dom_walker::before_dom_walker): Likewise.
    	* tree-ssa-phiopt.c
    	(nontrapping_dom_walker::before_dom_children): Likewise.
    	* tree-ssa-pre.c
    	(eliminate_dom_walker::before_dom_children): Likewise.
    	* tree-ssa-propagate.c
    	(substitute_and_fold_dom_walker::before_dom_children): Likewise.
    	* tree-ssa-strlen.c
    	(strlen_dom_walker::before_dom_children): Likewise.
    	* tree-ssa-uncprop.c
    	(uncprop_dom_walker::before_dom_children): Likewise.
diff mbox

Patch

diff --git a/gcc/compare-elim.c b/gcc/compare-elim.c
index 54b26ba..5f74db0 100644
--- a/gcc/compare-elim.c
+++ b/gcc/compare-elim.c
@@ -248,7 +248,7 @@  public:
   find_comparison_dom_walker (cdi_direction direction)
     : dom_walker (direction) {}
 
-  virtual void before_dom_children (basic_block);
+  virtual edge before_dom_children (basic_block);
 };
 
 /* Return true if conforming COMPARE with EH_NOTE is redundant with comparison
@@ -294,7 +294,7 @@  can_eliminate_compare (rtx compare, rtx eh_note, struct comparison *cmp)
    compare in the BB is live at the end of the block, install the compare
    in BB->AUX.  Called via dom_walker.walk ().  */
 
-void
+edge
 find_comparison_dom_walker::before_dom_children (basic_block bb)
 {
   struct comparison *last_cmp;
@@ -426,6 +426,8 @@  find_comparison_dom_walker::before_dom_children (basic_block bb)
      remove EH edges.  */
   if (need_purge)
     purge_dead_edges (bb);
+
+  return NULL;
 }
 
 /* Find all comparisons in the function.  */
diff --git a/gcc/fwprop.c b/gcc/fwprop.c
index 863e35d..5f61130 100644
--- a/gcc/fwprop.c
+++ b/gcc/fwprop.c
@@ -208,11 +208,11 @@  class single_def_use_dom_walker : public dom_walker
 public:
   single_def_use_dom_walker (cdi_direction direction)
     : dom_walker (direction) {}
-  virtual void before_dom_children (basic_block);
+  virtual edge before_dom_children (basic_block);
   virtual void after_dom_children (basic_block);
 };
 
-void
+edge
 single_def_use_dom_walker::before_dom_children (basic_block bb)
 {
   int bb_index = bb->index;
@@ -245,6 +245,8 @@  single_def_use_dom_walker::before_dom_children (basic_block bb)
 
   process_uses (df_get_artificial_uses (bb_index), 0);
   process_defs (df_get_artificial_defs (bb_index), 0);
+
+  return NULL;
 }
 
 /* Pop the definitions created in this basic block when leaving its
diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c
index b807823..e184a1b 100644
--- a/gcc/gimple-ssa-strength-reduction.c
+++ b/gcc/gimple-ssa-strength-reduction.c
@@ -1649,12 +1649,12 @@  class find_candidates_dom_walker : public dom_walker
 public:
   find_candidates_dom_walker (cdi_direction direction)
     : dom_walker (direction) {}
-  virtual void before_dom_children (basic_block);
+  virtual edge before_dom_children (basic_block);
 };
 
 /* Find strength-reduction candidates in block BB.  */
 
-void
+edge
 find_candidates_dom_walker::before_dom_children (basic_block bb)
 {
   bool speed = optimize_bb_for_speed_p (bb);
@@ -1737,6 +1737,7 @@  find_candidates_dom_walker::before_dom_children (basic_block bb)
 	    }
 	}
     }
+  return NULL;
 }
 
 /* Dump a candidate for debug.  */
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index f379ea7..f96bf97 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -2245,17 +2245,18 @@  public:
   analysis_dom_walker (struct ipa_func_body_info *fbi)
     : dom_walker (CDI_DOMINATORS), m_fbi (fbi) {}
 
-  virtual void before_dom_children (basic_block);
+  virtual edge before_dom_children (basic_block);
 
 private:
   struct ipa_func_body_info *m_fbi;
 };
 
-void
+edge
 analysis_dom_walker::before_dom_children (basic_block bb)
 {
   ipa_analyze_params_uses_in_bb (m_fbi, bb);
   ipa_compute_jump_functions_for_bb (m_fbi, bb);
+  return NULL;
 }
 
 /* Release body info FBI.  */
@@ -5098,7 +5099,7 @@  public:
     : dom_walker (CDI_DOMINATORS), m_fbi (fbi), m_descriptors (descs),
       m_aggval (av), m_something_changed (sc), m_cfg_changed (cc) {}
 
-  virtual void before_dom_children (basic_block);
+  virtual edge before_dom_children (basic_block);
 
 private:
   struct ipa_func_body_info *m_fbi;
@@ -5107,7 +5108,7 @@  private:
   bool *m_something_changed, *m_cfg_changed;
 };
 
-void
+edge
 ipcp_modif_dom_walker::before_dom_children (basic_block bb)
 {
   gimple_stmt_iterator gsi;
@@ -5198,7 +5199,7 @@  ipcp_modif_dom_walker::before_dom_children (basic_block bb)
 	  && gimple_purge_dead_eh_edges (gimple_bb (stmt)))
 	*m_cfg_changed = true;
     }
-
+  return NULL;
 }
 
 /* Update alignment of formal parameters as described in
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index 3086f82..5486d5c 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -1391,7 +1391,7 @@  class rewrite_dom_walker : public dom_walker
 public:
   rewrite_dom_walker (cdi_direction direction) : dom_walker (direction) {}
 
-  virtual void before_dom_children (basic_block);
+  virtual edge before_dom_children (basic_block);
   virtual void after_dom_children (basic_block);
 };
 
@@ -1400,7 +1400,7 @@  public:
    (BLOCK_DEFS).  Register new definitions for every PHI node in the
    block.  */
 
-void
+edge
 rewrite_dom_walker::before_dom_children (basic_block bb)
 {
   if (dump_file && (dump_flags & TDF_DETAILS))
@@ -1432,6 +1432,8 @@  rewrite_dom_walker::before_dom_children (basic_block bb)
      reaching definition for the variable and the edge through which that
      definition is reaching the PHI node.  */
   rewrite_add_phi_arguments (bb);
+
+  return NULL;
 }
 
 
@@ -2055,7 +2057,7 @@  class rewrite_update_dom_walker : public dom_walker
 public:
   rewrite_update_dom_walker (cdi_direction direction) : dom_walker (direction) {}
 
-  virtual void before_dom_children (basic_block);
+  virtual edge before_dom_children (basic_block);
   virtual void after_dom_children (basic_block);
 };
 
@@ -2064,7 +2066,7 @@  public:
    for new SSA names produced in this block (BLOCK_DEFS).  Register
    new definitions for every PHI node in the block.  */
 
-void
+edge
 rewrite_update_dom_walker::before_dom_children (basic_block bb)
 {
   bool is_abnormal_phi;
@@ -2077,7 +2079,7 @@  rewrite_update_dom_walker::before_dom_children (basic_block bb)
   block_defs_stack.safe_push (NULL_TREE);
 
   if (!bitmap_bit_p (blocks_to_update, bb->index))
-    return;
+    return NULL;
 
   /* Mark the LHS if any of the arguments flows through an abnormal
      edge.  */
@@ -2133,6 +2135,8 @@  rewrite_update_dom_walker::before_dom_children (basic_block bb)
 
   /* Step 3.  Update PHI nodes.  */
   rewrite_update_phi_arguments (bb);
+
+  return NULL;
 }
 
 /* Called after visiting block BB.  Unwind BLOCK_DEFS_STACK to restore
@@ -2210,7 +2214,7 @@  public:
   mark_def_dom_walker (cdi_direction direction);
   ~mark_def_dom_walker ();
 
-  virtual void before_dom_children (basic_block);
+  virtual edge before_dom_children (basic_block);
 
 private:
   /* Notice that this bitmap is indexed using variable UIDs, so it must be
@@ -2232,7 +2236,7 @@  mark_def_dom_walker::~mark_def_dom_walker ()
 /* Block processing routine for mark_def_sites.  Clear the KILLS bitmap
    at the start of each block, and call mark_def_sites for each statement.  */
 
-void
+edge
 mark_def_dom_walker::before_dom_children (basic_block bb)
 {
   gimple_stmt_iterator gsi;
@@ -2240,6 +2244,7 @@  mark_def_dom_walker::before_dom_children (basic_block bb)
   bitmap_clear (m_kills);
   for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
     mark_def_sites (bb, gsi_stmt (gsi), m_kills);
+  return NULL;
 }
 
 /* Initialize internal data needed during renaming.  */
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
index 20a12b5..0b05c5e 100644
--- a/gcc/tree-ssa-dse.c
+++ b/gcc/tree-ssa-dse.c
@@ -316,10 +316,10 @@  class dse_dom_walker : public dom_walker
 public:
   dse_dom_walker (cdi_direction direction) : dom_walker (direction) {}
 
-  virtual void before_dom_children (basic_block);
+  virtual edge before_dom_children (basic_block);
 };
 
-void
+edge
 dse_dom_walker::before_dom_children (basic_block bb)
 {
   gimple_stmt_iterator gsi;
@@ -332,6 +332,7 @@  dse_dom_walker::before_dom_children (basic_block bb)
       else
 	gsi_prev (&gsi);
     }
+  return NULL;
 }
 
 namespace {
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 0d82d36..9b1b815 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -958,14 +958,14 @@  public:
   invariantness_dom_walker (cdi_direction direction)
     : dom_walker (direction) {}
 
-  virtual void before_dom_children (basic_block);
+  virtual edge before_dom_children (basic_block);
 };
 
 /* Determine the outermost loops in that statements in basic block BB are
    invariant, and record them to the LIM_DATA associated with the statements.
    Callback for dom_walker.  */
 
-void
+edge
 invariantness_dom_walker::before_dom_children (basic_block bb)
 {
   enum move_pos pos;
@@ -976,7 +976,7 @@  invariantness_dom_walker::before_dom_children (basic_block bb)
   struct lim_aux_data *lim_data;
 
   if (!loop_outer (bb->loop_father))
-    return;
+    return NULL;
 
   if (dump_file && (dump_flags & TDF_DETAILS))
     fprintf (dump_file, "Basic block %d (loop %d -- depth %d):\n\n",
@@ -1094,6 +1094,7 @@  invariantness_dom_walker::before_dom_children (basic_block bb)
       if (lim_data->cost >= LIM_EXPENSIVE)
 	set_profitable_level (stmt);
     }
+  return NULL;
 }
 
 class move_computations_dom_walker : public dom_walker
@@ -1102,7 +1103,7 @@  public:
   move_computations_dom_walker (cdi_direction direction)
     : dom_walker (direction), todo_ (0) {}
 
-  virtual void before_dom_children (basic_block);
+  virtual edge before_dom_children (basic_block);
 
   unsigned int todo_;
 };
@@ -1111,7 +1112,7 @@  public:
    data stored in LIM_DATA structures associated with each statement.  Callback
    for walk_dominator_tree.  */
 
-void
+edge
 move_computations_dom_walker::before_dom_children (basic_block bb)
 {
   struct loop *level;
@@ -1119,7 +1120,7 @@  move_computations_dom_walker::before_dom_children (basic_block bb)
   struct lim_aux_data *lim_data;
 
   if (!loop_outer (bb->loop_father))
-    return;
+    return NULL;
 
   for (gphi_iterator bsi = gsi_start_phis (bb); !gsi_end_p (bsi); )
     {
@@ -1265,6 +1266,7 @@  move_computations_dom_walker::before_dom_children (basic_block bb)
       else
 	gsi_insert_on_edge (e, stmt);
     }
+  return NULL;
 }
 
 /* Hoist the statements out of the loops prescribed by data stored in
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index 344cd2f..0674506 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -1477,7 +1477,7 @@  public:
   nontrapping_dom_walker (cdi_direction direction, hash_set<tree> *ps)
     : dom_walker (direction), m_nontrapping (ps), m_seen_ssa_names (128) {}
 
-  virtual void before_dom_children (basic_block);
+  virtual edge before_dom_children (basic_block);
   virtual void after_dom_children (basic_block);
 
 private:
@@ -1496,7 +1496,7 @@  private:
 };
 
 /* Called by walk_dominator_tree, when entering the block BB.  */
-void
+edge
 nontrapping_dom_walker::before_dom_children (basic_block bb)
 {
   edge e;
@@ -1529,6 +1529,7 @@  nontrapping_dom_walker::before_dom_children (basic_block bb)
 	  add_or_mark_expr (bb, gimple_assign_rhs1 (stmt), false);
 	}
     }
+  return NULL;
 }
 
 /* Called by walk_dominator_tree, when basic block BB is exited.  */
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index baafa34..21a3a2b 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -3906,7 +3906,7 @@  public:
   eliminate_dom_walker (cdi_direction direction, bool do_pre_)
       : dom_walker (direction), do_pre (do_pre_) {}
 
-  virtual void before_dom_children (basic_block);
+  virtual edge before_dom_children (basic_block);
   virtual void after_dom_children (basic_block);
 
   bool do_pre;
@@ -3914,7 +3914,7 @@  public:
 
 /* Perform elimination for the basic-block B during the domwalk.  */
 
-void
+edge
 eliminate_dom_walker::before_dom_children (basic_block b)
 {
   /* Mark new bb.  */
@@ -4423,6 +4423,7 @@  eliminate_dom_walker::before_dom_children (basic_block b)
 	    }
 	}
     }
+  return NULL;
 }
 
 /* Make no longer available leaders no longer available.  */
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index e61cb48..c52b41c 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -1123,7 +1123,7 @@  public:
       BITMAP_FREE (need_eh_cleanup);
     }
 
-    virtual void before_dom_children (basic_block);
+    virtual edge before_dom_children (basic_block);
     virtual void after_dom_children (basic_block) {}
 
     ssa_prop_get_value_fn get_value_fn;
@@ -1135,7 +1135,7 @@  public:
     bitmap need_eh_cleanup;
 };
 
-void
+edge
 substitute_and_fold_dom_walker::before_dom_children (basic_block bb)
 {
   /* Propagate known values into PHI nodes.  */
@@ -1293,6 +1293,7 @@  substitute_and_fold_dom_walker::before_dom_children (basic_block bb)
 	    fprintf (dump_file, "Not folded\n");
 	}
     }
+  return NULL;
 }
 
 
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
index 31732d7..f98b865 100644
--- a/gcc/tree-ssa-strlen.c
+++ b/gcc/tree-ssa-strlen.c
@@ -2196,14 +2196,14 @@  class strlen_dom_walker : public dom_walker
 public:
   strlen_dom_walker (cdi_direction direction) : dom_walker (direction) {}
 
-  virtual void before_dom_children (basic_block);
+  virtual edge before_dom_children (basic_block);
   virtual void after_dom_children (basic_block);
 };
 
 /* Callback for walk_dominator_tree.  Attempt to optimize various
    string ops by remembering string lenths pointed by pointer SSA_NAMEs.  */
 
-void
+edge
 strlen_dom_walker::before_dom_children (basic_block bb)
 {
   basic_block dombb = get_immediate_dominator (CDI_DOMINATORS, bb);
@@ -2283,6 +2283,7 @@  strlen_dom_walker::before_dom_children (basic_block bb)
   bb->aux = stridx_to_strinfo;
   if (vec_safe_length (stridx_to_strinfo) && !strinfo_shared ())
     (*stridx_to_strinfo)[0] = (strinfo *) bb;
+  return NULL;
 }
 
 /* Callback for walk_dominator_tree.  Free strinfo vector if it is
diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c
index a60184e..502614a 100644
--- a/gcc/tree-ssa-uncprop.c
+++ b/gcc/tree-ssa-uncprop.c
@@ -303,7 +303,7 @@  class uncprop_dom_walker : public dom_walker
 public:
   uncprop_dom_walker (cdi_direction direction) : dom_walker (direction) {}
 
-  virtual void before_dom_children (basic_block);
+  virtual edge before_dom_children (basic_block);
   virtual void after_dom_children (basic_block);
 
 private:
@@ -433,7 +433,7 @@  single_incoming_edge_ignoring_loop_edges (basic_block bb)
   return retval;
 }
 
-void
+edge
 uncprop_dom_walker::before_dom_children (basic_block bb)
 {
   basic_block parent;
@@ -462,6 +462,7 @@  uncprop_dom_walker::before_dom_children (basic_block bb)
     m_equiv_stack.safe_push (NULL_TREE);
 
   uncprop_into_successor_phis (bb);
+  return NULL;
 }
 
 namespace {