| Summary: | Reorder the statements in the loop can vectorize it | ||
|---|---|---|---|
| Product: | gcc | Reporter: | Changpeng Fang <changpeng.fang> |
| Component: | tree-optimization | Assignee: | Not yet assigned to anyone <unassigned> |
| Status: | NEW --- | ||
| Severity: | enhancement | CC: | gcc-bugs |
| Priority: | P3 | Keywords: | missed-optimization |
| Version: | 4.5.0 | ||
| Target Milestone: | --- | ||
| Host: | Target: | ||
| Build: | Known to work: | ||
| Known to fail: | Last reconfirmed: | 2016-08-14 00:00:00 | |
| Bug Depends on: | |||
| Bug Blocks: | 53947 | ||
Confirmed. |
int a[100], b[100], c[100], d[100]; void foo () { int i; for(i=1; i< 99; i++) { a[i] = b[i-1] + c[i]; b[i] = b[i+1] + d[i]; } } gcc -O3 -ffast-math -ftree-vectorizer-verbose=2 -c foo.c foo.c:6: note: not vectorized, possible dependence between data-refs b[D.2728_3] and b[i_17] foo.c:3: note: vectorized 0 loops in function. However, if we reorder the two statements in the loop, then it can be vectorized. open64 can do this reordering.