summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CalcSpillWeights.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-02-18 21:33:05 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-02-18 21:33:05 +0000
commit352d352c023ed411d9e4357ea01f3ec468ff87dc (patch)
tree39c68041361c761a8290d6c452c02ea0dc9366ea /lib/CodeGen/CalcSpillWeights.cpp
parent49d7f8d341a7b4137c674ce0f08f5b18e8195f4a (diff)
downloadllvm-352d352c023ed411d9e4357ea01f3ec468ff87dc.tar.gz
llvm-352d352c023ed411d9e4357ea01f3ec468ff87dc.tar.bz2
llvm-352d352c023ed411d9e4357ea01f3ec468ff87dc.tar.xz
Always normalize spill weights, also for intervals created by spilling.
Moderate the weight given to very small intervals. The spill weight given to new intervals created when spilling was not normalized in the same way as the original spill weights calculated by CalcSpillWeights. That meant that restored registers would tend to hang around because they had a much higher spill weight that unspilled registers. This improves the runtime of a few tests by up to 10%, and there are no significant regressions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96613 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CalcSpillWeights.cpp')
-rw-r--r--lib/CodeGen/CalcSpillWeights.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/CodeGen/CalcSpillWeights.cpp b/lib/CodeGen/CalcSpillWeights.cpp
index 2bedd04243..a328d0e556 100644
--- a/lib/CodeGen/CalcSpillWeights.cpp
+++ b/lib/CodeGen/CalcSpillWeights.cpp
@@ -131,10 +131,7 @@ bool CalculateSpillWeights::runOnMachineFunction(MachineFunction &fn) {
if (Hint.first || Hint.second)
li.weight *= 1.01F;
- // Divide the weight of the interval by its size. This encourages
- // spilling of intervals that are large and have few uses, and
- // discourages spilling of small intervals with many uses.
- li.weight /= lis->getApproximateInstructionCount(li) * SlotIndex::NUM;
+ lis->normalizeSpillWeight(li);
}
}