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

            Bug ID: 102570
           Summary: missed fully redudant with internal function of
                    add_overflow in FRE
           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:
bool f1(unsigned x, unsigned y, unsigned *res)
{
    bool t = __builtin_add_overflow(x, y, res);
    unsigned res1;
    bool t1 = __builtin_add_overflow(x, y, &res1);
    *res -= res1;
    return t==t1;
}

This should be optimized at fre1 but currently takes into DOM to optimize it to
just *res = 0; return 1;

FRE does not handle some of the internal functions.

Note this is different from PR 102569 but related.

Reply via email to