Commit 2a006669 by Jan Hubicka Committed by Jan Hubicka

* tree-ssa-loop-manip.c

	(scale_dominated_blocks_in_loop): Update to profile counts.
	(tree_transform_and_unroll_loop): Likewise.

From-SVN: r254811
parent 00fa28d1
2017-11-14 Jan Hubicka <hubicka@ucw.cz> 2017-11-14 Jan Hubicka <hubicka@ucw.cz>
* tree-ssa-loop-manip.c
(scale_dominated_blocks_in_loop): Update to profile counts.
(tree_transform_and_unroll_loop): Likewise.
2017-11-14 Jan Hubicka <hubicka@ucw.cz>
* tree-vect-loop-manip.c (vect_do_peeling): Do not use * tree-vect-loop-manip.c (vect_do_peeling): Do not use
scale_bbs_frequencies_int. scale_bbs_frequencies_int.
...@@ -1091,11 +1091,11 @@ determine_exit_conditions (struct loop *loop, struct tree_niter_desc *desc, ...@@ -1091,11 +1091,11 @@ determine_exit_conditions (struct loop *loop, struct tree_niter_desc *desc,
static void static void
scale_dominated_blocks_in_loop (struct loop *loop, basic_block bb, scale_dominated_blocks_in_loop (struct loop *loop, basic_block bb,
int num, int den) profile_count num, profile_count den)
{ {
basic_block son; basic_block son;
if (den == 0) if (!den.nonzero_p () && !(num == profile_count::zero ()))
return; return;
for (son = first_dom_son (CDI_DOMINATORS, bb); for (son = first_dom_son (CDI_DOMINATORS, bb);
...@@ -1104,7 +1104,7 @@ scale_dominated_blocks_in_loop (struct loop *loop, basic_block bb, ...@@ -1104,7 +1104,7 @@ scale_dominated_blocks_in_loop (struct loop *loop, basic_block bb,
{ {
if (!flow_bb_inside_loop_p (loop, son)) if (!flow_bb_inside_loop_p (loop, son))
continue; continue;
scale_bbs_frequencies_int (&son, 1, num, den); scale_bbs_frequencies_profile_count (&son, 1, num, den);
scale_dominated_blocks_in_loop (loop, son, num, den); scale_dominated_blocks_in_loop (loop, son, num, den);
} }
} }
...@@ -1281,9 +1281,10 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor, ...@@ -1281,9 +1281,10 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor,
scale_dominated_blocks_in_loop (loop, exit->src, scale_dominated_blocks_in_loop (loop, exit->src,
/* We are scaling up here so probability /* We are scaling up here so probability
does not fit. */ does not fit. */
REG_BR_PROB_BASE, loop->header->count,
REG_BR_PROB_BASE loop->header->count
- exit->probability.to_reg_br_prob_base ()); - loop->header->count.apply_probability
(exit->probability));
bsi = gsi_last_bb (exit_bb); bsi = gsi_last_bb (exit_bb);
exit_if = gimple_build_cond (EQ_EXPR, integer_zero_node, exit_if = gimple_build_cond (EQ_EXPR, integer_zero_node,
...@@ -1377,8 +1378,7 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor, ...@@ -1377,8 +1378,7 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor,
{ {
/* Avoid dropping loop body profile counter to 0 because of zero count /* Avoid dropping loop body profile counter to 0 because of zero count
in loop's preheader. */ in loop's preheader. */
if (freq_e == profile_count::zero ()) freq_e = freq_e.force_nonzero ();
freq_e = profile_count::from_gcov_type (1);
scale_loop_frequencies (loop, freq_e.probability_in (freq_h)); scale_loop_frequencies (loop, freq_e.probability_in (freq_h));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment