On 08/25/2011 01:42 PM, Tom de Vries wrote: > Hi Zdenek, > > here's the updated version of the patch. > > The goal is to remove the 'i' iterator from the following example, by > replacing 'i < n' with 'p < base + n'. > > void > f (char *base, unsigned long int i, unsigned long int n) > { > char *p = base + i; > do > { > *p = '\0'; > p++; > i++; > } > while (i < n); > } > > bootstrapped and reg-tested on x864_64, and build and reg-tested on MIPS. > > I will sent a test-case in a separate email. >
OK for trunk? 2011-08-25 Tom de Vries <t...@codesourcery.com> * gcc.dg/tree-ssa/ivopts-lt.c: New test.
Index: gcc/testsuite/gcc.dg/tree-ssa/ivopts-lt.c =================================================================== --- /dev/null (new file) +++ gcc/testsuite/gcc.dg/tree-ssa/ivopts-lt.c (revision 0) @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-ivopts" } */ + +void +f1 (char *p, unsigned long int i, unsigned long int n) +{ + p += i; + do + { + *p = '\0'; + p += 1; + i++; + } + while (i < n); +} + +/* { dg-final { scan-tree-dump-times "PHI" 1 "ivopts"} } */ +/* { dg-final { scan-tree-dump-times "PHI <p_" 1 "ivopts"} } */ +/* { dg-final { scan-tree-dump-times "p_\[0-9\]* <" 1 "ivopts"} } */ +/* { dg-final { cleanup-tree-dump "ivopts" } } */