[clang] [Clang] Warn on unused inline asm operands (PR #220577)
Bill Wendling via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 5 03:43:37 PDT 2026
isanbard 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
> }
> ```
I think this is only something someone wouldn't enable for just anything. Your example specifically wouldn't want this flag.
https://github.com/llvm/llvm-project/pull/220577
More information about the cfe-commits
mailing list