low level optimization

Jim Giles jlg at cochiti.lanl.gov
Sat Apr 20 08:52:08 AEST 1991



> You're so hyped up about the fact that separate compilation
> prevents use of this optimization, but you haven't been
> so vocal about the case where you deliberately alias one
> of your arrays, which also blows your optimization.

Since I _never_ deliberately alias array arguments either to each
other or to globals to which the procedure I'm calling has access,
this is not an issue to me.  In _most_ code (not just mine) _most_
of the arrays that you pass around as parameters are not aliased
and _most_ C compilers forgo a perfectly valid optimization in
order to cater to the much rarer case where someone had "deliberately"
aliased something.  Deliberate aliasing happens all the time in
processing recursive data structures (like linked lists, trees, graphs,
etc.) but for array manipulation it is almost always a serious error -
no matter how carefully the compiler works.  It would be nice if C
let me pass arrays to procedures _without_ converting them to pointers
and it would be nice if the compiler were free to assume that array
parameters were not aliased to each other or to any globals.  If they
become aliased to any locals, that could only happen through loaclly
visible action that the compiler can see without interprocedure
analysis.

J. Giles



More information about the Comp.lang.c mailing list