| Summary: | Better induction variable for vectorization | ||
|---|---|---|---|
| Product: | gcc | Reporter: | Marc Glisse <glisse> |
| Component: | tree-optimization | Assignee: | Not yet assigned to anyone <unassigned> |
| Status: | NEW --- | ||
| Severity: | normal | Keywords: | missed-optimization |
| Priority: | P3 | ||
| Version: | 10.0 | ||
| Target Milestone: | --- | ||
| Host: | Target: | x86_64-*-* | |
| Build: | Known to work: | ||
| Known to fail: | Last reconfirmed: | 2019-08-13 00:00:00 | |
| Bug Depends on: | |||
| Bug Blocks: | 53947 | ||
|
Description
Marc Glisse
2019-08-13 09:39:58 UTC
(In reply to Marc Glisse from comment #0) > If we are only ever going to use x+2, why not use that instead, initialize > with {2,3,4,...}, and skip the +2 at every iteration? Or since we have another variable # vect_vec_iv_.13_57 = PHI <{ 1, 2, 3, 4, 5, 6, 7, 8 }(5), vect_vec_iv_.13_58(6)> vect_vec_iv_.13_58 = vect_vec_iv_.13_57 + { 8, 8, 8, 8, 8, 8, 8, 8 }; use that one +1 and maintain one less variable. Confirmed. Note that IVOPTs does not even look at vector IVs and unfortunately the vectorizer itself doesn't try to be clever in any way here. Indeed there's a lot to be desired for the vector code we generate for this testcase... Even when not vectorized unrolling the loop to eliminate the conditional would be profitable I guess (no convenient pass to do this though). |