diff options
author | Chris Lattner <sabre@nondot.org> | 2004-04-15 15:21:43 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-04-15 15:21:43 +0000 |
commit | 59fdaeeae8f183e18bb6ad5c382ca23e28e6aaf6 (patch) | |
tree | 6e96696fbfe286878d151f4a49b0e63c69d092d6 /tools/gccld/Linker.cpp | |
parent | 92020faa2ca025996c2232c682c0e484f98cc56c (diff) |
Change the canonical induction variable that we insert.
Instead of producing code like this:
Loop:
X = phi 0, X2
...
X2 = X + 1
if (X != N-1) goto Loop
We now generate code that looks like this:
Loop:
X = phi 0, X2
...
X2 = X + 1
if (X2 != N) goto Loop
This has two big advantages:
1. The trip count of the loop is now explicit in the code, allowing
the direct implementation of Loop::getTripCount()
2. This reduces register pressure in the loop, and allows X and X2 to be
put into the same register.
As a consequence of the second point, the code we generate for loops went
from:
.LBB2: # no_exit.1
...
mov %EDI, %ESI
inc %EDI
cmp %ESI, 2
mov %ESI, %EDI
jne .LBB2 # PC rel: no_exit.1
To:
.LBB2: # no_exit.1
...
inc %ESI
cmp %ESI, 3
jne .LBB2 # PC rel: no_exit.1
... which has two fewer moves, and uses one less register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12961 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/gccld/Linker.cpp')
0 files changed, 0 insertions, 0 deletions