re PR tree-optimization/83189 (internal compiler error: in probability_in, at profile...
authorJan Hubicka <hubicka@ucw.cz>
Thu, 11 Jan 2018 17:47:20 +0000 (18:47 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Thu, 11 Jan 2018 17:47:20 +0000 (17:47 +0000)
PR middle-end/83189
* gimple-ssa-isolate-paths.c (isolate_path): Fix profile update.

From-SVN: r256545

gcc/ChangeLog
gcc/gimple-ssa-isolate-paths.c

index f8bd20f6aebd6a5f9ca2733d87e5cbbc871c1f7b..069d5bbe63a4db7036a6ee0afb09c5b112f86bd7 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-11  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR middle-end/83189
+       * gimple-ssa-isolate-paths.c (isolate_path): Fix profile update.
+
 2018-01-11  Jan Hubicka  <hubicka@ucw.cz>
 
        PR middle-end/83718
index 73489bf254bc187cd86bc7400b158a874daf7fd6..131705d18279a1675bd5270e26eedeac7a26a2ac 100644 (file)
@@ -138,6 +138,7 @@ isolate_path (basic_block bb, basic_block duplicate,
   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_block duplicate,
   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);