https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127190
Bug ID: 127190
Summary: [17 Regression] ICE in vect_create_constant_vectors at
tree-vect-slp.cc:10912 since r17-3793
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: dhruvc at gcc dot gnu.org
CC: rguenth at gcc dot gnu.org
Target Milestone: ---
Target: aarch64
Seen in SPEC2026 palm and llvm benchmarks. Looks like the commit's testcase is
itself failing on AArch64:
===
unsigned a, c;
int b, d;
signed char e;
void __attribute__((noipa))
f (void)
{
for (; b; ++b)
{
c = 0;
for (; c < 10; c++)
{
d = 0;
for (; d < c; d++)
a += e;
}
}
}
===
Flags: -O3 -march=armv8-a+sve
Compiler explorer: https://godbolt.org/z/nesnGaea6
===
LLM-generated explanation (if useful):
Commit adds an extra requirement to vect_get_num_copies_for_invariant
(gcc/tree-vect-slp.cc:8946):
bool res = (can_div_away_from_zero_p (vf, TYPE_VECTOR_SUBPARTS (vectype),
nvectors)
&& ((TYPE_VECTOR_SUBPARTS (vectype) * *nvectors - vf).is_constant
(&rem)));
For SVE the vectype is variable-length, so subparts * nvectors - vf is not
constant → returns false. Both callers assume it cannot fail:
- vect_create_constant_vectors gcc_assert (res)
— tree-vect-slp.cc:10912
- vectorizable_lane_reducing gcc_assert (res && ncopies_for_cost >= 1)
— tree-vect-loop.cc:6861