[clang] [HIP][SPIR-V] Enable optimizations for amdgcnspirv target (PR #189383)

Marcos Maronas via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 31 02:25:56 PDT 2026


================
@@ -272,12 +274,18 @@ void HIPAMDToolChain::addClangTargetOptions(
     // with options that match the user-supplied ones.
     if (!DriverArgs.hasArg(options::OPT_fembed_bitcode_marker))
       CC1Args.push_back("-fembed-bitcode=marker");
-    // For SPIR-V we want to retain the pristine output of Clang CodeGen, since
-    // optimizations might lose structure / information that is necessary for
-    // generating optimal concrete AMDGPU code. We duplicate this because the
-    // HIP TC doesn't invoke the base AMDGPU TC addClangTargetOptions.
-    if (!DriverArgs.hasArg(options::OPT_disable_llvm_passes))
-      CC1Args.push_back("-disable-llvm-passes");
+    // Enable basic optimizations but disable target-specific transformations
+    // that could harm JIT performance. The JIT will make target-specific
+    // decisions. Users can pass -disable-llvm-passes to disable all opts.
+    if (!DriverArgs.hasArg(options::OPT_disable_llvm_passes)) {
+      // Disable vectorization (problematic with SPIR-V, let JIT decide)
----------------
maarquitos14 wrote:

```suggestion
      // Disable vectorization (problematic with SPIR-V, let JIT decide).
```

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


More information about the cfe-commits mailing list