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/56069] [4.7/4.8/4.9 Regression] RA pessimization


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56069

Jeffrey A. Law <law at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at redhat dot com

--- Comment #5 from Jeffrey A. Law <law at redhat dot com> ---
Maybe I'm missing something here.  We have this immediately prior to IRA:

(insn 2 4 3 2 (set (reg/v:DI 86 [ mem ])
        (reg:DI 5 di [ mem ])) j.c:2 89 {*movdi_internal}
     (expr_list:REG_DEAD (reg:DI 5 di [ mem ])
        (nil)))
(note 3 2 6 2 NOTE_INSN_FUNCTION_BEG)
(insn 6 3 7 2 (parallel [
            (set (reg:DI 88 [ D.1760 ])
                (lshiftrt:DI (reg/v:DI 86 [ mem ])
                    (const_int 3 [0x3])))
            (clobber (reg:CC 17 flags))
        ]) j.c:3 562 {*lshrdi3_1}
     (expr_list:REG_DEAD (reg/v:DI 86 [ mem ])
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (nil))))
(insn 7 6 8 2 (set (reg:DI 89)
        (const_int 17592186044416 [0x100000000000])) j.c:3 89 {*movdi_internal}
     (nil))
(insn 8 7 13 2 (parallel [
            (set (reg:DI 87 [ D.1760 ])
                (ior:DI (reg:DI 88 [ D.1760 ])
                    (reg:DI 89)))
            (clobber (reg:CC 17 flags))
        ]) j.c:3 421 {*iordi_1}
     (expr_list:REG_DEAD (reg:DI 89)
        (expr_list:REG_DEAD (reg:DI 88 [ D.1760 ])
            (expr_list:REG_UNUSED (reg:CC 17 flags)
                (expr_list:REG_EQUAL (ior:DI (reg:DI 88 [ D.1760 ])
                        (const_int 17592186044416 [0x100000000000]))
                    (nil))))))
(insn 13 8 16 2 (set (reg/i:DI 0 ax)
        (reg:DI 87 [ D.1760 ])) j.c:4 89 {*movdi_internal}
     (expr_list:REG_DEAD (reg:DI 87 [ D.1760 ])
        (nil)))
(insn 16 13 0 2 (use (reg/i:DI 0 ax)) j.c:4 -1
     (nil))

ISTM that we want (reg 86) to prefer di and (reg 87) to prefer ax by way of the
hard register copies.  (reg 88) should then prefer di by way of insn 6.

(reg 89) really doesn't need a preference and can go anywhere that doesn't
conflict.

So if we look at the IRA dump we have:

Pass 1 for finding pseudo/allocno costs

    r89: preferred GENERAL_REGS, alternative NO_REGS, allocno GENERAL_REGS
    r88: preferred GENERAL_REGS, alternative NO_REGS, allocno GENERAL_REGS
    r87: preferred AREG, alternative GENERAL_REGS, allocno GENERAL_REGS
    r86: preferred DIREG, alternative GENERAL_REGS, allocno GENERAL_REGS

Which I guess is OK.  A bit surprised to not see r88 preferring DIreg at this
point, but I guess copies implied by the 2 operand nature are handled later.

ISTM that the copy implied by insn 6 should result in 88 somehow preferring
DIreg.  Then, ideally we'd see that while 89 can go anywhere it's best to match
it with 87.

Vlad, what am I missing here?


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