use of memset and optimization

Bill Sommerfeld sommerfeld at orchard.arlington.ma.us
Fri Nov 8 10:55:01 EST 2002


I think a good case can be made that even a memset of an auto volatile
array can be optimized away if the compiler can prove through
interprocedural or intermodule analysis that the address of the array
never escapes.

You'd have to "pierce the abstraction barrier" to notice otherwise and
therefore the optimization is "safe".

Remember, the compiler owns the stack.  

The compiler folks will get very bent out of shape if you say that
you've set things up so that auto volatile array will land on top of a
virtual mapping in I/O space for a particular device and this it's
always worked in past releases of the compiler....

Oh, for something about the state of the "art" in intermodule
optimization, see:

http://groups.google.com/groups?q=specfp+art&hl=en&lr=&ie=UTF-8&selm=agl5fd%24ost%241%40hplms2.hpl.hp.com&rnum=6

(yes, that's right, a C compiler determined when it was safe to turn
an array-of-structures into a structure-of-arrays to improve memory
bandwidth for an inner loop which only looked at a couple of the
structure fields..)

					- Bill



More information about the krbdev mailing list