https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121349
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2026-09-04
Status|UNCONFIRMED |NEW
Keywords| |missed-optimization
Ever confirmed|0 |1
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
void test (int *restrict a, int *restrict b, int *restrict e, int *restrict f,
int n)
{
for (int i = 0; i < n; i += 2)
{
// A separate masked store using a[i+1] < 0
// This forces a[i+1] < 0 into scalar_cond_masked_set.
f[i+1] = (a[i+1] < 0) ? 1 : f[i+1];
// SLP group of size 2 of logical ANDs
int cond0 = (a[i] < 0) & (b[i] < 0);
int cond1 = (a[i+1] < 0) & (b[i+1] < 0);
// True masked stores using cond0 and cond1
if (cond0)
e[i] = 10;
if (cond1)
e[i+1] = 20;
}
}
is a LLM generated testcase. But the LLM concludes while there is a structural
mismatch between how we register and query scalar_cond_masked_set the actual
behavior is safe.
Though it notes that while vectorizable_call does not have a mask uniformity
check upon mask registration while check_load_store_for_partial_vectors has.
It indeed seems that we only ever do extra masking by the loop mask which
should be always safe but might be a missed-optimization when there is
a mismatch(?) or fails to apply when the mask isn't uniform and thus not
registered with the simple single-lane map.