Consider:

void bar (void);

void
foo (int a)
{
  switch (a)
    {
    case 4:
      if (a >= 3
          && a <= 5)
        bar ();
    }
}

Note that we could remove the "if" statement, VRP does not catch this.

I think Diego already knows about this, but I think it's worth a PR so that
we don't forget.

-- 
           Summary: Teach VRP to pick up a constant from case label.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kazu at cs dot umass dot edu
                CC: dnovillo at redhat dot com,gcc-bugs at gcc dot gnu dot
                    org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21258

Reply via email to