post-reload crossjump tweak

Jan Hubicka jh@suse.cz
Thu Apr 17 16:41:00 GMT 2003


> This causes problems with a patch I'm working on for ia64
> that represents symbol address loads with just symbol_ref
> before reload.  Post-reload, we split them into their
> constituent instructions.  Problem is, crossjumping was
> undoing this split, resulting in aborts.

Speaking about the symbol_refs, we are hitting related Ada
misscompilation on the hammer branch (bug is present but not reproducing
on 3.3 branch).  Michael (currently at a vacation) has traked it down to
situation where we do have call with GOT pointer save/restore.
Something like

save r1
call
restore r1

Pre-reload scheduler moves instruction:

(insn 2072 2070 2074 122 0x2000000007b7d980 (set (mem/f:QI (reg/f:DI 1169)
  [2 opt__check_object_consistency+0 S1 A8])
        (subreg/s/u:QI (reg/v:SI 1168) 0)) 2 {*movqi_internal} (nil)
    (expr_list:REG_DEAD (reg/v:SI 1168)
        (expr_list:REG_DEAD (reg/f:DI 1169)
            (nil))))

After the call and before the restore.   Subsequently reload decides to
rematerialize:

Reloads for insn # 2072
Reload 0: reload_in (DI) = (symbol_ref:DI ("opt__check_object_consistency"))
        GR_REGS, RELOAD_FOR_OPERAND_ADDRESS (opnum = 0), can't combine
        reload_in_reg: (reg/f:DI 1169)
        reload_reg_rtx: (reg:DI 15 r15)
Reload 1: reload_in (DI) = (plus:DI (reg/f:DI 111 loc79)
                       (const_int -508 [0xfffffffffffffe04]))
        GR_REGS, RELOAD_FOR_INPADDR_ADDRESS (opnum = 1), can't combine
        reload_in_reg: (plus:DI (reg/f:DI 111 loc79)
                        (const_int -508 [0xfffffffffffffe04]))
        reload_reg_rtx: (reg:DI 15 r15)

and expand it as:

(insn 4846 4849 4847 122 (nil) (set (reg:DI 15 r15)
        (plus:DI (high:DI (symbol_ref:DI ("opt__check_object_consistency")))
            (reg:DI 1 r1))) 11 {*load_symptr_high} (nil)
    (nil))

(insn 4847 4846 2072 122 (nil) (set (reg:DI 15 r15)
        (lo_sum:DI (reg:DI 15 r15)
            (symbol_ref:DI ("opt__check_object_consistency")))) 12
    {*load_symptr_low} (nil)
    (expr_list:REG_EQUAL (symbol_ref:DI ("opt__check_object_consistency"))
        (nil)))

(insn 2072 4847 4399 122 0x2000000007b7d980 (set (mem/f:QI (reg:DI 15 r15)
  [2 opt__check_object_consistency+0 S1 A8])
        (reg:QI 16 r16)) 2 {*movqi_internal} (nil)
    (nil))

That is wrong because R1 is clobbered at the moment.  What to do here?
Only solution I can think of is to add instruction doing both call and
restore at once and splitting it post-reload.  Your pass may run into
this problem more hardly.

Honza



More information about the Gcc-patches mailing list