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

--- Comment #4 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> 
---
Author: rsandifo
Date: Fri Mar 31 11:51:32 2017
New Revision: 246614

URL: https://gcc.gnu.org/viewcvs?rev=246614&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/gcc-6-branch/gcc/testsuite/gcc.dg/pr80218.c
Modified:
    branches/gcc-6-branch/gcc/ChangeLog
    branches/gcc-6-branch/gcc/testsuite/ChangeLog
    branches/gcc-6-branch/gcc/tree-call-cdce.c

Reply via email to