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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I happened to notice this because I am working on a match patch that transform
`a ? 1 : b` into `a | b`.

In the case of stmt_can_terminate_bb_p, I noticed we had:
  <bb 31> [local count: 330920071]:
  _48 = MEM[(const struct gasm *)t_22(D)].D.129035.D.128905.D.128890.subcode;
  _49 = _48 & 2;
  if (_49 != 0)
    goto <bb 33>; [34.00%]
  else
    goto <bb 32>; [66.00%]

  <bb 32> [local count: 218407246]:
  _50 = (bool) _48;

  <bb 33> [local count: 940291388]:
  # _13 = PHI <0(14), _50(32), _12(29), 0(11), 0(30), 1(2), 1(31), 0(25)>

And the patch to match would do:
  <bb 31> [local count: 330920071]:
  _48 = MEM[(const struct gasm *)t_22(D)].D.129035.D.128905.D.128890.subcode;
  _49 = _48 & 2;
  _50 = (bool) _48;
  _127 = _49 != 0;
  _44 = _50 | _127;

  <bb 32> [local count: 940291388]:
  # _13 = PHI <0(14), 0(25), _12(29), 0(11), 0(30), 1(2), _44(31)>

Which is definitely better than before but I was like isn't that the same as:
  _49 = _48 & 3;
  _44 = _49 != 0;

Reply via email to