This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix histogram updating


Hi,
profiledbootstrap with in-tree libmpfr is (among the other built system
problem) broken by triggering dead histogram sanity check that also occurs
during SPEC gcc/mesa build.  The problem is that while immitating EH updating,
I didn't noticed there are couple of places where bsi_updates is called followed
by maybe_clean_or_replace_eh_stmt.  In this case it is the code removing
read LHS of function call.
Instead of adding maybe_replace_histogram, I've changed bsi_replace to
always move it.  Profiledbootstrapped i686-linux, regtested, will commit
it shortly.  Perhaps it would make sense to modify bsi_replace to always
move EH info and remove it if new statement no longer traps instead of
having to call the maybe_*, but I am leaving this for followup.

Honza
	
	* tree-cfg.c (bsi_replace): Shortcut when replacing the statement with
	the same one; always update histograms.
Index: tree-cfg.c
===================================================================
--- tree-cfg.c	(revision 121720)
+++ tree-cfg.c	(working copy)
@@ -2840,6 +2840,8 @@ bsi_replace (const block_stmt_iterator *
   int eh_region;
   tree orig_stmt = bsi_stmt (*bsi);
 
+  if (stmt == orig_stmt)
+    return;
   SET_EXPR_LOCUS (stmt, EXPR_LOCUS (orig_stmt));
   set_bb_for_stmt (stmt, bsi->bb);
 
@@ -2852,11 +2854,11 @@ bsi_replace (const block_stmt_iterator *
 	{
 	  remove_stmt_from_eh_region (orig_stmt);
 	  add_stmt_to_eh_region (stmt, eh_region);
-	  gimple_duplicate_stmt_histograms (cfun, stmt, cfun, orig_stmt);
-          gimple_remove_stmt_histograms (cfun, orig_stmt);
 	}
     }
 
+  gimple_duplicate_stmt_histograms (cfun, stmt, cfun, orig_stmt);
+  gimple_remove_stmt_histograms (cfun, orig_stmt);
   delink_stmt_imm_use (orig_stmt);
   *bsi_stmt_ptr (*bsi) = stmt;
   mark_stmt_modified (stmt);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]