This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
egcs optimizations acriss function calls
- To: egcs at cygnus dot com
- Subject: egcs optimizations acriss function calls
- From: "Matthias Urlichs" <smurf at noris dot de>
- Date: 1 Sep 1998 08:43:26 -0000
- Newsgroups: dist.glibc
- Organization: noris network GmbH, Nuernberg, FRG
- References: <199808312200.SAA18070@steve-dallas.mit.edu> <35EB3E6E.CEA83FBD@cygnus.co.uk> <904611114.16329@noris.de>
> AIUI egcs now does global common subexpression analysis which means
> statements can be reordered over function call boundaries. i.e. in the
> simplest case where myvar is a non-volatile local:
>
> myvar++;
> foo();
> myvar++;
>
> egcs will now (I believe) do something like myvar+=2 after the call to
> foo().
No, not yet (except if foo() is inline). egcs doesn't seem to notice that
nobody ever took the address of myvar, and it ignores "register myvar".
It doesn't even move the call to foo() when I mark it as const().
(I tried this with egcs-2.91.53 19980814. The following program, compiled
with -O9 -fno-inline, still increments myvar twice separately.)
const void foo(void) { }
int bar() { return 2; }
int main(int argc,char *argv[])
{
register int myvar = bar();
myvar++; myvar++;
foo();
myvar++; myvar++;
printf("foo: '%d'\n",fup);
}
--
Matthias Urlichs | noris network GmbH | smurf@noris.de
The quote was selected randomly. Really. | http://www.noris.de/~smurf/
--
I have a marvelous proof of Fermat's last theorem.
Unforunately my brain is too small to contain it.