Skip to content

SILOptimizer: avoid stack protection in two cases where it's not needed #63676

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 4 commits into from
Feb 15, 2023

Conversation

eeckstein
Copy link
Contributor

  • ignore pointers with no stores
  • loadUnaligned doesn't need stack protection for it's temporary

rdar://105231457

It's like `Builtin.stackAlloc`, but doesn't set the `[stack_protection]` flag on its containing function.
@eeckstein
Copy link
Contributor Author

@swift-ci test

This function is similar to `withUnsafeTemporaryAllocation`, except that it doesn't trigger stack protection for the stack allocated memory.
Stack protection only protects against overflows, but not against out of bounds reads.

rdar://105231457
@eeckstein eeckstein force-pushed the improve-stack-protection branch from 83164fc to abf9900 Compare February 15, 2023 07:21
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein eeckstein requested review from glessard and removed request for xedin, slavapestov and hborla February 15, 2023 07:22
Copy link
Contributor

@glessard glessard left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks for helping the performance of the loadUnaligned case!

@eeckstein eeckstein merged commit 5f38f8e into swiftlang:main Feb 15, 2023
@eeckstein eeckstein deleted the improve-stack-protection branch February 15, 2023 20:00
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.

2 participants