aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-11-07 07:18:40 +0000
committerChris Lattner <sabre@nondot.org>2006-11-07 07:18:40 +0000
commitb75a663707e40a6b72bf404e7fbf08f7d9e1eb90 (patch)
tree6e44a2fca04a7c44b4b11f0cf1981f120e3078cc /lib/CodeGen/LiveIntervalAnalysis.cpp
parent5a4951e93622118eaf345d6c7599eccb6d4cfb65 (diff)
Add a new llcbeta option. This speeds up viterbi from 12.34 to 8.76s on
X86. If happy, I'll enable this by default. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31493 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index 118a2e0a6e..ec2470a04a 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -59,6 +59,9 @@ namespace {
EnableJoining("join-liveintervals",
cl::desc("Coallesce copies (default=true)"),
cl::init(true));
+ static cl::opt<bool>
+ EnableReweight("enable-majik-f00");
+
}
void LiveIntervals::getAnalysisUsage(AnalysisUsage &AU) const {
@@ -208,14 +211,26 @@ bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
}
}
+
for (iterator I = begin(), E = end(); I != E; ++I) {
- LiveInterval &li = I->second;
- if (MRegisterInfo::isVirtualRegister(li.reg)) {
+ LiveInterval &LI = I->second;
+ if (MRegisterInfo::isVirtualRegister(LI.reg)) {
// If the live interval length is essentially zero, i.e. in every live
// range the use follows def immediately, it doesn't make sense to spill
// it and hope it will be easier to allocate for this li.
- if (isZeroLengthInterval(&li))
- li.weight = float(HUGE_VAL);
+ if (isZeroLengthInterval(&LI))
+ LI.weight = float(HUGE_VAL);
+
+ if (EnableReweight) {
+ // 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.
+ unsigned Size = 0;
+ for (LiveInterval::iterator II = LI.begin(), E = LI.end(); II != E;++II)
+ Size += II->end - II->start;
+
+ LI.weight /= Size;
+ }
}
}