This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: lazy execution optimization
On Sun, Sep 26, 1999 at 06:14:49PM -0400, Steven W. Orr wrote:
> I'm definitely not a qualified person to answer this, but have you tried
> the following construct to see if the outcome is affected:
>
> int f (double a, double b)
> {
> double c;
> c = a+b;
> if (a > 0.0)
> return 0;
> else if (c > 0.0)
> return 1;
> else
> return 2;
> }
It doesn't change anything.
Let me be more clear. More generally, if I have a block:
{
computing some data (A) needed for "test" or for both branches.
computing some data (B) not needed for the test, nor the exit branch.
if (test) { exit the block; }
use B;
}
Then I would like the computation of B to be moved after the test.
This way, if the exit test succeeds, you wouldn't have computed B for nothing.
--
Sylvain