Article View: comp.lang.misc
Article #847Aliasing vs. optimization
From: Preston Briggs
Date: Wed, 24 Jan 1990 19:57
Date: Wed, 24 Jan 1990 19:57
39 lines
1886 bytes
1886 bytes
In article <7300002@ux1.cso.uiuc.edu> hirchert@ux1.cso.uiuc.edu writes:
>brnstnd@stealth.acf.nyu.edu writes:
>>The only problem with aliasing is parallel optimization.
>Not true. There are many sequential, scalar optimizations that are inhibited
>by aliasing, including common subexpression elimination, removal of loop
>invariants, strength reduction, and some forms of peephole instruction
>scheduling. In fact, there are few forms of optimization that aren't
>inhibited by aliasing.
Good man! An easy example is (everybody's favorite) DAXPY, the main time
consumer in Linpack.
subroutine daxpy(n, da, dx, incx, dy, incy)
...
do 10 i = 1, n
dy(iy) = dy(iy) + da * dx(ix)
ix = ix + incx
iy = iy + incy
10 continue
return
...
end
If aliasing is prohibited, we can hold da, incx, and incy in registers.
Otherwise, they must be reloaded on each iteration, since the assignment
to dy(iy) could potentially change them all.
In one (experimental) compiler, the no-aliasing restriction saved us
fifteen percent. On a machine with faster floating-point, the savings
would be greater.
Without the restriction, you need to do interprocedural alias analysis.
For languages without pointers, this can be done efficiently.
For C, with fairly unrestricted pointer usage, the problem is much harder.
Preston Briggs
preston@titan.rice.edu
Technical Details
Message-ID:
<4378@brazos.Rice.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!rice!titan!prestonReferences:
<9738@stealth.acf.nyu.edu> <7300002@ux1.cso.uiuc.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!rice!titan!preston From: preston@titan.rice.edu (Preston Briggs) Newsgroups: comp.lang.misc Subject: Aliasing vs. optimization Message-ID: <4378@brazos.Rice.edu> Date: 24 Jan 90 19:57:58 GMT References: <9738@stealth.acf.nyu.edu> <7300002@ux1.cso.uiuc.edu> Sender: root@rice.edu Reply-To: preston@titan.rice.edu (Preston Briggs) Organization: Rice University, Houston Lines: 39