summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
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
commit2bf2aadd9a3bb356d39dc49772b010ad4c7e3b7c (patch)
tree9fe0d831a26d36d4dcb128152ed5f88cd0d79148 /llvm/lib/CodeGen
parent12e2843475e91dd5df713061daa2482ed83aa61b (diff)
downloadbcm5719-llvm-2bf2aadd9a3bb356d39dc49772b010ad4c7e3b7c.tar.gz
bcm5719-llvm-2bf2aadd9a3bb356d39dc49772b010ad4c7e3b7c.zip
Trivially re-materializable instructions have spill weights that are half of what it would be otherwise.
llvm-svn: 35658
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/LiveIntervalAnalysis.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
index a01889a643e..3858a9868cf 100644
--- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud