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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
With the patch from PR63864 we still don't optimize:

  <bb 2>:
  vect_cst_.12_23 = { 0, 1, 2, 3 };
  vect_cst_.11_32 = { 4, 5, 6, 7 };
  vectp.14_2 = &a[0];
  MEM[(int *)&a] = { 0, 1, 2, 3 };
  vectp.14_21 = &a[0] + 16;
  MEM[(int *)vectp.14_21] = { 4, 5, 6, 7 };
  vectp_a.5_22 = &a;
  vect__13.6_20 = MEM[(int *)&a];

this is because while seeing the candidate MEM[(int *)&a] = { 0, 1, 2, 3 };
for the load vect__13.6_20 = MEM[(int *)&a]; we fail to disambiguate
against the store to MEM[(int *)vectp.14_21] which is not simplified
to MEM[&a, 16] = { 4, 5, 6, 7 }; because DOM does not have the "trick"
of representing invariant-ptr + CST as &MEM[&..., CST'] for propagation.

If I fix that (huh, not sure why we don't simply fold the pointer-plus that
way,
now four places do that trick for propagation...) then it works:

LKUP STMT vect__13.6_20 = MEM[(int *)&a]
          vect__13.6_20 = MEM[(int *)&a];
FIND: { 0, 1, 2, 3 }
  Replaced redundant expr 'MEM[(int *)&a]' with '{ 0, 1, 2, 3 }'

t.c.183t.optimized:

foo ()
{
  <bb 2>:
  return 28;

}

Reply via email to