Precompute block frequencies, pow() isn't free.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126975 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen
2011-03-04 00:58:40 +00:00
parent 13ba2dab63
commit 40a42a2cca
3 changed files with 15 additions and 17 deletions

View File

@ -602,7 +602,7 @@ float RAGreedy::calcInterferenceInfo(LiveInterval &VirtReg, unsigned PhysReg) {
// The local cost of spill code in this block is the block frequency times
// the number of spill instructions inserted.
if (Inserts)
LocalCost += Inserts * SpillPlacer->getBlockFrequency(BI.MBB);
LocalCost += Inserts * SpillPlacer->getBlockFrequency(BC.Number);
}
DEBUG(dbgs() << "Local cost of " << PrintReg(PhysReg, TRI) << " = "
<< LocalCost << '\n');
@ -625,8 +625,7 @@ float RAGreedy::calcGlobalSplitCost(const BitVector &LiveBundles) {
Inserts += LiveBundles[Bundles->getBundle(BC.Number, 1)] !=
(BC.Exit == SpillPlacement::PrefReg);
if (Inserts)
GlobalCost +=
Inserts * SpillPlacer->getBlockFrequency(SA->LiveBlocks[i].MBB);
GlobalCost += Inserts * SpillPlacer->getBlockFrequency(BC.Number);
}
DEBUG(dbgs() << "Global cost = " << GlobalCost << '\n');
return GlobalCost;
@ -1089,7 +1088,7 @@ unsigned RAGreedy::tryLocalSplit(LiveInterval &VirtReg, AllocationOrder &Order,
unsigned BestAfter = 0;
float BestDiff = 0;
const float blockFreq = SpillPlacer->getBlockFrequency(BI.MBB);
const float blockFreq = SpillPlacer->getBlockFrequency(BI.MBB->getNumber());
SmallVector<float, 8> GapWeight;
Order.rewind();