[clang] [llvm] [LLVM] Unify atomic scope handling between LLVM and Clang (PR #213810)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 5 01:09:12 PDT 2026


================
@@ -380,11 +381,15 @@ static Value *emitFPIntBuiltin(CodeGenFunction &CGF,
   return CGF.Builder.CreateCall(F, {Src0, Src1});
 }
 
-static inline StringRef mapScopeToSPIRV(StringRef AMDGCNScope) {
-  if (AMDGCNScope == "agent")
-    return "device";
-  if (AMDGCNScope == "wavefront")
-    return "subgroup";
+// When the target is SPIR-V (spirv64-amd-amdhsa) re-spell the scope for that
+// target by parsing as AMDGPU and re-emitting it.
+static inline StringRef mapScopeToSPIRV(const llvm::Triple &TargetTriple,
----------------
Pierre-vh wrote:

I think this function didn't handle `cluster` properly before (and I think your patch fixes it), can you add a Clang test to check how `cluster` is lowered ?

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


More information about the llvm-commits mailing list