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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, ifcombine sees
  _3 = iftmp.0_5 ^ 1;
  if (iftmp.0_5 != 1)
    goto <bb 7>; [50.00%]
  else
    goto <bb 5>; [50.00%]

  <bb 5> [local count: 536870912]:
  _4 = (unsigned char) _3;
  if (_4 != 8)
    goto <bb 7>; [50.00%]
  else
    goto <bb 6>; [50.00%]
and turns that into
  _3 = iftmp.0_5 ^ 1;
  _4 = (unsigned char) _3;
  _2 = (unsigned int) iftmp.0_5;
  if (_2 != 1)
    goto <bb 7>; [75.00%]
  else
    goto <bb 6>; [25.00%]
where _3, _5 are int, _4 is uchar and _2 is uint.
That looks wrong, the former is if (_5 != 1 || ((unsigned char) (_5 ^ 1)) != 8)
goto bb7;
i.e. if (true) goto bb7; (if _5 is not 1, it jumps, if _5 is 1, _5 ^ 1 is 0
which is not 8) but the replacement is if (_5 != 1U) goto bb7;

optimizing two comparisons to (unsigned int) iftmp.0_5 == 1

Reply via email to