Skip to content

Commit 04af1b3

Browse files
authored
Merge pull request #7463 from swiftix/fso-fixes
Fix a bug in FunctionSignatureOptimization.
2 parents 89caa91 + c0ba7f5 commit 04af1b3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/SILOptimizer/Transforms/FunctionSignatureOpts.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ static SILInstruction *findOnlyApply(SILFunction *F) {
9393
///
9494
/// TODO: we should teach the demangler to understand this suffix.
9595
static std::string getUniqueName(std::string Name, SILModule &M) {
96-
if (!M.lookUpFunction(Name))
96+
if (!M.lookUpFunction(Name) &&
97+
!M.findFunction(Name, SILLinkage::PublicExternal))
9798
return Name;
9899
return getUniqueName(Name + "_unique_suffix", M);
99100
}
@@ -372,7 +373,8 @@ std::string FunctionSignatureTransform::createOptimizedSILFunctionName() {
372373
do {
373374
New = NewFM.mangle(UniqueID);
374375
++UniqueID;
375-
} while (M.lookUpFunction(New));
376+
} while (M.lookUpFunction(New) ||
377+
M.findFunction(New, SILLinkage::PublicExternal));
376378

377379
return NewMangling::selectMangling(Old, New);
378380
}

0 commit comments

Comments
 (0)