[PATCH] Shave some bit of work off verify_gimple_in_cfg

Richard Biener rguenther@suse.de
Fri Apr 27 11:01:00 GMT 2018


This makes us not record all stmts in the visited_stmts hash-set
but only those that are possibly valid EH stmts.  Should save us
some cycles here.

Bootstrap running on x86_64-unknown-linux-gnu.

Richard.

2018-04-27  Richard Biener  <rguenther@suse.de>

	* tree-cfg.c (verify_gimple_phi): Take a gphi * argument.
	(verify_gimple_in_cfg): Rename visited_stmts to visited_throwing_stmts
	to reflect use.  Only add interesting stmts.

Index: gcc/tree-cfg.c
===================================================================
--- gcc/tree-cfg.c	(revision 259695)
+++ gcc/tree-cfg.c	(working copy)
@@ -5103,7 +5103,7 @@ verify_gimple_stmt (gimple *stmt)
    and false otherwise.  */
 
 static bool
-verify_gimple_phi (gimple *phi)
+verify_gimple_phi (gphi *phi)
 {
   bool err = false;
   unsigned i;
@@ -5422,7 +5422,7 @@ verify_gimple_in_cfg (struct function *f
 
   timevar_push (TV_TREE_STMT_VERIFY);
   hash_set<void *> visited;
-  hash_set<gimple *> visited_stmts;
+  hash_set<gimple *> visited_throwing_stmts;
 
   /* Collect all BLOCKs referenced by the BLOCK tree of FN.  */
   hash_set<tree> blocks;
@@ -5444,8 +5444,6 @@ verify_gimple_in_cfg (struct function *f
 	  bool err2 = false;
 	  unsigned i;
 
-	  visited_stmts.add (phi);
-
 	  if (gimple_bb (phi) != bb)
 	    {
 	      error ("gimple_bb (phi) is set to a wrong basic block");
@@ -5501,8 +5499,6 @@ verify_gimple_in_cfg (struct function *f
 	  tree addr;
 	  int lp_nr;
 
-	  visited_stmts.add (stmt);
-
 	  if (gimple_bb (stmt) != bb)
 	    {
 	      error ("gimple_bb (stmt) is set to a wrong basic block");
@@ -5554,6 +5550,7 @@ verify_gimple_in_cfg (struct function *f
 	  lp_nr = lookup_stmt_eh_lp (stmt);
 	  if (lp_nr > 0)
 	    {
+	      visited_throwing_stmts.add (stmt);
 	      if (!stmt_could_throw_p (stmt))
 		{
 		  if (verify_nothrow)
@@ -5575,11 +5572,11 @@ verify_gimple_in_cfg (struct function *f
 	}
     }
 
-  eh_error_found = false;
   hash_map<gimple *, int> *eh_table = get_eh_throw_stmt_table (cfun);
+  eh_error_found = false;
   if (eh_table)
     eh_table->traverse<hash_set<gimple *> *, verify_eh_throw_stmt_node>
-      (&visited_stmts);
+      (&visited_throwing_stmts);
 
   if (err || eh_error_found)
     internal_error ("verify_gimple failed");



More information about the Gcc-patches mailing list