[Bug tree-optimization/95410] Failure to optimize compare next to and properly

2021-09-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95410

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug tree-optimization/95410] Failure to optimize compare next to and properly

2021-04-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95410

--- Comment #2 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #1)
> I notice the other two don't produce the same tree level either (but the
> same assembly code in the end):

Oh the same assembly in the end was on aarch64, on x86_64 they are not.  Oh and
that problem is PR 95409.  I will put my analysis of the differences there.

[Bug tree-optimization/95410] Failure to optimize compare next to and properly

2021-04-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95410

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2021-04-21

--- Comment #1 from Andrew Pinski  ---
Confirmed.
We have:
  if (x.0_1 >= y.1_2)
goto ; [34.00%]
  else
goto ; [66.00%]

   [local count: 708669601]:
  _10 = ~x_5(D);
  _7 = (bool) _10;

   [local count: 1073741824]:
  # _4 = PHI <0(2), _7(3)>

Which obvious can be converted to:
_10 = ~x_5(D);
_7 = (bool)
_t = x.0_1 >= y.1_2
_t1 = ~_t
_4 = _t1 & _7

 CUT 
I notice the other two don't produce the same tree level either (but the same
assembly code in the end):
  _1 = ~x_7(D);
  _4 = x.2_2 < y.3_3;
  _5 = (int) _4;
  _6 = _1 & _5;
  _9 = (bool) _6;

  _3 = x.4_1 < y.5_2;
  _11 = ~x_7(D);
  _5 = (bool) _11;
  _6 = _3 & _5;
---
That is it does not convert:
  _5 = (int) _4;
  _6 = _1 & _5;
  _9 = (bool) _6;

Into:
  _t = (bool) _1;
  _6 = _t & _4;