Author: Nick Sarnie Date: 2025-08-25T15:23:36Z New Revision: 4eec28c86c34b5a6e8545743916b4aee25829707
URL: https://github.com/llvm/llvm-project/commit/4eec28c86c34b5a6e8545743916b4aee25829707 DIFF: https://github.com/llvm/llvm-project/commit/4eec28c86c34b5a6e8545743916b4aee25829707.diff LOG: [clang][SPIRV] Default AS generic for Intel-flavored SPIR-V (#153647) Use the generic AS as the default AS for Intel-flavored SPIR-V. Nobody is using the `spirv64-intel` triple right now as far as I know, I'm planning to use it for OpenMP offload and we will definitely need generic AS as default there. Signed-off-by: Sarnie, Nick <nick.sar...@intel.com> Added: clang/test/CodeGenSPIRV/spirv-intel.c Modified: clang/lib/Basic/Targets/SPIR.h Removed: ################################################################################ diff --git a/clang/lib/Basic/Targets/SPIR.h b/clang/lib/Basic/Targets/SPIR.h index fb15b77065543..8bb0428a736ff 100644 --- a/clang/lib/Basic/Targets/SPIR.h +++ b/clang/lib/Basic/Targets/SPIR.h @@ -219,8 +219,11 @@ class LLVM_LIBRARY_VISIBILITY BaseSPIRTargetInfo : public TargetInfo { setAddressSpaceMap( /*DefaultIsGeneric=*/Opts.SYCLIsDevice || // The address mapping from HIP/CUDA language for device code is only - // defined for SPIR-V. - (getTriple().isSPIRV() && Opts.CUDAIsDevice)); + // defined for SPIR-V, and all Intel SPIR-V code should have the default + // AS as generic. + (getTriple().isSPIRV() && + (Opts.CUDAIsDevice || + getTriple().getVendor() == llvm::Triple::Intel))); } void setSupportedOpenCLOpts() override { diff --git a/clang/test/CodeGenSPIRV/spirv-intel.c b/clang/test/CodeGenSPIRV/spirv-intel.c new file mode 100644 index 0000000000000..3cfe09f0c542b --- /dev/null +++ b/clang/test/CodeGenSPIRV/spirv-intel.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -triple spirv64-intel %s -emit-llvm -o - | FileCheck -check-prefix=CHECK-WITH %s +// RUN: %clang_cc1 -triple spirv32-intel %s -emit-llvm -o - | FileCheck -check-prefix=CHECK-WITH %s +// RUN: %clang_cc1 -triple spir-intel %s -emit-llvm -o - | FileCheck -check-prefix=CHECK-WITHOUT %s +// RUN: %clang_cc1 -triple spir64-intel %s -emit-llvm -o - | FileCheck -check-prefix=CHECK-WITHOUT %s + +// CHECK-WITH: spir_func void @foo(ptr addrspace(4) noundef %param) #0 { +// CHECK-WITHOUT: spir_func void @foo(ptr noundef %param) #0 { +void foo(int *param) { +} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits