This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/48052] loop not vectorized if index is "unsigned int"
- From: "amker at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 24 Jun 2015 02:34:07 +0000
- Subject: [Bug tree-optimization/48052] loop not vectorized if index is "unsigned int"
- Auto-submitted: auto-generated
- References: <bug-48052-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48052
--- Comment #17 from amker at gcc dot gnu.org ---
(In reply to Stupachenko Evgeny from comment #15)
> The commit caused regressions on some benchmarks. Test to reproduce:
> (compilations flags: -Ofast)
>
> int foo (int flag, char *a)
>
> {
>
> short i, j;
>
> short l = 0;
>
> if (flag == 1)
>
> l = 3;
>
>
> for (i = 0; i < 4; i++)
>
> {
>
> for (j = l - 1; j > 0; j--)
>
> a[j] = a[j - 1];
>
> a[0] = i;
>
> }
>
> }
>
> Here value of l is between 0 and 3, and therefore value of the innermost
> loop bound (l - 1) is between -1 and 2.
>
> After the commit the innermost loop is replaced with memmove call. This is
> obviously not optimal as amount of memory to move is not greater than 2.
(In reply to amker from comment #16)
> (In reply to Stupachenko Evgeny from comment #15)
> > The commit caused regressions on some benchmarks. Test to reproduce:
> > (compilations flags: -Ofast)
> >
> > int foo (int flag, char *a)
> >
> > {
> >
> > short i, j;
> >
> > short l = 0;
> >
> > if (flag == 1)
> >
> > l = 3;
> >
> >
> > for (i = 0; i < 4; i++)
> >
> > {
> >
> > for (j = l - 1; j > 0; j--)
> >
> > a[j] = a[j - 1];
> >
> > a[0] = i;
> >
> > }
> >
> > }
> >
> > Here value of l is between 0 and 3, and therefore value of the innermost
> > loop bound (l - 1) is between -1 and 2.
> >
> > After the commit the innermost loop is replaced with memmove call. This is
> > obviously not optimal as amount of memory to move is not greater than 2.
>
> Hi, thank you for reporting this. I shall have a look.
This is latent optimization issue in loop-niter/loop-dist revealed because more
scev are recognized now.
I filed PR66646 for tracking.
Thanks,
bin