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

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-05-03 
14:17:32 UTC ---
I think it is because of how we do VN lookup / insert during phi_translation.
SCCVN does not guarantee availability of its lookup result, thus when
such availability is not guaranteed when we translate things we should rather
use the non-canonical expression (after all we translate expressions (sic!),
not values).

What happens is that we have (simplified)

  if (b)
    {
      x_1 = a;
    }
  else
    {
      if (c)
        for(;;)
          {
            x_2 = a;
            a = 0;
          }
    }

and SCCVN value-numbers x_2 to x_1.  PRE sees that 'a' is ANTIC_IN in the
for (;;) block - but it's not ANTIC_OUT in the if (c) block because it
gets cleaned out there as it is translated as x_1 which is not insertable.

I think the PRE algorithm does not expect that phi_translate (ANTIC_IN (succ))
will ever return something that is _not_ valid at the ANTIC_OUT position.
But our phi-translate implementation happily causes this situation.

My suggested change to check validity of the phi_translate result at
insert time is a workaround, but it only makes this a missed optimization.

This particular case is fixed by not turning the memory reference into
a conversion on translation.

Reply via email to