This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/64464] Optimization for reusing values in loops
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 01 Aug 2016 07:19:03 +0000
- Subject: [Bug tree-optimization/64464] Optimization for reusing values in loops
- Auto-submitted: auto-generated
- References: <bug-64464-4@http.gcc.gnu.org/bugzilla/>
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.