https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95176
Bug ID: 95176 Summary: Failure to optimize division followed by multiplication to modulo followed by subtraction 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) { return a * (b / a); } This is equivalent to `return b - (b % a);`. This transformation is done by LLVM, but not by GCC.