From 5d3ebb71cbf9c6ed0ce04230a387485fa57e71ed Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sun, 5 Feb 2017 18:16:52 +0100 Subject: re PR tree-optimization/79347 (vect_do_peeling is messing up profile) PR tree-ssa/79347 * cfgloopmanip.c (lv_adjust_loop_entry_edge, loop_version): Add ELSE_PROB. * cfgloopmanip.h (loop_version): Update prototype. * modulo-sched.c (sms_schedule): Update call of loop_version. * tree-if-conv.c(version_loop_for_if_conversion): Likewise. * tree-parloops.c (gen_parallel_loop): Likewise. * tree-ssa-loop-manip.c (tree_transform_and_unroll_loop): Likewise. * tree-ssa-loop-split.c (split_loop): Likewise. * tree-ssa-loop-unswitch.c (tree_unswitch_loop): Likewise. * tree-vect-loop-manip.c (vect_loop_versioning): Likewise. * gcc.dg/tree-ssa/ifc-10.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-11.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-12.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-20040816-1.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-20040816-2.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-5.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-8.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-9.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-cd.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-pr56541.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-pr68583.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-pr69489-1.c: Match for profile mismatches. * gcc.dg/tree-ssa/ifc-pr69489-2.c: Match for profile mismatches. From-SVN: r245196 --- gcc/cfgloopmanip.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'gcc/cfgloopmanip.c') diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c index 71fbe6b..a0e3e30 100644 --- a/gcc/cfgloopmanip.c +++ b/gcc/cfgloopmanip.c @@ -1645,11 +1645,14 @@ force_single_succ_latches (void) | +---------> [second_head] - THEN_PROB is the probability of then branch of the condition. */ + THEN_PROB is the probability of then branch of the condition. + ELSE_PROB is the probability of else branch. Note that they may be both + REG_BR_PROB_BASE when condition is IFN_LOOP_VECTORIZED. */ static basic_block lv_adjust_loop_entry_edge (basic_block first_head, basic_block second_head, - edge e, void *cond_expr, unsigned then_prob) + edge e, void *cond_expr, unsigned then_prob, + unsigned else_prob) { basic_block new_head = NULL; edge e1; @@ -1668,7 +1671,7 @@ lv_adjust_loop_entry_edge (basic_block first_head, basic_block second_head, e1 = make_edge (new_head, first_head, current_ir_type () == IR_GIMPLE ? EDGE_TRUE_VALUE : 0); e1->probability = then_prob; - e->probability = REG_BR_PROB_BASE - then_prob; + e->probability = else_prob; e1->count = apply_probability (e->count, e1->probability); e->count = apply_probability (e->count, e->probability); @@ -1701,7 +1704,8 @@ lv_adjust_loop_entry_edge (basic_block first_head, basic_block second_head, struct loop * loop_version (struct loop *loop, void *cond_expr, basic_block *condition_bb, - unsigned then_prob, unsigned then_scale, unsigned else_scale, + unsigned then_prob, unsigned else_prob, + unsigned then_scale, unsigned else_scale, bool place_after) { basic_block first_head, second_head; @@ -1732,7 +1736,7 @@ loop_version (struct loop *loop, /* Split loop entry edge and insert new block with cond expr. */ cond_bb = lv_adjust_loop_entry_edge (first_head, second_head, - entry, cond_expr, then_prob); + entry, cond_expr, then_prob, else_prob); if (condition_bb) *condition_bb = cond_bb; -- cgit v1.1