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

            Bug ID: 104339
           Summary: Missing phiopt due to cast
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: pinskia at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
int f(unsigned short y)
{
    unsigned short t =y;
   int tt = y;
   y = -y;
   int yy = y;
   if (t) tt = y;
   return tt;
}

--- CUT ---
We should be able to optimize this to:
  y_3 = -y_2(D);
  tt_1 = (int) y_3;

But currently don't do a few things.

Reply via email to