[llvm] [LangRef] inline asm: the instructions are treated opaquely (PR #157080)
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 22 11:19:21 PDT 2025
efriedma-quic wrote:
> It may also break parsing the assembly and then doing optimizations based on that even if those optimizations would not compromise the correctness of the code if the assembly were changed.
You're suggesting that the compiler could do certain optimizations based on the inline asm which don't impact correctness? Like, trying to guess the latency of instructions inside the inline asm?
If it doesn't affect semantics, it's hard to say it's wrong. But I'm not sure it's actually a good idea: the user would have limited control if the compiler guesses wrong.
> I'm not too familiar with clang, so I'll ask: do we have backend-specific hooks that would allow parsing an inline assembly string for a particular architecture? Like, is there enough backend-specific code in clang to where there would be a place to put that, if someone wanted to do that?
Yeah, this wouldn't be too hard; we already do a bunch of target-specific stuff for inline asm to handle constraints/clobbers/etc.
https://github.com/llvm/llvm-project/pull/157080
More information about the llvm-commits
mailing list