[Bug tree-optimization/48052] loop not vectorized if index is "unsigned int"

amker at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jun 23 13:52:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48052

amker at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amker at gcc dot gnu.org

--- Comment #16 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.

Hi, thank you for reporting this.  I shall have a look.



More information about the Gcc-bugs mailing list