Alexander Monakov wrote:
Hello,
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?
Yes. There's code at the start of nonoverlapping_memrefs_p to handle
these cases, but as Pat pointed out, it doesn't work for large offsets
from the stack/frame pointer (large enough to cause a secondary
reload). I'm not sure offhand how to best fix this.
jeff