Re:strength reduction

ssimmons@convex.com (Steve Simmons)
Tue, 17 Sep 1991 14:49:47 GMT

          From comp.compilers

Related articles
Strength Reduction napi@rangkom.MY (1991-09-17)
Re:strength reduction ssimmons@convex.com (1991-09-17)
Re: Strength Reduction preston@dawn.rice.edu (1991-09-17)
Re: strength reduction albaugh@dms.UUCP (1991-09-23)
Re: strength reduction preston@dawn.rice.edu (1991-09-25)
| List of all articles for this month |
Newsgroups: comp.compilers
From: ssimmons@convex.com (Steve Simmons)
Keywords: optimize, question
Organization: CONVEX Computer Corporation, Richardson, Tx., USA
References: 91-09-040
Date: Tue, 17 Sep 1991 14:49:47 GMT

Loop induction variable optimization has its biggest win by
transforming an index into the array to a direct pointer to the
element. Thus, the calculation of each element's address into
the array is removed from the body of the loop. For example,
the following pseudo code is less efficent than the later...


        for i=1,n
          *(&A + (4*i)) = 0
        end


Converted to loop induction variable


      for ptr = loc(A), loc(a)+(4*(n-1)), 4
          *ptr = 0
      end


Notice, the address calculation has been completely optimized away.


Thank you.


Steve Simmons
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.