This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: miscompiled loop condition
- To: Bernd Schmidt <bernds at pathia dot cygnus dot co dot uk>
- Subject: Re: miscompiled loop condition
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Tue, 30 Nov 1999 01:27:19 -0700
- cc: Stephen L Moshier <moshier at mediaone dot net>, gcc-bugs at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Reply-To: law at cygnus dot com
In message <Pine.LNX.4.04.9911291403250.16486-100000@pathia.cygnus.co.uk>you
write:
> It is now restricted to extended basic blocks. The way the loop optimizer
> is written (no good information about control flow available) makes it hard
> to do better.
FWIW, this will be changing soon [ see recent submissions from Michael Hayes].
When I first started looking at this problem I seriously considered building
a cfg for the loop, then calling into the global cprop optimizer. But we're
not at a point where we can do that (yet). But that may be the long term
direction depending on its cost.
> I'd like to install this variant of the testcase in the testsuite. OK?
Yes. Please do.
> + /* For communication between note_reg_stored and its caller. */
> + static int set_seen;
> +
> + /* Called via note_stores, record in SET_SEEN whether X, which is written
> ,
> + is equal to ARG. */
> + static void
> + note_reg_stored (x, setter, arg)
> + rtx x, setter;
> + void *arg;
> + {
> + rtx reg = (rtx) arg;
> + if (arg == x)
> + set_seen = 1;
> + }
As Mark mentioned, you might as well pass in a structure, then set the
return value via that structure. Also, mark setter with ATTRIBUTE_UNUSED.
Maybe I'm missing something, but if you stop replacing when you hit a
label (end of extended basic block), what happens to uses *after* that point?
jeff