This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, lra] PR70751, correct the cost for spilling non-pseudo into memory


On 06/08/2016 10:47 AM, Jiong Wang wrote:
As discussed on the PR

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

here is the patch.

For this particular failure on arm, *arm_movsi_insn has the following
operand
constraints:
    operand 0: "=rk,r,r,r,rk,m"
  operand 1: "rk, I,K,j,mi,rk"

gcc won't explicitly refuse an unmatch CT_MEMORY operand (r235184) if it
comes from substituion that alternative (alt) 4 got a chance to compete
with
alt 0, and eventually be the winner as it's with rld_nregs=0 while alt 0 is
with rld_nregs=1.

I fell it's OK to give alt 4 a chance here, but we should calculate the
cost
correctly.

For alt 4, it should be treated as spill into memory, but currently lra
only
recognize a spill for pseudo register.   While the spilled rtx for alt 4
is a
plus after equiv substitution.

         (plus:SI (reg/f:SI 102 sfp)
            (const_int 4 [0x4]))

This patch thus let lra-constraint cost spill of Non-pseudo as well and
fixed
the regression.

x86_64/aarch64/arm boostrap and regression OK.
arm bootstrapped cc1 is about 0.3% smaller in code size.

OK for trunk?

gcc/
        PR rtl-optimization/70751
        * lra-constraints.c (process_alt_operands): Recognize Non-pseudo
spilled into
        memory.

I think the change itself is fine, but the comment could use some work. Actually I think you just need to remove the first sentence (the one referring to BZ70751 and r235184) and keep everything from "Suppose a target" onward.

OK with that fix.

jeff



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]