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]

Re: Fix predictive commoning profile update ICE


Hi,
this patch fixes the profile misupdate.  Isolate-path was actually
dropping to 0 the BB on the likely path rather than the duplicate.

Will commit it after bootstrap/regtestest on x86-64 finishes.

Honza

	PR middle-end/83189
	* gimple-ssa-isolate-paths.c (isolate_path): Fix profile update.

Index: gimple-ssa-isolate-paths.c
===================================================================
--- gimple-ssa-isolate-paths.c	(revision 256479)
+++ gimple-ssa-isolate-paths.c	(working copy)
@@ -138,6 +138,7 @@ isolate_path (basic_block bb, basic_bloc
   edge_iterator ei;
   edge e2;
   bool impossible = true;
+  profile_count count = e->count ();
 
   for (si = gsi_start_bb (bb); gsi_stmt (si) != stmt; gsi_next (&si))
     if (stmt_can_terminate_bb_p (gsi_stmt (si)))
@@ -154,11 +155,12 @@ isolate_path (basic_block bb, basic_bloc
   if (!duplicate)
     {
       duplicate = duplicate_block (bb, NULL, NULL);
-      bb->count = profile_count::zero ();
+      duplicate->count = profile_count::zero ();
       if (!ret_zero)
 	for (ei = ei_start (duplicate->succs); (e2 = ei_safe_edge (ei)); )
 	  remove_edge (e2);
     }
+  bb->count -= count;
 
   /* Complete the isolation step by redirecting E to reach DUPLICATE.  */
   e2 = redirect_edge_and_branch (e, duplicate);


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