[clang] [clang][SPIR-V] Fix OpenCL addrspace mapping when using non-zero default AS (PR #137187)
Nick Sarnie via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 24 07:44:33 PDT 2025
https://github.com/sarnex created https://github.com/llvm/llvm-project/pull/137187
Based on feedback from https://github.com/llvm/llvm-project/pull/136753, remove the dummy values for OpenCL and make them match the zero default AS map.
>From ebfc2c8dcdc819723ac2196d8362ffea5f91ec2f Mon Sep 17 00:00:00 2001
From: "Sarnie, Nick" <nick.sarnie at intel.com>
Date: Thu, 24 Apr 2025 07:42:37 -0700
Subject: [PATCH] [clang][SPIR-V] Fix OpenCL addrspace mapping when using
non-zero default AS
Signed-off-by: Sarnie, Nick <nick.sarnie at intel.com>
---
clang/lib/Basic/Targets/SPIR.h | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/clang/lib/Basic/Targets/SPIR.h b/clang/lib/Basic/Targets/SPIR.h
index 310ef9f2df2c6..bf249e271a870 100644
--- a/clang/lib/Basic/Targets/SPIR.h
+++ b/clang/lib/Basic/Targets/SPIR.h
@@ -58,15 +58,13 @@ static const unsigned SPIRDefIsPrivMap[] = {
// Used by both the SPIR and SPIR-V targets.
static const unsigned SPIRDefIsGenMap[] = {
4, // Default
- // Some OpenCL address space values for this map are dummy and they can't be
- // used
1, // opencl_global
- 0, // opencl_local
- 0, // opencl_constant
+ 3, // opencl_local
+ 2, // opencl_constant
0, // opencl_private
- 0, // opencl_generic
- 0, // opencl_global_device
- 0, // opencl_global_host
+ 4, // opencl_generic
+ 5, // opencl_global_device
+ 6, // opencl_global_host
// cuda_* address space mapping is intended for HIPSPV (HIP to SPIR-V
// translation). This mapping is enabled when the language mode is HIP.
1, // cuda_device
More information about the cfe-commits
mailing list