[Bug tree-optimization/64464] Optimization for reusing values in loops
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Aug 1 07:19:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64464
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Status|UNCONFIRMED |NEW
Last reconfirmed| |2016-08-01
Component|middle-end |tree-optimization
Ever confirmed|0 |1
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
here is the C testcase:
int f(int a, int b)
{
for(int i = 0; i< 10000; i++)
{
int t = a * a - b * b;
int t1 = 2 * a + b;
g (t * t + t1 * t1 );
a = t;
b = t1;
}
}
int f1(int a, int b)
{
int a2 = a * a;
int b2 = b * b;
for(int i = 0; i< 10000; i++)
{
int t = a2 - b2;
int t1 = 2 * a + b;
g (t * t + t1 * t1 );
a2 = t * t;
b2 = t1 * t1;
a = t;
b = t1;
}
}
---- CUT ----
I suspect this is a missing PRE; though I don't know if it makes sense to call
it that.
More information about the Gcc-bugs
mailing list