This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Loop unrolling
- To: jbuck at synopsys dot com (Joe Buck)
- Subject: Re: Loop unrolling
- From: Joern Rennecke <amylaar at cygnus dot co dot uk>
- Date: Fri, 5 Jun 1998 19:51:37 +0100 (BST)
- Cc: gavin at cygnus dot com, egcs at cygnus dot com
> Yes, if someone writes an automatic volatile variable, they've presumably done
> so for a reason, so we should give them what they expect (don't optimize
> redundant reads and writes).
Well, maybe they passed the address of that variable to a function that
might do something funny with it - but in this loop, the function call
was unreachable and optimized away. Since we have ADDRESSOF now, the
address-taking doesn't force variables into the stack if the address
use is optimized away.
I'm not saying that we should do this kind of optimization right now, but
just pointing out that there are valid reasons to want it, and a programmer
should not rely on volatile for timing effects.