mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[GenericSpecializer] Nest at inline+lower OSSA.
MandatoryGenericSpecializer inlines transparent functions that it specializes. Now that in OSSA `partial_apply [on_stack]`s are represented as owned values rather than stack locations, it is possible for their destroys to violate stack discipline. A direct lowering of the instructions to non-OSSA would violate stack nesting. Previously, when inlining during MandatoryGenericSpecializer, it was assumed that the callee maintained stack discipline. And, when inlining an OSSA function into a non-OSSA function, OSSA instructions were lowered directly. The result was that stack discipline would be violated when directly lowering callees with `partial_apply [on_stack]`s that violate stack discipline. Here, when MandatoryGenericSpecializer inlines a specialized generic function in OSSA form into a function lowered out of OSSA form, stack nesting is fixed up.
This commit is contained in:
@@ -353,6 +353,8 @@ optimizeInst(SILInstruction *inst, SILOptFunctionBuilder &funcBuilder,
|
||||
// If the de-virtualized callee is a transparent function, inline it.
|
||||
SILInliner::inlineFullApply(fas, SILInliner::InlineKind::MandatoryInline,
|
||||
funcBuilder, deleter);
|
||||
if (callee->hasOwnership() && !inst->getFunction()->hasOwnership())
|
||||
invalidatedStackNesting = true;
|
||||
return true;
|
||||
}
|
||||
if (auto *bi = dyn_cast<BuiltinInst>(inst)) {
|
||||
|
||||
Reference in New Issue
Block a user