REG_DEAD/REG_EQUIV problem.
Alan Modra
alan@linuxcare.com.au
Wed Jan 31 22:57:00 GMT 2001
Here's a testcase for a problem that shows up on hppa-linux, hppa64-linux,
hppa64-hpux11, hppa1.1-hpux11.
cat > losum.c <<EOF
extern void foo (char *);
inline char *
f1 (char *str, long A, long B, long C, long D, long E, long F, long G,
long H, long I, long J, long K, long L, long M)
{
long a,b,c,d,e,f,g,h,i,j,k,l,m,p = 0;
for (a = 0; a < A; a++)
for (b = 0; b < B; b++)
for (c = 0; c < C; c++)
for (d = 0; d < D; d++)
for (e = 0; e < E; e++)
for (f = 0; f < F; f++)
for (g = 0; g < G; g++)
for (h = 0; h < H; h++)
for (i = 0; i < I; i++)
for (j = 0; j < J; j++)
for (k = 0; k < K; k++)
for (l = 0; l < L; l++)
for (m = 0; m < M; m++)
{
foo ("");
p++;
}
foo("");
return str + p;
}
char *f2 (long x)
{
return f1 ("zz", x, x, x, x, x, x, x, x, x, x, x, x, x);
}
EOF
hppa64-hpux11-gcc -O2 -fPIC -S losum.c -da --save-temps
gives me code like this near the end of f2:
addil LT'L$C0000,%r27
ldo -16(%r30),%r29
ldd RT'L$C0000(%r1),%r1
b,l foo,%r2
copy %r1,%r26
copy %r14,%r27
ldd RT'L$C0001(%r1),%r19 ; Oops, where's the addil for r1?
ldd -272(%r30),%r2
add,l %r19,%r16,%r28
Extract from losum.c.18.lreg:
===
(insn 15 6 17 (set (reg:DI 70)
(plus:DI (reg:DI 27 %r27)
(high:DI (symbol_ref/v/f:DI ("*L$C0001"))))) 81 {*pa.md:2337} (nil)
(nil))
(insn 17 15 21 (set (reg/v:DI 69)
(mem/u:DI (lo_sum:DI (reg:DI 70)
(unspec:DI[
(symbol_ref/v/f:DI ("*L$C0001"))
] 0)) 0)) 83 {*pa.md:2368} (insn_list 15 (nil))
(expr_list:REG_EQUIV (mem/u:DI (lo_sum:DI (reg:DI 70)
(unspec:DI[
(symbol_ref/v/f:DI ("*L$C0001"))
] 0)) 0)
(expr_list:REG_DEAD (reg:DI 70)
(nil))))
[snip]
(insn/i 258 257 267 (set (reg:DI 88)
(plus:DI (reg/v:DI 69)
(reg/v:DI 84))) 166 {*pa.md:3738} (insn_list:REG_DEP_ANTI 257 (nil))
(expr_list:REG_DEAD (reg/v:DI 69)
(expr_list:REG_DEAD (reg/v:DI 84)
(nil))))
===
Now from losum.c.19.greg:
(insn 492 257 258 (set (reg:DI 19 %r19)
(mem/u:DI (lo_sum:DI (reg:DI 1 %r1 [70])
(unspec:DI[
(symbol_ref/v/f:DI ("*L$C0001"))
] 0)) 0)) 83 {*pa.md:2368} (nil)
(nil))
(insn/i 258 492 267 (set (reg:DI 28 %r28 [88])
(plus:DI (reg:DI 19 %r19)
(reg/v:DI 16 %r16 [84]))) 166 {*pa.md:3738} (insn_list:REG_DEP_ANTI 257 (nil))
(nil))
===
Notice how insn 492 uses the equivalence for reg 69, but reg 70 is
dead. If I'm more than halfway right about what is causing this problem,
then it's probably not specific to PA.
Alan Modra
--
Linuxcare. Support for the Revolution.
More information about the Gcc-bugs
mailing list