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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
VRP performs jump-threading to else-if style but phiopt doesn't handle the
min-max case with split PHIs

  if (wt_25 < -32768)
    goto <bb 5>;
  else
    goto <bb 4>;

  <bb 4>:
  if (wt_25 > 32767)
    goto <bb 6>;
  else
    goto <bb 5>;

  <bb 5>:
  # wt_31 = PHI <wt_25(4), -32768(3)>

  <bb 6>:
  # wt_3 = PHI <wt_31(5), 32767(4)>
  _26 = (short int) wt_3;

vs.

  if (wt_24 < -32768)
    goto <bb 6>;
  else
    goto <bb 4>;

  <bb 4>:
  if (wt_24 > 32767)
    goto <bb 6>;
  else
    goto <bb 5>;

  <bb 5>:

  <bb 6>:
  # wt_2 = PHI <-32768(3), wt_24(5), 32767(4)>
  _25 = (short int) wt_2;

so it looks like phiopt "depends" on mergephi (I always wondered what pass
that is useful for...).  Currently that pass runs right before VRP which
definitely does _not_ depend on it.  I'd move it right before ifcombine
which is the first pass that might care.

Reply via email to