[Bug tree-optimization/83518] [8 Regression] Missing optimization: useless instructions should be dropped

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jan 8 09:53:00 GMT 2018


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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Before store-merging we have:
  MEM[(int *)&arr] = { 5, 4, 3, 2 };
  t_2 = arr[0];
  _65 = arr[1];
  _69 = arr[2];
  _73 = arr[3];
  arr[0] = _69;
  arr[1] = _73;
  arr[2] = 1;
  arr[3] = t_2;
  vect__2.5_38 = MEM[(int *)&arr];
and all store-merging can do with this is what it does:
  MEM[(int *)&arr] = { 5, 4, 3, 2 };
  t_2 = arr[0];
  _65 = arr[1];
  _69 = arr[2];
  _73 = arr[3];
  _46 = MEM[(int *)&arr + 8B];
  MEM[(int *)&arr] = _46;
  arr[2] = 1;
  arr[3] = t_2;
  vect__2.5_38 = MEM[(int *)&arr];
where the _69 and _73 sets can be DCEd later.  store-merging has no framework
like FRE to do analysis what memory location contains at which point.
So we'd need another late FRE pass to handle this?


More information about the Gcc-bugs mailing list