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

            Bug ID: 94884
           Summary: Failure to recognize that result of or is always
                    superior to operands
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

bool decide() __attribute((const));

inline unsigned getXOrY(unsigned x, unsigned y)
{
    return decide() ? y : x;
}

bool f(unsigned x, unsigned y)
{
    return (x | y) >= getXOrY(x, y);
}

`f` can be optimized to `return true`. This transformation is done by LLVM, not
by GCC.

Reply via email to