This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: flow_loops_find
- From: Richard Henderson <rth at redhat dot com>
- To: Franz Sirl <Franz dot Sirl-kernel at lauterbach dot com>
- Cc: Josef Zlomek <zlomj9am at artax dot karlin dot mff dot cuni dot cz>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 2 Jan 2002 17:03:53 -0800
- Subject: Re: PATCH: flow_loops_find
- References: <20011024173657.A5967@artax.karlin.mff.cuni.cz> <20011220174900.A2156@redhat.com> <200201022356.41110@enzo.bigblue.local>
On Thu, Jan 03, 2002 at 12:11:04AM +0100, Franz Sirl wrote:
> On Friday 21 December 2001 02:49, Richard Henderson wrote:
> > On Wed, Oct 24, 2001 at 05:36:57PM +0200, Josef Zlomek wrote:
> > > * cfgloop.c (flow_loops_find): Use the information of the depth
> > > first search order of the CFG correctly when finding natural loops.
> >
> > Applied.
>
> This patch breaks glibc on powerpc-linux, it causes ld.so to segfault due to
> a invalid relocation.
This has nothing to do with loop. Just requires giving reload
the right set of inputs. A reduced test case is the following,
compiled with
./cc1 -D__ppc__ -O2 -da -fpic -fno-omit-frame-pointer ~/zz.c
The important thing here is
(insn 25 18 26 (set (reg:SI 3 r3)
(reg/f:SI 116)) 294 {*movsi_internal1}
(expr_list:REG_DEAD (reg/f:SI 116)
(expr_list:REG_EQUAL (symbol_ref:SI ("@i"))
(nil))))
and that symbol_ref is not a legitimate operand for movsi_internal1
in pic mode, so we wind up with
(insn 47 18 25 (set (reg:SI 9 r9)
(unspec:SI[
(symbol_ref/u:SI ("*.LC0"))
(reg:SI 30 r30)
] 8)) 287 {*movsi_got_internal} (nil)
(nil))
(insn 25 47 26 (set (reg:SI 3 r3)
(mem/u/f:SI (reg:SI 9 r9) [3 S4 A32])) 294 {*movsi_internal1}
(expr_list:REG_EQUAL (symbol_ref:SI ("@i"))
(nil)))
I've not quite figured out what to do about this. I'd think we'd
be able to induce this sort of failure in other targets, but I've
not been able to do so for one reason or another. I have uncovered
some places we failed to do cse or constant reconstruction properly
though. ;-(
r~
#if defined(__i386__)
extern void f1(int) __attribute__((regparm(1)));
extern void f2(int*) __attribute__((regparm(1)));
#define clobber \
asm volatile("#asm" : : : "si", "di")
#elif defined(__ppc__)
#define clobber \
asm volatile("#asm" : : : "14", "15", "16", "17", "18", "19", "20", \
"21", "22", "23", "24", "25", "26", "27", "28", "29", "31")
#elif defined(__alpha__)
#define clobber \
asm volatile("#asm" : : : "9", "10", "11", "12", "13", "14", "15")
#else
#error
#endif
extern void f1(int);
extern void f2(int*);
static int i;
void bar()
{
int *a;
f1(i);
clobber;
a = &i;
f2(a);
}