[clang] [clang][CodeGen] Emit improved memory effects and return status for AsmStmt (PR #110510)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 1 09:31:26 PDT 2024


efriedma-quic wrote:

> OK, so your position is that this patch should add a section in LanguageExtensions that describes the assumptions that we make regarding the effects of inline assembly, do I understand that correctly?

Yes.

Ideally, we'd also have more complete documentation about constraints etc., but that shouldn't block this patch.

> But I think none of us want to optimize more aggressively than gcc.

Right.

> But do you see a reason not to consider a "=m" output constraint as a pure output? Gcc optimization will clearly assume that such an output operand is only written (and unconditionally overwrites the entire value): https://godbolt.org/z/MvvhjPM44

I wouldn't be surprised if it ends up breaking someone's code... but maybe if gcc is already aggressive here, not very much code.

https://github.com/llvm/llvm-project/pull/110510


More information about the cfe-commits mailing list