Skip to content

Commit c275826

Browse files
authored
Merge pull request #18766 from gottesmm/pr-1fc1bcbaa94bb36d85e974fe09c97d87e9d60b04
[passmanager] Add the two last missing delete notifications.
2 parents ec9d114 + 9168d46 commit c275826

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

include/swift/SIL/TypeSubstCloner.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ class TypeSubstCloner : public SILClonerWithScopes<ImplClass> {
361361
// If the function was newly created with an empty body mark it as
362362
// undead.
363363
if (ParentFunction->empty()) {
364-
M.eraseFunction(ParentFunction);
364+
FuncBuilder.eraseFunction(ParentFunction);
365365
ParentFunction->setGenericEnvironment(OriginalEnvironment);
366366
}
367367
}

include/swift/SILOptimizer/Utils/SILOptFunctionBuilder.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ class SILOptFunctionBuilder {
4949
return f;
5050
}
5151

52+
void eraseFunction(SILFunction *f) {
53+
auto &pm = getPassManager();
54+
pm.notifyWillDeleteFunction(f);
55+
pm.getModule()->eraseFunction(f);
56+
}
57+
5258
private:
5359
SILPassManager &getPassManager() const {
5460
return *transform.getPassManager();

lib/SILOptimizer/Mandatory/MandatoryInlining.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -676,10 +676,8 @@ class MandatoryInlining : public SILModuleTransform {
676676
if (F.getRepresentation() == SILFunctionTypeRepresentation::ObjCMethod)
677677
continue;
678678

679-
notifyWillDeleteFunction(&F);
680-
681679
// Okay, just erase the function from the module.
682-
M->eraseFunction(&F);
680+
FuncBuilder.eraseFunction(&F);
683681
}
684682
}
685683

0 commit comments

Comments
 (0)