[llvm] [LangRef] inline asm: the instructions are treated opaquely (PR #157080)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 12 05:31:47 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:
This is a bit stronger in that it is not only about instructions but the entire template string, to require preserving and not looking at comments, pragmas to the assembler, labels, whitespace indentation...
LLVM needs to look at the template string to interpolate certain things to produce the final string, and it should only be allowed to look and modify those interpolation points, and nothing else (at least as a starting point).
```suggestion
Except for the template substitution features described below, LLVM preserves
the inline asm template string verbatim and treats its contents as an opaque blob.
LLVM does not inspect this opaque blob and therefore does not perform any
optimizations based on the contents of the inline asm template string itself.
The only mechanisms available to LLVM to deduce what inline asm expressions
may do during execution are their flags, operand constraints, and attributes on
the call and surrounding function.
```
https://github.com/llvm/llvm-project/pull/157080
More information about the llvm-commits
mailing list