This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Loop unrolling


> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]