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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Note after inlining we still have a backedge into BB 3:

  <bb 2> [local count: 1073741824]:
  c = 0;
  b.1_7 = b;
  if (b.1_7 != 0)
    goto <bb 3>; [34.00%]
  else
    goto <bb 7>; [66.00%]

  <bb 3> [local count: 3318838410]:
  _9 = 1;
  _10 = 0;
  _11 = _9 & _10;
  if (_11 != 0)
    goto <bb 6>; [50.00%]
  else
    goto <bb 4>; [50.00%]

  <bb 4> [local count: 1659419208]:
  _12 = 0;
  _13 = _10 & _12;
  if (_13 != 0)
    goto <bb 6>; [50.00%]
  else
    goto <bb 5>; [50.00%]

  <bb 5> [local count: 829709603]:
  iftmp.0_14 = 1;

  <bb 6> [local count: 3318838410]:
  # iftmp.0_15 = PHI <0(3), 0(4), iftmp.0_14(5)>
  _19 = iftmp.0_15;
  _8 = _19;
  c = _8;
  if (_8 != 0)
    goto <bb 7>; [11.00%]
  else
    goto <bb 3>; [89.00%]

  <bb 7> [local count: 1073741824]:

but that's quickly elided by CCP after inlining producing

  <bb 2> [local count: 1073741824]:
  c = 0;
  b.1_7 = b;
  if (b.1_7 != 0)
    goto <bb 3>; [34.00%]
  else
    goto <bb 7>; [66.00%]

  <bb 3> [local count: 3318838410]:
  if (0 != 0)
    goto <bb 6>; [50.00%]
  else
    goto <bb 4>; [50.00%]

  <bb 4> [local count: 1659419208]:
  if (0 != 0)
    goto <bb 6>; [50.00%]
  else
    goto <bb 5>; [50.00%]

  <bb 5> [local count: 829709603]:

  <bb 6> [local count: 3318838410]:
  c = 1;
  if (1 != 0)
    goto <bb 7>; [11.00%]
  else
    goto <bb 3>; [89.00%]

  <bb 7> [local count: 1073741824]:

and the CFG cleanup ends up with the following:

  <bb 2> [local count: 1073741824]:
  c = 0;
  b.1_7 = b;
  if (b.1_7 != 0)
    goto <bb 3>; [34.00%]
  else
    goto <bb 4>; [66.00%]

  <bb 3> [local count: 3318838410]:
  c = 1;

  <bb 4> [local count: 1073741824]:
  d = 1;
  _1 = c;
  if (_1 > 100)
    goto <bb 5>; [33.00%]
  else
    goto <bb 6>; [67.00%]

  <bb 5> [local count: 354334800]:
  foo ();

  <bb 6> [local count: 1073741824]:
  return 0;

Reply via email to