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



--- Comment #31 from Jan Hubicka <hubicka at gcc dot gnu.org> 2013-01-16 
14:20:46 UTC ---

Well, after early optimizations we get:

int main() ()

{

  struct Foo x;

  void Foo::<T392> (const struct Foo *) * iftmp.0;

  long int _3;

  long int _4;

  int (*__vtbl_ptr_type) () * _5;

  long int _6;

  sizetype _7;

  int (*__vtbl_ptr_type) () * _8;



  <bb 2>:

  _3 = (long int) Bar;

  _4 = _3 & 1;

  if (_4 == 0)

    goto <bb 4>;

  else

    goto <bb 3>;



  <bb 3>:

  _5 = MEM[(int (*__vtbl_ptr_type) () * *)&x];



that is only later, at ccp2 times turned int

int main() ()

{

  struct Foo x;

  long int _3;



  <bb 2>:

  _3 = (long int) Bar;

  Foo::Bar (&x);

  x ={v} {CLOBBER};

  return 0;



}



ccp1 s not able to do this because it still sees:

int main() ()

{

  struct

  {

    void Foo::<T392> (const struct Foo *) * __pfn;

    long int __delta;

  } y;

  struct Foo x;

  void Foo::<T392> (const struct Foo *) * iftmp.0;

  void Foo::<T392> (const struct Foo *) * _5;

  long int _6;

  long int _7;

  long int _9;

  sizetype _10;

  struct Foo * _11;

  int (*__vtbl_ptr_type) () * _12;

  void Foo::<T392> (const struct Foo *) * _13;

  long int _14;

  long int _15;

  sizetype _16;

  int (*__vtbl_ptr_type) () * _17;

  long int _19;

  sizetype _20;

  const struct Foo * _21;



  <bb 2>:

  y.__pfn = Bar;

  y.__delta = 0;

  _5 = y.__pfn;

  _6 = (long int) _5;

  _7 = _6 & 1;

  if (_7 == 0)

    goto <bb 3>;

  else

    goto <bb 4>;



This is fixed by SRA to:

  <bb 2>:

  y$__pfn_4 = Bar;

  y$__delta_3 = 0;

  _5 = y$__pfn_4;

  _6 = (long int) _5;

  _7 = _6 & 1;

  if (_7 == 0)

    goto <bb 3>;

  else

    goto <bb 4>;



  <bb 3>:

  iftmp.0_8 = y$__pfn_4;



Richi, is there chance for subsequent FRE to catch this?

Reply via email to