[llvm] [LangRef] inline asm: the instructions are treated opaquely (PR #157080)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 20 01:32:18 PDT 2025
gonzalobg wrote:
@linuxrocks123 Maybe it helps if we try to provide some context, cause the LangRef won't say why it says what it does.
What the `inline asm` feature does is it "bypasses the compiler" (what precisely that means is muddy, but e.g. "up to the assembler"). Programmers that don't want to bypass the compiler, but want the compiler optimize, should use LLVM IR features, backend builtins, etc. which LLVM and its backends are allowed to heavily optimize. When those features don't suffice, or when they are broken/buggy, inline asm provides a localized escape hatch that allows programmers to workaround those things without having to write their entire function or module in assembly, but only the one expression/statement they want to fix.
Anything that allows the compiler to look at the string (beyond templating mechanisms) is against the soul of this feature.
Multiple LLVM backends being buggy here is just "business as usual". We've fixed some for which the fix didn't have a big impact, and we'll need to figure out a transition path for those in which users are impacted. But my hope is that this results in LLVM, those backends, and their users all ending up better off, because instead of hacking the inline asm string they'll get a first-class feature to solve their problems that will be less brittle and allow backends to do more.
https://github.com/llvm/llvm-project/pull/157080
More information about the llvm-commits
mailing list