From 710216275b93b332bc69f41a1d4553197b64edf8 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Wed, 4 Apr 2007 07:04:55 +0000 Subject: [PATCH] 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 --- lib/CodeGen/LiveIntervalAnalysis.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp index a01889a643e..3858a9868cf 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; -- 2.34.1