Skip to content

Commit 9348f5e

Browse files
committed
MandatoryPerformanceOptimizations: force inlining of transparent co-routines
This might be necessary if `-enable-testing` is turned on, because in this mode function linkages are different than in a regular build.
1 parent 78234e2 commit 9348f5e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

SwiftCompilerSources/Sources/Optimizer/ModulePasses/MandatoryPerformanceOptimizations.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,11 +258,13 @@ private func shouldInline(apply: FullApplySite, callee: Function, alreadyInlined
258258
return false
259259
}
260260

261-
if !callee.canBeInlinedIntoCaller(withSerializedKind: apply.parentFunction.serializedKind) &&
262-
// Even if the serialization kind doesn't match, we need to make sure to inline witness method thunks
263-
// in embedded swift.
264-
callee.thunkKind != .thunk
265-
{
261+
guard callee.canBeInlinedIntoCaller(withSerializedKind: apply.parentFunction.serializedKind) ||
262+
// Even if the serialization kind doesn't match, we need to make sure to inline witness method thunks
263+
// in embedded swift.
264+
callee.thunkKind == .thunk ||
265+
// Force inlining transparent co-routines. This might be necessary if `-enable-testing` is turned on.
266+
(apply is BeginApplyInst && callee.isTransparent)
267+
else {
266268
return false
267269
}
268270

0 commit comments

Comments
 (0)