Skip to content

[TSan/Exclusivity] Make test more robust against optimization #8953

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
Apr 23, 2017

Conversation

devincoughlin
Copy link
Contributor

Add a "black hole" uninstrumented function to the test that prevents the
compiler from removing an unused read that needs to be instrumented by
TSan for the test to pass.

This is needed to prevent the optimizer from removing a useless read
when static enforcement of exclusivity is turned on.

Add a "black hole" uninstrumented function to the test that prevents the
compiler from removing an unused read that needs to be instrumented by
TSan for the test to pass.

This is needed to prevent the optimizer from removing a useless read
when static enforcement of exclusivity is turned on.
@devincoughlin
Copy link
Contributor Author

@swift-ci Please smoke test and merge.

@swift-ci swift-ci merged commit 463c6e4 into swiftlang:master Apr 23, 2017
@atrick
Copy link
Contributor

atrick commented Apr 23, 2017

Thanks! Do you understand why enabling access markers caused the read to be removed? Or did disabling the SILGen peephole actually expose another optimizations?

@devincoughlin
Copy link
Contributor Author

It is due to disabling the peephole (it manifests whenever the peephole is removed regardless of whether the access markers are being emitted). From looking at the generated lllvm IR I saw the unused read was completely optimized away — so it wasn’t getting instrumented by the LLVM TSan pass.

@atrick
Copy link
Contributor

atrick commented Apr 23, 2017

I've noticed that disabling that peephole speeds up some code. I think it's actually better to emit canonical IR and optimize the temporary copy later.

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