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

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 30 06:52:03 PDT 2026


================
@@ -849,19 +849,15 @@ void AMDGPUToolChain::addClangTargetOptions(
     CC1Args.push_back("-fapply-global-visibility-to-externs");
   }
 
-  // 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.
-  // TODO: using the below option is a temporary placeholder until Clang
-  //       provides the required functionality, which essentially boils down to
-  //       -O0 being refactored / reworked to not imply optnone / remove TBAA.
-  //       Once that is added, we should pivot to that functionality, being
-  //       mindful to not corrupt the user provided and subsequently embedded
-  //       command-line (i.e. if the user asks for -O3 this is what the
-  //       finalisation should use).
+  // For SPIR-V, enable basic optimizations but disable target-specific
+  // transformations that could harm JIT performance.
   if (getTriple().isSPIRV() &&
----------------
arsenm wrote:

Just remove the whole block. Optimization decisions are for the target pass pipeline, clang shouldn't be randomly picking and choosing debug flags to set 

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


More information about the cfe-commits mailing list