File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -171,9 +171,6 @@ class SILModule {
171
171
// / but kept alive for debug info generation.
172
172
FunctionListType zombieFunctions;
173
173
174
- // / Stores the names of zombie functions.
175
- llvm::BumpPtrAllocator zombieFunctionNames;
176
-
177
174
// / Lookup table for SIL vtables from class decls.
178
175
llvm::DenseMap<const ClassDecl *, SILVTable *> VTableMap;
179
176
Original file line number Diff line number Diff line change @@ -448,18 +448,23 @@ SILFunction *SILModule::removeFromZombieList(StringRef Name) {
448
448
// / Erase a function from the module.
449
449
void SILModule::eraseFunction (SILFunction *F) {
450
450
assert (!F->isZombie () && " zombie function is in list of alive functions" );
451
+
452
+ llvm::StringMapEntry<SILFunction*> *entry =
453
+ &*ZombieFunctionTable.insert (std::make_pair (F->getName (), nullptr )).first ;
454
+ assert (!entry->getValue () && " Zombie function already exists" );
455
+ StringRef zombieName = entry->getKey ();
456
+
451
457
// The owner of the function's Name is the FunctionTable key. As we remove
452
- // the function from the table we have to store the name string elsewhere:
453
- // in zombieFunctionNames.
454
- StringRef copiedName = F->getName ().copy (zombieFunctionNames);
458
+ // the function from the table we need to use the allocated name string from
459
+ // the ZombieFunctionTable.
455
460
FunctionTable.erase (F->getName ());
456
- F->Name = copiedName ;
461
+ F->Name = zombieName ;
457
462
458
463
// The function is dead, but we need it later (at IRGen) for debug info
459
464
// or vtable stub generation. So we move it into the zombie list.
460
465
getFunctionList ().remove (F);
461
466
zombieFunctions.push_back (F);
462
- ZombieFunctionTable[copiedName] = F ;
467
+ entry-> setValue (F) ;
463
468
F->setZombie ();
464
469
465
470
// This opens dead-function-removal opportunities for called functions.
You can’t perform that action at this time.
0 commit comments