Alexander Monakov <[EMAIL PROTECTED]> wrote on 09/29/2008 01:34:12 PM:

> I'm seeing a miscompilation on sel-sched branch that at first sight looks
> related to IRA merge.
>
> alias.c::anti_dependence disambiguates references to
> (mem/c:DI (reg:DI 122 r122 [121]) [64 ivtmp.743+0 S8 A64])
> and
> (mem/c:DI (reg:DI 122 r122) [64 ivtmp.1640+0 S8 A64])
> while there are no stores to r122 between corresponding insns.
>
> It does so because nonoverlapping_memrefs_p returns TRUE for these mems,
which
> is, in turn, due to this code:
>
> 2118   /* If either RTL is not a MEM, it must be a REG or CONCAT, meaning
they
> 2119      can't overlap unless they are the same because we never
> reuse that part
> 2120      of the stack frame used for locals for spilled pseudos.  */
> 2121   if ((!MEM_P (rtlx) || !MEM_P (rtly))
> 2122       && ! rtx_equal_p (rtlx, rtly))
> 2123     return 1;
>
> Corresponding RTL_DECLS are:
> rtlx = (reg:DI 97 r105 [orig:850 ivtmp.743 ] [850])
> rtly = (mem/c:DI (plus:DI (reg/f:DI 111 r119)
>         (const_int -1456 [0xfffffffffffffa50])) [64 ivtmp.1640+0 S8 A64])
>
> Does IRA support stack slot sharing described in the comment?

We just got done walking through a failure with 200.sixtrack that looks
like the same thing.  The two insns involved are:


(insn 33168 33162 33175 27 maincr.f:1 (set (reg/f:DI 14 14 [orig:614
ivtmp.1309 ] [614])
        (mem/c:DI (plus:DI (reg:DI 11 11)
                (const_int -7080 [0xffffffffffffe458])) [101 ivtmp.1309+0
S8 A64])) 349 {*movdi_internal64} (nil))

(insn 33175 33168 33176 27 maincr.f:1 (set (mem/c:DF (plus:DI (reg:DI 11 11
[5])
                (const_int -7080 [0xffffffffffffe458])) [101 D.3497+0 S8
A64])
        (reg:DF 45 13 [orig:765 D.3497 ] [765])) 336 {*movdf_hardfloat64}
(expr_list:REG_DEAD (reg:DF 45 13 [orig:765 D.3497 ] [765])
        (nil)))


The MEM refs are not seen as overlapping which then allows the scheduler to
reorder the store to MEM above the load. The problem is brought about
because an additional register is needed to access the stack location since
it is beyond the 32K limit for PPC.  So before these references we have an
insn 'r11 = r1 + 64K'.  The code in alias.c:stack_addr_p() does not
recognize r11 as pointing to the stack and therefor the IRA code in
nonoverlapping_memrefs_p() does not recognize the above MEMs as being stack
references and use the special code for reused ira spill slots. It seems
like stack_addr_p() doesn't handle reg+reg addressing also, only
recognizing reg+const references (unless those are meant to be caught
elsewhere).


Reply via email to