https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102827

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
The following reproduces the issue with -O -mavx -ftree-vectorize --param
ssa-name-def-chain-limit=0

The issue is that split_constant_offset doesn't see through the conversion
in that case and the vectorizer inserts the alias test before where
if-conversion
inserted the invariant stmt.  Basically the vectorizer assumes there's
no defs (that end up being used) between the .LOOP_VECTORIZED test and the loop
header.

Now the --param is somewhat of a red herring and if-conversion only requires
an _extra_ length of the chain of 1 (but we might be close to the limit from
in-loop uses).

void
test_double_double_nugt_var (double *dest, double *src, int b, int i)
{
  while (i < 1)
    {
      dest[i] = b ? src[i] : 0.0;
      ++i;
    }
}

Reply via email to