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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Hongtao.liu from comment #1)
> foo() also can be eliminated.

This one is similar to PR 105832 really.

```
 _2 = (int) a.2_1;
  _3 = 2 >> _2;
  if (_3 == 2)
    goto <bb 4>; [34.00%]
  else
    goto <bb 6>; [66.00%]

  <bb 4> [local count: 182536112]:
  _4 = 1 << _2;
  iftmp.1_10 = (char) _4;
  if (iftmp.1_10 == 0)
    goto <bb 5>; [33.00%]
  else
    goto <bb 6>; [67.00%]
```
`(2 >> _2) == 2` could be optimized to just `_2 == 0`.
And then `_4` becomes `1` and then the conditional is optimized away and such.

Reply via email to