[llvm] [SPIRV] Do not emit @llvm.compiler.used (PR #162678)

Steven Perron via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 10 10:24:35 PDT 2025


Juan Manuel Martinez =?utf-8?q?Caamaño?= <juamarti at amd.com>,
Juan Manuel Martinez =?utf-8?q?Caamaño?= <juamarti at amd.com>,
Juan Manuel Martinez =?utf-8?q?Caamaño?= <juamarti at amd.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/162678 at github.com>


================
@@ -0,0 +1,18 @@
+; RUN: llc -verify-machineinstrs -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
+; RUN: %if spirv-tools %{ llc -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
+
+; Verify that llvm.used is not lowered
----------------
s-perron wrote:

If you want to make sure that no tools (spirv-link and spirv-opt) remove the global variables, then the only way to do that is to give the variable the export linkage decoration. However, the `append` semantics will be lost, so I'm not sure if the spir-v linker will deal with it correctly.

I think it is fair to say that `llvm.used` cannot be supported, and it is not accepted by the SPIR-V backend.

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


More information about the llvm-commits mailing list