dumpfile.c: Include profile-count.h
authorJan Hubicka <hubicka@ucw.cz>
Sun, 2 Jul 2017 22:25:59 +0000 (00:25 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sun, 2 Jul 2017 22:25:59 +0000 (22:25 +0000)
* dumpfile.c: Include profile-count.h
* tree-cfg.c (gimple_duplicate_sese_tail): Drop UNUSED attributes; update
profile.
(insert_cond_bb): Update profile.
* tree-cfg.h (insert_cond_bb): Update prototype.
* tree-chkp-opt.c (chkp_optimize_string_function_calls): Update.
* tree-dump.c: Do not include tree-cfg.

From-SVN: r249887

gcc/ChangeLog
gcc/dumpfile.c
gcc/tree-cfg.c
gcc/tree-cfg.h
gcc/tree-chkp-opt.c
gcc/tree-dump.c

index 7e0cf64..73e5695 100644 (file)
@@ -1,5 +1,15 @@
 2017-07-02  Jan Hubicka  <hubicka@ucw.cz>
 
+       * dumpfile.c: Include profile-count.h
+       * tree-cfg.c (gimple_duplicate_sese_tail): Drop UNUSED attributes; update
+       profile.
+       (insert_cond_bb): Update profile.
+       * tree-cfg.h (insert_cond_bb): Update prototype.
+       * tree-chkp-opt.c (chkp_optimize_string_function_calls): Update.
+       * tree-dump.c: Do not include tree-cfg.
+
+2017-07-02  Jan Hubicka  <hubicka@ucw.cz>
+
        * bb-reorder.c (fix_up_crossing_landing_pad): Update profile.
 
 2017-07-02  Jan Hubicka  <hubicka@ucw.cz>
index c3dd126..658500b 100644 (file)
@@ -26,6 +26,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "diagnostic-core.h"
 #include "dumpfile.h"
 #include "context.h"
+#include "profile-count.h"
 #include "tree-cfg.h"
 #include "langhooks.h"
 
index 24b06b9..6add040 100644 (file)
@@ -6390,9 +6390,9 @@ bb_part_of_region_p (basic_block bb, basic_block* bbs, unsigned n_region)
 */
 
 bool
-gimple_duplicate_sese_tail (edge entry ATTRIBUTE_UNUSED, edge exit ATTRIBUTE_UNUSED,
-                         basic_block *region ATTRIBUTE_UNUSED, unsigned n_region ATTRIBUTE_UNUSED,
-                         basic_block *region_copy ATTRIBUTE_UNUSED)
+gimple_duplicate_sese_tail (edge entry, edge exit,
+                         basic_block *region, unsigned n_region,
+                         basic_block *region_copy)
 {
   unsigned i;
   bool free_region_copy = false;
@@ -6502,7 +6502,12 @@ gimple_duplicate_sese_tail (edge entry ATTRIBUTE_UNUSED, edge exit ATTRIBUTE_UNU
 
   sorig = single_succ_edge (switch_bb);
   sorig->flags = exits[1]->flags;
+  sorig->probability = exits[1]->probability;
+  sorig->count = exits[1]->count;
   snew = make_edge (switch_bb, nentry_bb, exits[0]->flags);
+  snew->probability = exits[0]->probability;
+  snew->count = exits[1]->count;
+  
 
   /* Register the new edge from SWITCH_BB in loop exit lists.  */
   rescan_loop_exit (snew, true, false);
@@ -8704,9 +8709,11 @@ make_pass_split_crit_edges (gcc::context *ctxt)
 /* Insert COND expression which is GIMPLE_COND after STMT
    in basic block BB with appropriate basic block split
    and creation of a new conditionally executed basic block.
+   Update profile so the new bb is visited with probability PROB.
    Return created basic block.  */
 basic_block
-insert_cond_bb (basic_block bb, gimple *stmt, gimple *cond)
+insert_cond_bb (basic_block bb, gimple *stmt, gimple *cond,
+               profile_probability prob)
 {
   edge fall = split_block (bb, stmt);
   gimple_stmt_iterator iter = gsi_last_bb (bb);
@@ -8721,11 +8728,17 @@ insert_cond_bb (basic_block bb, gimple *stmt, gimple *cond)
 
   /* Create conditionally executed block.  */
   new_bb = create_empty_bb (bb);
-  make_edge (bb, new_bb, EDGE_TRUE_VALUE);
+  edge e = make_edge (bb, new_bb, EDGE_TRUE_VALUE);
+  e->probability = prob;
+  e->count = bb->count.apply_probability (prob);
+  new_bb->count = e->count;
+  new_bb->frequency = prob.apply (bb->frequency);
   make_single_succ_edge (new_bb, fall->dest, EDGE_FALLTHRU);
 
   /* Fix edge for split bb.  */
   fall->flags = EDGE_FALSE_VALUE;
+  fall->count -= e->count;
+  fall->probability -= e->probability;
 
   /* Update dominance info.  */
   if (dom_info_available_p (CDI_DOMINATORS))
index 4e1b5b0..66be436 100644 (file)
@@ -104,7 +104,8 @@ extern tree gimplify_build1 (gimple_stmt_iterator *, enum tree_code,
 extern void extract_true_false_edges_from_block (basic_block, edge *, edge *);
 extern unsigned int execute_fixup_cfg (void);
 extern unsigned int split_critical_edges (void);
-extern basic_block insert_cond_bb (basic_block, gimple *, gimple *);
+extern basic_block insert_cond_bb (basic_block, gimple *, gimple *,
+                                  profile_probability);
 extern bool gimple_find_sub_bbs (gimple_seq, gimple_stmt_iterator *);
 extern bool extract_true_false_controlled_edges (basic_block, basic_block,
                                                 edge *, edge *);
index a08f081..33f2a1b 100644 (file)
@@ -1052,7 +1052,8 @@ chkp_optimize_string_function_calls (void)
 
                  /* Split block before string function call.  */
                  gsi_prev (&i);
-                 check_bb = insert_cond_bb (bb, gsi_stmt (i), check);
+                 check_bb = insert_cond_bb (bb, gsi_stmt (i), check,
+                                            profile_probability::likely ());
 
                  /* Set position for checks.  */
                  j = gsi_last_bb (check_bb);
index 347b33a..0eab7ac 100644 (file)
@@ -26,7 +26,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-dump.h"
 #include "langhooks.h"
 #include "tree-iterator.h"
-#include "tree-cfg.h"
 
 static unsigned int queue (dump_info_p, const_tree, int);
 static void dump_index (dump_info_p, unsigned int);