summaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-04-04 07:04:55 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-04-04 07:04:55 +0000
commit710216275b93b332bc69f41a1d4553197b64edf8 (patch)
tree6992ad00ae170a73a47c021ff5275e177e3806ff /lib/CodeGen/LiveIntervalAnalysis.cpp
parent776964ac328a97c1f60d402acb512e14f372736b (diff)
downloadllvm-710216275b93b332bc69f41a1d4553197b64edf8.tar.gz
llvm-710216275b93b332bc69f41a1d4553197b64edf8.tar.bz2
llvm-710216275b93b332bc69f41a1d4553197b64edf8.tar.xz
Trivially re-materializable instructions have spill weights that are half of what it would be otherwise.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35658 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index a01889a643..3858a9868c 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -164,13 +164,13 @@ bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
unsigned reg = rep(mop.getReg());
mii->getOperand(i).setReg(reg);
- // If the definition instruction is re-materializable, its spill
- // weight is zero.
LiveInterval &RegInt = getInterval(reg);
- if (!RegInt.remat) {
- RegInt.weight +=
- (mop.isUse() + mop.isDef()) * pow(10.0F, (int)loopDepth);
- }
+ float w = (mop.isUse()+mop.isDef()) * powf(10.0F, (float)loopDepth);
+ // If the definition instruction is re-materializable, its spill
+ // weight is half of what it would have been normally.
+ if (RegInt.remat)
+ w /= 2;
+ RegInt.weight += w;
}
}
++mii;