@@ -278,7 +278,7 @@ class DSEContext {
278278 llvm::BumpPtrAllocator BPA;
279279
280280 // / Map every basic block to its location state.
281- llvm::SmallDenseMap <SILBasicBlock *, BBState, 4 > BBToLocState;
281+ llvm::DenseMap <SILBasicBlock *, BBState * > BBToLocState;
282282
283283 // / Keeps the actual BBStates.
284284 std::vector<BBState> BBStates;
@@ -295,7 +295,7 @@ class DSEContext {
295295 MemLocationIndexMap LocToBitIndex;
296296
297297 // / 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]; }
299299
300300 // / Return the BBState for the basic block this instruction belongs to.
301301 BBState *getBBLocState (SILInstruction *I) {
@@ -854,8 +854,13 @@ void DSEContext::run() {
854854 // than 64 basic blocks. Therefore, allocate the BBState in a vector and use
855855 // pointer in BBToLocState to access them.
856856 for (auto &B : *F) {
857- BBToLocState[&B] = BBState (&B);
858- BBToLocState[&B].init (MemLocationVault.size ());
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;
859864 }
860865
861866 // Generate the genset and killset for each basic block.
0 commit comments