https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96708
Bug ID: 96708
Summary: Failure to optimize max pattern with comparison when
using a temporary variable
Product: gcc
Version: 11.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 f(int a, int b)
{
int tmp = (a < b) ? b : a;
return tmp >= a;
}
This can be optimized to `return true;`. This transformation is done by LLVM,
but not by GCC.
PS: This is probably related to
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95926.