Skip to content

Commit 06b1629

Browse files
committed
XXX SIL Optimizer: Set the [thunk] attribute on specializations XXX
The original SILFunction may be [fragile] because it came from an imported module, or maybe it was [fragile] because it was declared @_transparent by the user. Furthermore, the devirtualizer can devirtualize calls inside [fragile] functions, pointing them at non-fragile functions. FIXME: For resilience, we cannot devirtualize this stuff anyway. Instead, try to not set [fragile] on clones unless needed.
1 parent 27a9d54 commit 06b1629

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/SILOptimizer/Transforms/AllocBoxToStack.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ PromotedParamCloner::initCloned(SILFunction *Orig,
565565
auto *Fn = M.getOrCreateFunction(
566566
SILLinkage::Shared, ClonedName, ClonedTy, Orig->getContextGenericParams(),
567567
Orig->getLocation(), Orig->isBare(), IsNotTransparent, Orig->isFragile(),
568-
Orig->isThunk(), Orig->getClassVisibility(), Orig->getInlineStrategy(),
568+
IsThunk, Orig->getClassVisibility(), Orig->getInlineStrategy(),
569569
Orig->getEffectsKind(), Orig, Orig->getDebugScope());
570570
for (auto &Attr : Orig->getSemanticsAttrs()) {
571571
Fn->addSemanticsAttr(Attr);

lib/SILOptimizer/Transforms/FunctionSignatureOptCloner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ createEmptyFunctionWithOptimizedSig(const std::string &NewFName) {
353353
// Create the new function.
354354
auto *NewF = M.getOrCreateFunction(
355355
F->getLinkage(), NewFName, NewFTy, nullptr, F->getLocation(), F->isBare(),
356-
F->isTransparent(), F->isFragile(), F->isThunk(), F->getClassVisibility(),
356+
F->isTransparent(), F->isFragile(), IsThunk, F->getClassVisibility(),
357357
F->getInlineStrategy(), F->getEffectsKind(), 0, F->getDebugScope(),
358358
F->getDeclContext());
359359

lib/SILOptimizer/Utils/GenericCloner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ SILFunction *GenericCloner::initCloned(SILFunction *Orig,
3939
getSpecializedLinkage(Orig, Orig->getLinkage()), NewName,
4040
ReInfo.getSpecializedType(), nullptr,
4141
Orig->getLocation(), Orig->isBare(), Orig->isTransparent(),
42-
Orig->isFragile(), Orig->isThunk(), Orig->getClassVisibility(),
42+
Orig->isFragile(), IsThunk, Orig->getClassVisibility(),
4343
Orig->getInlineStrategy(), Orig->getEffectsKind(), Orig,
4444
Orig->getDebugScope(), Orig->getDeclContext());
4545
NewF->setDeclCtx(Orig->getDeclContext());

0 commit comments

Comments
 (0)