Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 252d798

Browse files
committed
Use a reference into the BlockLiveness DenseMap to avoid repeated hash lookups in collectMarkers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175484 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 2878b7d commit 252d798

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

lib/CodeGen/StackColoring.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,11 @@ unsigned StackColoring::collectMarkers(unsigned NumSlot) {
240240
BasicBlocks[*FI] = BasicBlockNumbering.size();
241241
BasicBlockNumbering.push_back(*FI);
242242

243-
BlockLiveness[*FI].Begin.resize(NumSlot);
244-
BlockLiveness[*FI].End.resize(NumSlot);
243+
// Keep a reference to avoid repeated lookups.
244+
BlockLifetimeInfo &BlockInfo = BlockLiveness[*FI];
245+
246+
BlockInfo.Begin.resize(NumSlot);
247+
BlockInfo.End.resize(NumSlot);
245248

246249
for (MachineBasicBlock::iterator BI = (*FI)->begin(), BE = (*FI)->end();
247250
BI != BE; ++BI) {
@@ -265,15 +268,15 @@ unsigned StackColoring::collectMarkers(unsigned NumSlot) {
265268
}
266269

267270
if (IsStart) {
268-
BlockLiveness[*FI].Begin.set(Slot);
271+
BlockInfo.Begin.set(Slot);
269272
} else {
270-
if (BlockLiveness[*FI].Begin.test(Slot)) {
273+
if (BlockInfo.Begin.test(Slot)) {
271274
// Allocas that start and end within a single block are handled
272275
// specially when computing the LiveIntervals to avoid pessimizing
273276
// the liveness propagation.
274-
BlockLiveness[*FI].Begin.reset(Slot);
277+
BlockInfo.Begin.reset(Slot);
275278
} else {
276-
BlockLiveness[*FI].End.set(Slot);
279+
BlockInfo.End.set(Slot);
277280
}
278281
}
279282
}

0 commit comments

Comments
 (0)