[clang] [HIP][SPIR-V] Enable SPIR-V backend by default (PR #198338)

Dmitry Sidorov via cfe-commits cfe-commits at lists.llvm.org
Tue May 19 09:08:26 PDT 2026


================
@@ -5096,9 +5096,14 @@ Driver::BuildOffloadingActions(Compilation &C, llvm::opt::DerivedArgList &Args,
           OffloadTriple && OffloadTriple->isSPIRV() &&
           (OffloadTriple->getOS() == llvm::Triple::OSType::AMDHSA ||
            OffloadTriple->getOS() == llvm::Triple::OSType::ChipStar);
-      bool UseSPIRVBackend = Args.hasFlag(options::OPT_use_spirv_backend,
-                                          options::OPT_no_use_spirv_backend,
-                                          /*Default=*/false);
+      // Use SPIR-V backend by default for AMD HIP SPIR-V offload target.
+      bool DefaultUseSPIRVBackend =
+          OffloadTriple && OffloadTriple->isSPIRV() &&
+          OffloadTriple->getVendor() == llvm::Triple::AMD;
----------------
MrSidims wrote:

You mean just drop UseSPIRVBackend (along with -use-spirv-backend option)? I'd prefer not to do this at the moment. While ultimately we will drop supporting llvm-spirv as a tool to generate SPIR-V, but not at the moment, as SPIR-V backend has worse support for debug information translation. So for now better to let `-no-use-spirv-backend` be and promote this option in case if preserving debug info through SPIR-V round-trip is crutial for a user.

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


More information about the cfe-commits mailing list