doloop-opt deficiency

Dale Johannesen dalej@apple.com
Wed Aug 31 09:50:00 GMT 2005


extern int a[];
int foo(int w) {
   int n = w;
   while (n >= 512)
     {
     a[n] = 42;
     n -= 256;
     }
   }

> On Aug 30, 2005, at 9:25 AM, Sebastian Pop wrote:

Thanks for looking at this.  But...

> Dale Johannesen wrote:
>> I think this is a simple pasto; this code was evidently copied from
>> the previous block:
>
> I don't think that this was a simple pasto.  The code looks correct.
> We have the same code in tree-ssa-loop-niter.c around line 436, since
> we inherited this code from the rtl-level.

No, look closer.  The version in loop-iv.c does a NEG of 'step'  just 
before what's
shown here.  The version in tree-ssa-loop-niter.c doesn't.   Reversing 
the
operator does make them do the same thing.  As a sanity check, try the 
same
loop going the other direction:

extern int a[];
int foo(int w) {
   int n = w;
   while (n <= 512)
     {
     a[n] = 42;
     n += 256;
     }
   }

and you'll see it does do the doloop transformation.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1842 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20050831/7487e5e9/attachment.bin>


More information about the Gcc mailing list