[clang] [Clang] Warn on unused inline asm operands (PR #220577)
Ambrose Leeb via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 3 13:58:19 PDT 2026
Sirraide wrote:
Does this sort of warning make sense for inline assembly? There are valid use cases for having an asm operand that is never used, e.g. [Google Benchmark’s `DoNotOptimize`](https://github.com/google/benchmark/blob/04b5f41ec7e3b68b28a2379bc19804a48953117d/include/benchmark/utils.h#L53-L60):
```c++
template <class Tp>
inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp& value) {
#if defined(__clang__)
asm volatile("" : "+r,m"(value) : : "memory");
#else
asm volatile("" : "+m,r"(value) : : "memory");
#endif
}
```
https://github.com/llvm/llvm-project/pull/220577
More information about the cfe-commits
mailing list