[llvm] [LangRef] inline asm: the instructions are treated opaquely (PR #157080)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 15 04:17:31 PDT 2025
================
@@ -5229,6 +5229,11 @@ flag that indicates whether or not the inline asm expression has side effects,
and a flag indicating whether the function containing the asm needs to align its
stack conservatively.
+LLVM will treat the actual instructions entirely opaquely (i.e. no optimizations
+will be performed based on the contents of the template string). Only the flags,
+operand constraints, and attributes on the call and surrounding function are
+used to deduce what the expression may do during execution.
----------------
gonzalobg wrote:
@RalfJung:
> That rules out the AMDGPU case of having magic comments in that string even more explicitly than before, I think.
Correct, from @arsenm and @jyknight responses in the other threads there seems to be some consensus that those magic comments should be banned.
@programmerjake :
> iirc LLVM will sometimes reformat the asm string, so it's not strictly true that it's used verbatim.
In my experience, it is quite common for programmers to include `\n` and `\t` characters in inline asm template strings with the intent of precisely controlling their formatting. It may make sense to document the reformatting conditions/rules in the LangRef as well.
https://github.com/llvm/llvm-project/pull/157080
More information about the llvm-commits
mailing list