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

            Bug ID: 107880
           Summary: bool tautology missed optimisation
           Product: gcc
           Version: 13.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: ---

>From bug 91882 comment #1 (since the testcase in that was in bug 91882 comment
#0 is now fixed):

bool impl(bool a, bool b)
{
    return (!a || b);
}

// bad optimisation
bool always_true(bool a, bool b)
{
    return (impl(a,b) == impl(b,a)) == (a == b);
           // ( (a -> b) = (b -> a) ) = (a = b) tautology
}

Reply via email to