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]

[PATCH] Disallow replacement of fixed or global regs with older value in regrename


Hi!

The http://gcc.gnu.org/ml/gcc-patches/2005-06/msg01871.html
patch (on top of http://gcc.gnu.org/ml/gcc-patches/2005-06/msg01869.html)
when FRAME_GROWS_DOWNWARD is set to 1 causes some regressions on
ppc64-linux, e.g. 20050122-2.c.  The problem is that in functions that
do non-local goto regrename sees:

(insn:HI 29 28 30 0 (set (reg:DI 2 2)
        (reg:DI 9 9 [123])) 300 {*movdi_internal64} (insn_list:REG_DEP_ANTI 14 (insn_list:REG_DEP_TRUE 20 (insn_list:REG_DEP_TRUE 28 (nil))))
    (expr_list:REG_DEAD (reg:DI 9 9 [123])
        (nil)))
...
(insn:HI 83 30 91 0 (set (reg:DI 9 9)
        (mem/u/c:DI (plus:DI (reg:DI 2 2)
                (const:DI (minus:DI (symbol_ref/u:DI ("*.LC4") [flags 0x2])
                        (symbol_ref:DI ("*.LCTOC1"))))) [10 S8 A8])) 300 {*movdi_internal64} (insn_list:REG_DEP_TRUE 29 (nil))
    (nil))
and as reg 9 contains the same value as reg 2 and reg 9
is older, it replaces the second instruction with:
(insn:HI 83 30 91 0 (set (reg:DI 9 9)
        (mem/u/c:DI (plus:DI (reg:DI 9 9 [2])
                (const:DI (minus:DI (symbol_ref/u:DI ("*.LC4") [flags 0x2])
                        (symbol_ref:DI ("*.LCTOC1"))))) [10 S8 A8])) 300 {*movdi_internal64} (insn_list:REG_DEP_TRUE 29 (nil))
    (nil))
but that fails to match, as rs6000 backend requires the GOT
register (2) to be used in such patterns.
Register 2 is a fixed register, and most of the compiler
does not attempts to be conservative with them (including
other part of regrename).

The attached patch just forbids that optimization for fixed_regs
or global_regs.  If you think that might cause any performance
degradation, another alternative would be to recognize insns
after the replacement in copyprop_hardreg_forward pass and if they
no longer match and were valid before, undo the transformation.

	Jakub

Attachment: d-ssp-6
Description: Text document


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