Skip to content

Don't inline non-ossa function into an ossa function in mandatory inlining #68150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,17 @@ private func shouldInline(apply: FullApplySite, callee: Function, alreadyInlined
if callee.isTransparent {
return true
}

if apply.parentFunction.hasOwnership && !callee.hasOwnership {
// Cannot inline a non-ossa function into an ossa function
return false
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to make this check in OptUtils.swift: FullApplySite.canInline


if apply is BeginApplyInst {
// Avoid co-routines because they might allocate (their context).
return true
}

if apply.parentFunction.isGlobalInitOnceFunction && callee.inlineStrategy == .always {
// Some arithmetic operations, like integer conversions, are not transparent but `inline(__always)`.
// Force inlining them in global initializers so that it's possible to statically initialize the global.
Expand Down