-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
asm goto miscompilation #74483
Comments
I think the issue is introduced during regallocfast (hence it only being reproducible at
That |
@nickdesaulniers It looks like this miscompilation affects release build as well.
which is fine-ish since it affected debug build only. But if I enable this work-around in release mode, it will slow down the hottest code. |
…pills We have already ensured in 9cec2b2 that `INLINEASM_BR` output operands get spilled onto the stack, both in the fallthrough path and in the indirect targets. Since reloads of live-ins values into physical registers contextually happens after all MIR instructions (and ops) have been visited, make sure such loads are placed at the start of the block, but after prologues or `INLINEASM_BR` spills, as otherwise this may cause stale values to be read from the stack. Fixes: llvm#74483, llvm#110251.
As far as I understand
asm goto
now supports output arguments on all paths. If I am reading this correctly, in this caseasm goto
corrupts local state (output variable has incorrect value). The code is:With
-O3
the program correctly prints 11:https://godbolt.org/z/x17GnP4nK
But with
-O0
it prints 0:https://godbolt.org/z/h7MM9YTfP
The generated code is:
If we track the
x
variable, it's spilled to-80(%rbp)
, but then loaded from-32(%rbp)
:The text was updated successfully, but these errors were encountered: