This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
lazy execution optimization
- To: gcc at gcc dot gnu dot org
- Subject: lazy execution optimization
- From: Sylvain Pion <Sylvain dot Pion at sophia dot inria dot fr>
- Date: Sun, 26 Sep 1999 18:29:58 +0200
Let's consider the following function:
int f (double a, double b)
{
double c;
c = a+b;
if (a > 0.0) return 0;
if (c > 0.0) return 1;
return 2;
}
I would like GCC to optimize it by computing "c" only after the first test,
just as if the code was:
int f (double a, double b)
{
double c;
if (a > 0.0) return 0;
c = a+b;
if (c > 0.0) return 1;
return 2;
}
It seems 2.95.1 as well as the current CVS do not perform such an
optimization.
Would it be reasonnable and possible ?
--
Sylvain