[Bug tree-optimization/80218] [6 Regression] tree-call-cdce does not update block frequencies

rsandifo at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Apr 25 15:03:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80218

--- Comment #6 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Author: rsandifo
Date: Tue Apr 25 15:02:23 2017
New Revision: 247247

URL: https://gcc.gnu.org/viewcvs?rev=247247&root=gcc&view=rev
Log:
PR80218: Call CDCE fails to update the block profile

tree-call-cdce.c was updating the edge probabilities and counts but
it wasn't updating the corresponding block information.  Among other
things, this tricked the register allocator into thinking that the
libm call was relatively hot and that it wasn't worth assigning
call-clobbered registers to values that were live across the call.
With correct frequency information, the RA instead keeps x in the
first argument register and spills it only around the call.

Although the problem has been around for a long time, it became more
acute (and would only trigger for the first function in the testcase)
after r230488.  Until that patch, the code was specific to calls that
had no lhs, but that we still had to keep for their effect on errno.
After the patch we also used the code for calls with an lhs, provided
that the hardware could calculate the lhs directly.

gcc/
        PR tree-optimization/80218
        * tree-call-cdce.c (shrink_wrap_one_built_in_call_with_conds):
        Update block frequencies and counts.

gcc/testsuite/
        PR tree-optimization/80218
        * gcc.dg/pr80218.c: New test.

Added:
    branches/ARM/sve-branch/gcc/testsuite/gcc.dg/pr80218.c
Modified:
    branches/ARM/sve-branch/gcc/tree-call-cdce.c


More information about the Gcc-bugs mailing list