https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61247
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org --- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- int foo (int *p, unsigned long sz) { int sum = 0; for (unsigned i = 0; i < sz; ++i) sum += p[i]; return sum; } is a simpler variant. What works is that we set up to version the loop with sz_7(D) + 18446744073709551615 <= 4294967294 and do loop_constraint_set (loop, LOOP_C_FINITE), but that is not enough to make SCEV analysis succeed for the DR (so we get a gather) or analyze the index PHI in the induction defining the supposed gather index: t.c:4:26: note: Analyze phi: _15 = PHI <_4(6), 0(5)> t.c:4:26: missed: reduction used in loop. t.c:4:26: missed: Unknown def-use cycle pattern. ... t.c:4:26: note: worklist: examine stmt: _1 = _15 * 4; t.c:4:26: note: vect_is_simple_use: operand _15 = PHI <_4(6), 0(5)>, type of def: unknown t.c:4:26: missed: Unsupported pattern. t.c:5:13: missed: not vectorized: unsupported use in stmt. t.c:4:26: missed: unexpected pattern. I will see to fix this on the SCEV side.