This is the mail archive of the gcc-bugs@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]

[Bug rtl-optimization/66782] [5/6 Regression] Unable to run 64-bit wine after MS->SYSV register changes


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

Michael Matz <matz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |matz at gcc dot gnu.org

--- Comment #9 from Michael Matz <matz at gcc dot gnu.org> ---
FWIW, it's the inheritance code that breaks this.  From the reload (aka lra)
dump:

      Creating newreg=380 from oldreg=89, assigning class GENERAL_REGS to
inheritance r380
    Original reg change 89->380 (bb25):
  593: r342:DI=r380:DI
    Add inheritance<-original before:
  633: r380:DI=r89:DI

    Inheritance reuse change 89->380 (bb25):
  594: r343:DI=r380:DI

r89 is the original register that is live over the call, and which didn't
get a hardreg.  insn 593 and 633 are an optional reload for an insn (212)
_before_ the call, insn 594 is a (inheritance) reload insn _after_ the call
(for insn 222), ala this:


(insn 633 591 593 25 (set (reg:DI 4 si [orig:89 D.1995 ] [89])
        (mem/c:DI (plus:DI (reg/f:DI 7 sp)
                (const_int 24 [0x18])) [11 %sfp+-216 S8 A64])) wine.c:95 85
{*movdi_internal}
     (nil))
(insn 593 633 212 25 (set (reg:DI 1 dx [orig:89 D.1995 ] [89])
        (reg:DI 4 si [orig:89 D.1995 ] [89])) wine.c:95 85 {*movdi_internal}
     (nil))
(insn 212 593 592 25 (parallel [
            (set (reg:DI 5 di [orig:224 D.1995 ] [224])
                (minus:DI (reg:DI 5 di [orig:224 D.1995 ] [224])
                    (reg:DI 1 dx [orig:89 D.1995 ] [89])))
            (clobber (reg:CC 17 flags))
        ]) wine.c:95 259 {*subdi_1}
     (expr_list:REG_EQUAL (minus:DI (mem/f/c:DI (plus:DI (reg/f:DI 20 frame)
                    (const_int -128 [0xffffffffffffff80])) [2 arch.ptr+0 S8
A128
])
            (reg:DI 89 [ D.1995 ]))
        (nil)))

... more insn, amongst them insn 217, the call insn clobbering reg 4 aka SI ...

(insn 594 221 632 25 (set (reg:DI 1 dx [orig:230 D.1995 ] [230])
        (reg:DI 4 si [orig:89 D.1995 ] [89])) wine.c:96 85 {*movdi_internal}
     (nil))
(insn 632 594 222 25 (set (reg/f:DI 2 cx [orig:121 D.1996 ] [121])
        (mem/c:DI (plus:DI (reg/f:DI 7 sp)
                (const_int 40 [0x28])) [11 %sfp+-200 S8 A64])) wine.c:96 85
{*movdi_internal}
     (nil))
(insn 222 632 596 25 (parallel [
            (set (reg:DI 1 dx [orig:230 D.1995 ] [230])
                (minus:DI (reg:DI 1 dx [orig:230 D.1995 ] [230])
                    (reg/f:DI 2 cx [orig:121 D.1996 ] [121])))
            (clobber (reg:CC 17 flags))
        ]) wine.c:96 259 {*subdi_1}
     (nil))

So, insn 594 reuses the inheritance register 380 from before the call
(setup in insn 633), so r380 is live over the call.  But LRA happily
does this to this reload inheritance reg:

         Assigning to 380 (cl=GENERAL_REGS, orig=89, freq=33, tfirst=340,
tfreq=66)...
           Assign 4 to inheritance r380 (freq=33)

Voila, hardreg 4 is assigned to r380, even though it lives over a clobber
of it.

I don't see any code in inherit_reload_reg or its caller inherit_in_ebb
that would look at CALL_INSN_FUNCTION_USAGE on any intervening insns,
between the inheritance setup and any of the next usage insns.


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