http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58223

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Ok, so what happens here is that rdg_build_partitions builds two partitions,
that essentially means we split the loop in the original test case into two
loops:

  for (b = 0; b < 2; b++)
    a[0] = 1;

  for (b = 0; b < 2; b++)
    a[b] = 0;

Now, we go over all partitions and classify_partition them, in both loops we
have only one store and no load, thus we're in
  if (single_store && !single_load)
    {
       ...
    }
condition.  For the first loop we bail out, since const_with_all_bytes_same is
true for 1 and TYPE_MODE for that 1 is not the same as TYPE_MODE for unsigned
char (had the "a" array been of the char type, it would be the same TYPE_MODE).
But for second loop we happily set the PKIND_MEMSET, thus replace it later with
memset.

I don't know much about partitioning, but it seems that we shouldn't split the
loop in the first place.

Reply via email to