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

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 45404
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45404&action=edit
VRP patch

This makes VRP register asserts for the pointer variants.  This doesn't help
until after ifcombine because we throw the asserts away if they are not
EQ/NE_EXPR but after ifcombine DOM then manages to optimize the testcase nicely
again.  After the libstdc++ patch and dom2:

__attribute__((abi_tag ("cxx11"), flatten))
f ()
{
  const size_type __nleft;
  char[16] * _3;
  long unsigned int __x.5_4;
  long unsigned int __y.6_5;
  char * _12;

  <bb 2> [local count: 1073741824]:
  _3 = &MEM[(struct basic_string *)s_2(D)].D.18989._M_local_buf;
  MEM[(struct _Alloc_hider *)s_2(D)]._M_p = _3;
  MEM[(size_type *)s_2(D) + 8B] = 0;
  MEM[(char_type &)s_2(D) + 16] = 0;
  __x.5_4 = (long unsigned int) "hello";
  __y.6_5 = (long unsigned int) _3;
  if (__x.5_4 != __y.6_5)
    goto <bb 3>; [75.00%]
  else
    goto <bb 4>; [25.00%]

  <bb 3> [local count: 805306369]:
  __builtin_memcpy (_3, "hello", 5);
  goto <bb 5>; [100.00%]

  <bb 4> [local count: 67108864]:
  __builtin_memcpy ("hello", &MEM[(void *)"hello" + 5B], 5);

  <bb 5> [local count: 1073741824]:
  MEM[(size_type *)s_2(D) + 8B] = 5;
  _12 = MEM[(char * *)s_2(D)];
  MEM[(char_type &)_12 + 5] = 0;
  return s_2(D);

}

Reply via email to