This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH for bogus loop optimization, part 2
- To: mark at markmitchell dot com
- Subject: Re: PATCH for bogus loop optimization, part 2
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Fri, 17 Jul 1998 00:13:38 -0600
- cc: egcs-patches at cygnus dot com
- Reply-To: law at cygnus dot com
In message <199807161744.KAA02710@smtp.earthlink.net>you write:
> BTW, one way to fix this problem, and retain the optimization, might
> be along the lines of:
>
> o Pointers can never overflow in a conformant program. (Neither
> can integers, but people do make use of this wrap-around behavior
> for integers.)
Right. And I believe we assume elsewhere in the compiler that a pointer
can not overflow.
> o Any comparison between pointers should be unsigned.
I don't think we can assume this though.
> Thus a fixup pass could go through at the end of loop and replace and
> signed comparisons of pointers (SYMBOL_REFs, LABEL_REFs, REG's with
> REGNO_POINTER_FLAG) registers with unsigned comparisons.
Another note, you can't depend on REGNO_POINTER_FLAG catching all pointers.
Consider a pseudo reg which is used in two threads of control, in one thread
it is a pointer, in another it is an integer. We will not set REGNO_POINTER_FLAG
in this case. This case can happen due to optimizations which occur before
loop.
There's other cases where you can have a reg which is used in an address,
but does not have REGNO_POINTER_FLAG set.
I'm going to go over your original patch again in a minute :-)
jeff