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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
To do this optimization (the reduced testcase works right now), you have to
simulate each statement until the end with "width_5 == 0" (the opposite range
of the initial condition) to see if get the other phi operand.

  if (width_5(D) != 0)
    goto <bb 3>; [89.00%]
  else
    goto <bb 4>; [11.00%]

  <bb 3> [local count: 105119325]:
  _1 = (long unsigned int) dir_8(D);
  _3 = width_5(D) + 4294967295;
  _14 = (sizetype) _3;
  _6 = _14 + 1;
  _17 = _1 * _6;
  _18 = _17 * 2;
  errorptr_4 = errorptr_7(D) + _18;

  <bb 4> [local count: 118111601]:
  # errorptr_16 = PHI <errorptr_4(3), errorptr_7(D)(2)>


I don't know if this optimization is that important, even clang does not do it.
It should most likely be only done if the branch is highly predicted taken down
the route of the longer path.

Reply via email to