| Summary: | [autovectorize]: missed optimization | ||
|---|---|---|---|
| Product: | gcc | Reporter: | tim blechmann <tim> |
| Component: | tree-optimization | Assignee: | Not yet assigned to anyone <unassigned> |
| Status: | RESOLVED FIXED | ||
| Severity: | enhancement | CC: | gcc-bugs |
| Priority: | P3 | ||
| Version: | 4.2.2 | ||
| Target Milestone: | --- | ||
| Host: | Target: | ||
| Build: | Known to work: | ||
| Known to fail: | Last reconfirmed: | ||
| Bug Depends on: | |||
| Bug Blocks: | 49774, 53947 | ||
Link to vectorizer missed-optimization meta-bug. Both loops are vectorized now, the one in test2 with a runtime check for alias though. Fixed. Link to restrict meta-bug. |
in the following code, first function is vectorized, while the second one is not: typedef float aligned_float __attribute__((aligned(4 * sizeof(float)))); typedef aligned_float * __restrict__ restricted_float_ptr; void test(int n, restricted_float_ptr in, restricted_float_ptr out) { for (int i = 0; i != n; ++i) out[i] = in[i] + 1.f; } void test2(int n, aligned_float * inarg, aligned_float * outarg) { restricted_float_ptr in = inarg; restricted_float_ptr out = outarg; for (int i = 0; i != n; ++i) out[i] = in[i] + 1.f; }