Skip to content

[Inliner] Don't count a call penalty for foldable __memcpy_chk and similar #9700

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

Conversation

citymarina
Copy link

When the size is an appropriate constant, __memcpy_chk will turn into a memcpy that gets folded away by InstCombine. Therefore this patch avoids counting these as calls for purposes of inlining costs.

This is only really relevant on platforms whose headers redirect memcpy to __memcpy_chk (such as Darwin). On platforms that use intrinsics, memcpy and similar functions are already exempt from call penalties.

(cherry picked from commit 8fb748b)

@citymarina citymarina requested a review from a team as a code owner December 6, 2024 12:08
@citymarina
Copy link
Author

@swift-ci please test

@citymarina citymarina changed the base branch from stable/20240723 to swift/release/6.1 December 9, 2024 15:38
@citymarina citymarina force-pushed the cherry-pick-inline-memcpy branch from f09bf68 to 925386a Compare December 9, 2024 15:50
@citymarina
Copy link
Author

@swift-ci please test

…milar (llvm#117876)

When the size is an appropriate constant, __memcpy_chk will turn into a
memcpy that gets folded away by InstCombine. Therefore this patch avoids
counting these as calls for purposes of inlining costs.

This is only really relevant on platforms whose headers redirect memcpy
to __memcpy_chk (such as Darwin). On platforms that use intrinsics,
memcpy and similar functions are already exempt from call penalties.

(cherry picked from commit 8fb748b)
@citymarina citymarina force-pushed the cherry-pick-inline-memcpy branch from 925386a to 2572b89 Compare December 12, 2024 15:47
@citymarina citymarina changed the base branch from swift/release/6.1 to stable/20240723 December 12, 2024 15:48
@citymarina
Copy link
Author

@swift-ci please test

@citymarina citymarina removed the request for review from a team December 12, 2024 15:52
@citymarina
Copy link
Author

@swift-ci please test

@citymarina citymarina merged commit 0c6b5e1 into swiftlang:stable/20240723 Dec 13, 2024
2 checks passed
@citymarina citymarina deleted the cherry-pick-inline-memcpy branch May 12, 2025 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant