-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
LLVM assertion: Can only indirectify direct input operands! #29382
Comments
Here is what clang generates for equivalent code, it seems to translate "m" and "=m" into "*m" and "=*m": call void asm "", "=*m"(i32* %2) #1, !srcloc !3 Using the =*m constraint directly from rust is difficult because type checking treats it as an output even though the parameter is an input pointer value. |
The "m" memory constraint in inline assembly is broken (generates incorrect code or triggers LLVM asserts) and should not be used. Instead, indirect memory operands should be used with "\*m", "=\*m" and "+\*m". Clang does this transparently by transforming "m" constraints into "\*m" indirect constraints, but for now just being able to use "\*m" directly is enough since asm! isn't stable. While "\*m" works fine as an input operand, "=\*m" and "+\*m" need to be specified as input operands because they take a pointer value as an input. This PR relaxes the constraint checker to allow constraints starting with "=" or "+" if the constraint string contains a "\*", which indicates an indirect operand. This (indirectly) fixes these issues: #29382, #16383 and #13366. The code will need to be changed to use "\*m" instead of "m".
Still repros. |
playpen repro: https://is.gd/rUbnON |
@Amanieu By |
@eddyb yes |
@Amanieu We should update the compiler to treat |
Still a problem with |
This issue does not apply to the new The legacy |
The following code triggers an LLVM assert:
One thing of note in the LLVM output is this line:
Note that the operand to the asm is left empty for some reason, which is probably wrong.
The text was updated successfully, but these errors were encountered: