https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81558
Bug ID: 81558
Summary: Loop not vectorized
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: kugan at gcc dot gnu.org
Target Milestone: ---
For the testcase:
struct I
{
int opix_x;
int opix_y;
};
//#define R
#define R __restrict__
extern struct I * R img;
extern unsigned short ** R imgY_org;
extern unsigned short orig_blocks[256];
void foo1 (int n)
{
int x = 1, y = 1;
unsigned short *orgptr=orig_blocks;
// Vectorized
for (y = 0; y < img->opix_y; y++)
for (x = 0; x < img->opix_x; x++)
*orgptr++ = imgY_org [y][x];
}
void foo2 (int n)
{
int x = 1, y = 1;
unsigned short *orgptr=orig_blocks;
// Not vectorized
for (y = img->opix_y; y < img->opix_y+16; y++)
for (x = img->opix_x; x < img->opix_x+16; x++)
*orgptr++ = imgY_org [y][x];
}
Loop in foo2 is not vectorized.
In the *.156t.vect, I see:
Creating dr for *_40
analyze_innermost: failed: evolution of base is not affine.
base_address:
offset from base address:
constant offset from base address:
step:
aligned to:
base_object: *_40
LLVM seems to be able to vectorize this.