This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Convert profile probabilities to new type
- From: Alexander Monakov <amonakov at ispras dot ru>
- To: Andreas Schwab <schwab at linux-m68k dot org>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, gcc-patches at gcc dot gnu dot org, jakub at redhat dot com, mliska at suse dot cz
- Date: Fri, 30 Jun 2017 21:28:39 +0300 (MSK)
- Subject: Re: Convert profile probabilities to new type
- Authentication-results: sourceware.org; auth=none
- References: <20170629122741.GA13006@kam.mff.cuni.cz> <87o9t5l9l5.fsf@linux-m68k.org>
On Fri, 30 Jun 2017, Andreas Schwab wrote:
> This breaks ia64, a lot of testsuite failures like this:
>
> FAIL: c-c++-common/torture/pr53505.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions (internal compiler error)
> FAIL: c-c++-common/torture/pr53505.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions (test for excess errors)
> Excess errors:
> during RTL pass: mach
> /usr/local/gcc/gcc-20170630/gcc/testsuite/c-c++-common/torture/pr53505.c:26:1: internal compiler error: in merge_expr, at sel-sched-ir.c:1886
The patch introduced a new inconsistency in sel-sched-ir.c:
@@ -4747,7 +4747,9 @@ compute_succs_info (insn_t insn, short flags)
sinfo->probs_ok.safe_push (
/* FIXME: Improve calculation when skipping
inner loop to exits. */
- si.bb_end ? si.e1->probability : REG_BR_PROB_BASE);
+ si.bb_end && si.e1->probability.initialized_p ()
+ ? si.e1->probability.to_reg_br_prob_base ()
+ : REG_BR_PROB_BASE);
sinfo->succs_ok_n++;
}
else
@@ -4756,8 +4758,8 @@ compute_succs_info (insn_t insn, short flags)
/* Compute all_prob. */
if (!si.bb_end)
sinfo->all_prob = REG_BR_PROB_BASE;
- else
- sinfo->all_prob += si.e1->probability;
+ else if (si.e1->probability.initialized_p ())
+ sinfo->all_prob += si.e1->probability.to_reg_br_prob_base ();
sinfo->all_succs_n++;
}
After the change, edges that fail the predicate contribute REG_BR_PROB_BASE in
the upper hunk, but 0 in the lower hunk. Before the change, they contributed 0
in both cases.
The following patch should restore things:
diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index dd72828..fa88259 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -4747,8 +4747,10 @@ compute_succs_info (insn_t insn, short flags)
sinfo->probs_ok.safe_push (
/* FIXME: Improve calculation when skipping
inner loop to exits. */
- si.bb_end && si.e1->probability.initialized_p ()
- ? si.e1->probability.to_reg_br_prob_base ()
+ si.bb_end
+ ? (si.e1->probability.initialized_p ()
+ ? si.e1->probability.to_reg_br_prob_base ()
+ : 0)
: REG_BR_PROB_BASE);
sinfo->succs_ok_n++;
}