@@ -278,7 +278,7 @@ class DSEContext {
278
278
llvm::BumpPtrAllocator BPA;
279
279
280
280
// / Map every basic block to its location state.
281
- llvm::DenseMap <SILBasicBlock *, BBState * > BBToLocState;
281
+ llvm::SmallDenseMap <SILBasicBlock *, BBState, 4 > BBToLocState;
282
282
283
283
// / Keeps the actual BBStates.
284
284
std::vector<BBState> BBStates;
@@ -295,7 +295,7 @@ class DSEContext {
295
295
MemLocationIndexMap LocToBitIndex;
296
296
297
297
// / Return the BBState for the basic block this basic block belongs to.
298
- BBState *getBBLocState (SILBasicBlock *B) { return BBToLocState[B]; }
298
+ BBState *getBBLocState (SILBasicBlock *B) { return & BBToLocState[B]; }
299
299
300
300
// / Return the BBState for the basic block this instruction belongs to.
301
301
BBState *getBBLocState (SILInstruction *I) {
@@ -854,13 +854,8 @@ void DSEContext::run() {
854
854
// than 64 basic blocks. Therefore, allocate the BBState in a vector and use
855
855
// pointer in BBToLocState to access them.
856
856
for (auto &B : *F) {
857
- BBStates.push_back (BBState (&B));
858
- BBStates.back ().init (MemLocationVault.size ());
859
- }
860
-
861
- // Initialize the BBToLocState mapping.
862
- for (auto &S : BBStates) {
863
- BBToLocState[S.getBB ()] = &S;
857
+ BBToLocState[&B] = BBState (&B);
858
+ BBToLocState[&B].init (MemLocationVault.size ());
864
859
}
865
860
866
861
// Generate the genset and killset for each basic block.
0 commit comments