[clang] [clang][AMDGPU] Clean-up handling of named barrier type (PR #207687)

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 28 07:17:30 PDT 2026


================
@@ -1079,4 +1079,107 @@ bool DiagnoseUnguardedBuiltins::VisitCallExpr(CallExpr *CE) {
 void SemaAMDGPU::DiagnoseUnguardedBuiltinUsage(FunctionDecl *FD) {
   DiagnoseUnguardedBuiltins(SemaRef).IssueDiagnostics(FD->getBody());
 }
+
+bool SemaAMDGPU::checkAMDGPUTypeSupport(QualType Ty, SourceLocation Loc) {
+  ASTContext &Ctx = getASTContext();
+  llvm::Triple TT = Ctx.getTargetInfo().getTriple();
+  const Type *BaseTy = Ty->getPointeeOrArrayElementType();
+
+  if (Ctx.getTargetInfo().getTriple().isSPIRV()) {
+    // The AMDGPU named barrier type requires special handling in the back-end
+    // and is not supported for SPIR-V
+    if (BaseTy->isAMDGPUNamedBarrierType()) {
----------------
yxsamliu wrote:

Could this also reject named barrier wrappers? The raw type is diagnosed now, but CodeGen treats wrappers the same way via `isAMDGPUNamedBarrierTypeOrWrapper()`. A wrapper global on `spirv64-amd-amdhsa` could still reach the unsupported SPIR-V lowering path.

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


More information about the cfe-commits mailing list