diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-03-04 00:58:40 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-03-04 00:58:40 +0000 |
commit | 40a42a2ccaaa19a109667ed7abf224cc8733cd9c (patch) | |
tree | bd0d560f032bf3734a16548983876f12367d3793 /lib/CodeGen/RegAllocGreedy.cpp | |
parent | 13ba2dab631636e525a44bb259aaea56a860d1c7 (diff) |
Precompute block frequencies, pow() isn't free.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126975 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocGreedy.cpp')
-rw-r--r-- | lib/CodeGen/RegAllocGreedy.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/CodeGen/RegAllocGreedy.cpp b/lib/CodeGen/RegAllocGreedy.cpp index cbecc4b2d3..eada8f9910 100644 --- a/lib/CodeGen/RegAllocGreedy.cpp +++ b/lib/CodeGen/RegAllocGreedy.cpp @@ -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(); |