[clang] b19bf3e - [clang][SPIRV] Don't warn on -mcmodel (#86039)

via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 21 14:48:39 PDT 2024


Author: Arthur Eubanks
Date: 2024-03-21T14:48:35-07:00
New Revision: b19bf3e888f95c35bf641cd0eee18a8da702f6fe

URL: https://github.com/llvm/llvm-project/commit/b19bf3e888f95c35bf641cd0eee18a8da702f6fe
DIFF: https://github.com/llvm/llvm-project/commit/b19bf3e888f95c35bf641cd0eee18a8da702f6fe.diff

LOG: [clang][SPIRV] Don't warn on -mcmodel (#86039)

The code model doesn't affect the sub-compilation, so don't check it.

Followup to #70740.

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Clang.cpp
    clang/test/Driver/unsupported-option-gpu.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index bc9cc8ce6cf5a5..86a287db72a4eb 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -5863,8 +5863,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
     } else if (Triple.getArch() == llvm::Triple::x86_64) {
       Ok = llvm::is_contained({"small", "kernel", "medium", "large", "tiny"},
                               CM);
-    } else if (Triple.isNVPTX() || Triple.isAMDGPU()) {
-      // NVPTX/AMDGPU does not care about the code model and will accept
+    } else if (Triple.isNVPTX() || Triple.isAMDGPU() || Triple.isSPIRV()) {
+      // NVPTX/AMDGPU/SPIRV does not care about the code model and will accept
       // whatever works for the host.
       Ok = true;
     } else if (Triple.isSPARC64()) {

diff  --git a/clang/test/Driver/unsupported-option-gpu.c b/clang/test/Driver/unsupported-option-gpu.c
index f23cb71ebfb08e..5618b2cba72e16 100644
--- a/clang/test/Driver/unsupported-option-gpu.c
+++ b/clang/test/Driver/unsupported-option-gpu.c
@@ -2,4 +2,5 @@
 // DEFINE: %{check} = %clang -### --target=x86_64-linux-gnu -c -mcmodel=medium
 
 // RUN: %{check} -x cuda %s --cuda-path=%S/Inputs/CUDA/usr/local/cuda --offload-arch=sm_60 --no-cuda-version-check -fbasic-block-sections=all
+// RUN: %{check} -x hip %s --offload=spirv64 -nogpulib -nogpuinc
 // RUN: %{check} -x hip %s --rocm-path=%S/Inputs/rocm -nogpulib -nogpuinc


        


More information about the cfe-commits mailing list