[llvm] [SPIRV] Do not emit @llvm.used (PR #179498)
Steven Perron via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 4 07:53:54 PST 2026
s-perron wrote:
I'll try to articulate the issue I had the last time this was suggested.
The definition for llvm used: https://llvm.org/docs/LangRef.html#the-llvm-used-global-variable. The important part is:
> If a symbol appears in the @llvm.used list, then the compiler, assembler, and linker are required to treat the symbol as if there is a reference to the symbol that it cannot see (which is why they have to be named).
I don't understand what "compiler", "assembler", and "linker" refer to in the SPIR-V case. Since that is the case, I cannot tell of dropping it in the SPIR-V backend is the correct behaviour or if we have to add something to the SPIR-V, to make sure that other tools that act on the spir-v do not remove the reference.
For example, is spirv-link allowed to drop the definitions of functions that it finds are not referenced after linking? [I believe that is what happens.](https://github.com/KhronosGroup/SPIRV-Tools/blob/a66a95eecf5102f2b19d6208385538c7c29aa7a1/test/link/partial_linkage_test.cpp#L56-L66)
https://github.com/llvm/llvm-project/pull/179498
More information about the llvm-commits
mailing list