Skip to content

[5.2][SILProfiler] Do not set up a profiler for a function twice #29482

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
Jan 28, 2020

Conversation

vedantk
Copy link
Contributor

@vedantk vedantk commented Jan 27, 2020

This is a cherry-pick of #29478 which addresses a crash in swift's code coverage logic (https://bugs.swift.org/browse/SR-12045): 'Assertion failed: Function already has a profiler'.

setUpForProfiling should always have ignored functions which were already set up, so the issue has been present for a while. However, it's possible that after this function was introduced, SILGen was restructured in a way that makes it more likely to hit this code path.

rdar://58861159

@vedantk vedantk requested a review from a team as a code owner January 27, 2020 22:58
@vedantk vedantk requested a review from jckarter January 27, 2020 22:59
@vedantk vedantk changed the title [SILProfiler] Do not set up a profiler for a function twice [5.2, Needs Review][SILProfiler] Do not set up a profiler for a function twice Jan 27, 2020
@vedantk
Copy link
Contributor Author

vedantk commented Jan 27, 2020

@swift-ci test

@jckarter
Copy link
Contributor

LGTM.

@vedantk
Copy link
Contributor Author

vedantk commented Jan 28, 2020

@jckarter thanks!

@swift-ci nominate
Explanation: This fixes a compiler crash seen when code coverage is enabled.
Scope: Minimal, limited to -profile-generate, not a source/ABI breaking change.
SR Issue: https://bugs.swift.org/browse/SR-12045
Risk: Minimal, this adds a defensive check.
Testing: Added a regression test.
Reviewer: Joe Groff

@devincoughlin devincoughlin self-requested a review January 28, 2020 20:16
@devincoughlin devincoughlin merged commit b0a329c into swiftlang:swift-5.2-branch Jan 28, 2020
@vedantk vedantk changed the title [5.2, Needs Review][SILProfiler] Do not set up a profiler for a function twice [5.2][SILProfiler] Do not set up a profiler for a function twice Jan 28, 2020
@vedantk vedantk deleted the prof-5.2 branch January 28, 2020 21:05
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.

3 participants