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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> That is:
> ```
> (for op  (eq ne)
>  (simplify
>   (op (pointer_plus @0 @1) (pointer_plus @0 @2))
>   (op @1 @2))
> 
> ```

Note I am missing a extra `)` but then I Noticed in the full testcase (that is
located in https://gcc.gnu.org/pipermail/gcc-patches/2023-November/638130.html)
which was originally reported we still end up with:
```
  _76 = _71 + 4;
  # .MEM_154 = VDEF <.MEM_153>
  x_3(D)->D.25942._M_implD.25172.D.25249._M_finishD.25175 = _76;
  # .MEM_7 = VDEF <.MEM_154>
  D.26033 = 0;
  # .MEM_157 = VDEF <.MEM_7>
  *_76 = 0;
  # PT = nonlocal escaped 
  _82 = _71 + 8;
  # .MEM_158 = VDEF <.MEM_157>
  x_3(D)->D.25942._M_implD.25172.D.25249._M_finishD.25175 = _82;
  # .MEM_8 = VDEF <.MEM_158>
  D.26033 ={v} {CLOBBER(eol)};
  # .MEM_9 = VDEF <.MEM_8>
  D.26034 = 0;
  if (_66 != _82)
```
After pre (note the first comparison is gone but not the second one and maybe a
3rd). So this patch helps but it looks like a PRE/VN improvement is still
needed to fix the others.

Reply via email to