Skip to content

Commit 25bc310

Browse files
committed
SIL: change SILModule's scheduledForDeletion from a double linked list to a std::vector
1 parent d03e5da commit 25bc310

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

include/swift/SIL/SILModule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ class SILModule {
217217
/// This avoids dangling instruction pointers within the run of a pass and in
218218
/// analysis caches. Note that the analysis invalidation mechanism ensures
219219
/// that analysis caches are invalidated before flushDeletedInsts().
220-
llvm::iplist<SILInstruction> scheduledForDeletion;
220+
std::vector<SILInstruction*> scheduledForDeletion;
221221

222222
/// The swift Module associated with this SILModule.
223223
ModuleDecl *TheSwiftModule;

lib/SIL/IR/SILModule.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ void SILModule::checkForLeaks() const {
164164
if (!getOptions().checkSILModuleLeaks)
165165
return;
166166

167-
int instsInModule = std::distance(scheduledForDeletion.begin(),
168-
scheduledForDeletion.end());
167+
int instsInModule = scheduledForDeletion.size();
168+
169169
for (const SILFunction &F : *this) {
170170
const SILFunction *sn = &F;
171171
do {
@@ -280,11 +280,11 @@ void SILModule::scheduleForDeletion(SILInstruction *I) {
280280
}
281281

282282
void SILModule::flushDeletedInsts() {
283-
while (!scheduledForDeletion.empty()) {
284-
SILInstruction *inst = &*scheduledForDeletion.begin();
285-
scheduledForDeletion.erase(inst);
286-
AlignedFree(inst);
283+
for (SILInstruction *instToDelete : scheduledForDeletion) {
284+
SILInstruction::destroy(instToDelete);
285+
AlignedFree(instToDelete);
287286
}
287+
scheduledForDeletion.clear();
288288
}
289289

290290
SILWitnessTable *

0 commit comments

Comments
 (0)