Skip to content

Remove unecessary empty asm statement #7868

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
Mar 13, 2017
Merged

Remove unecessary empty asm statement #7868

merged 1 commit into from
Mar 13, 2017

Conversation

hughbe
Copy link
Contributor

@hughbe hughbe commented Mar 2, 2017

@jckarter 5 days ago Member
@rjmccall or @gparker42, do either of you recall why this is here? If it were intended as an optimization barrier, wouldn't it have to be volatile? As is, this would be a no-op even on Clang, AIUI.

@gparker42 3 days ago
The intent is to preserve that frame in stack traces. I know the asm("") is necessary when the function is empty. This function is not empty so noinline alone may be sufficient.

@gparker42 days ago Member
(> If the function is empty and you use noinline without asm("") then the optimizer may simply delete the call at the call site. Technically that doesn't count as inlining. asm("") inhibits that optimization.)

Extracted from #7765 as don't have time right now to test my fixes, and Cambodian internet is too slow to update LLVM from git..

@hughbe
Copy link
Contributor Author

hughbe commented Mar 3, 2017

@swift-ci please smoke test

@hughbe hughbe requested a review from gparker42 March 8, 2017 10:36
@hughbe
Copy link
Contributor Author

hughbe commented Mar 10, 2017

Friendly ping :)

@jckarter
Copy link
Contributor

LGTM. Did you verify empirically that the cast failure is visible in a backtrace from a release build of the runtime?

@hughbe
Copy link
Contributor Author

hughbe commented Mar 13, 2017

Sorry @joegroff I don't understand what you mean - do you mean the generate assembly?

https://godbolt.org/g/czYXiV shows that assembly is the same for a noinline method with and without asm("") that has at least one method call in it

@jckarter
Copy link
Contributor

That's what I meant. Thanks for checking.

@hughbe hughbe merged commit b3020d8 into swiftlang:master Mar 13, 2017
@hughbe hughbe deleted the asm-uneeded branch March 13, 2017 17:13
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