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

            Bug ID: 103221
           Summary: evrp removes |SIGN but does not propagate the ssa name
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
signed char f(signed char a)
{
  signed char v;
  v = a;
  if (a < 0)
    v = a | -128;
  return v;
}
---- CUT ----
EVRP is able to remove the | -128 part but still left with:
  if (a_2(D) < 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  v_4 = a_2(D);

  <bb 4> :
  # v_1 = PHI <a_2(D)(2), v_4(3)>
  return v_1;

But the PHI should be removed and the function should have been at this point
just "return a_2(D);".

Note this is not a regression and even the original VRP had a similar issue
too.

Reply via email to