https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95423
Bug ID: 95423
Summary: Failure to optimize separated multiplications by x and
square of x
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, int x)
{
return a * (x * x) + (b * x);
}
This can be optimized to `return (((a * x) + b) * x);`. LLVM does this
transformation, but GCC does not.