https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95729
Bug ID: 95729 Summary: Failure to optimize away certain returns when the condition to reach them is a calculation that already results in that value 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: --- int f(int a, int b) { if (a != b) return a - b; else return 0; } This can be optimized to `return a - b;`. This optimization is done by LLVM, but not by GCC.