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

            Bug ID: 110289
           Summary: Phiprop may be good idea in early opts
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hubicka at gcc dot gnu.org
  Target Milestone: ---

libstdc++ in push_back operation does equivalent of the following:

int max(int a, int b)
{
        int *ptr;
        if (a > b)
          ptr = &a;
        else
          ptr = &b;
        return *ptr;
}

this is a sily implementation of max operation that sadly is not optimized
until late phiprop pass and confuses inlining heuristics: memory load is
considered to be expensive.

I think this is win-win pass and not very expensive, so perhaps adding it to
early opts is possible?

Reply via email to