Skip to content

Conversation

@aeubanks
Copy link
Contributor

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

Followup to #70740.

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

Followup to llvm#70740.
@aeubanks aeubanks requested review from Artem-B and MaskRay March 20, 2024 23:38
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Mar 20, 2024
@llvmbot
Copy link
Member

llvmbot commented Mar 20, 2024

@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-clang

Author: Arthur Eubanks (aeubanks)

Changes

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

Followup to #70740.


Full diff: https://github.com/llvm/llvm-project/pull/86039.diff

2 Files Affected:

  • (modified) clang/lib/Driver/ToolChains/Clang.cpp (+1-1)
  • (modified) clang/test/Driver/unsupported-option-gpu.c (+1)
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 055884d275ce1b..035bfa35299756 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -5804,7 +5804,7 @@ 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()) {
+    } else if (Triple.isNVPTX() || Triple.isAMDGPU() || Triple.isSPIRV()) {
       // NVPTX/AMDGPU does not care about the code model and will accept
       // whatever works for the host.
       Ok = true;
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

@aeubanks aeubanks changed the title [clang][SPIRV] Ignore -mcmodel [clang][SPIRV] Don't warn on -mcmodel Mar 21, 2024
@aeubanks aeubanks requested a review from rnk March 21, 2024 19:49
@aeubanks aeubanks merged commit b19bf3e into llvm:main Mar 21, 2024
@aeubanks aeubanks deleted the spirv-mcmodel branch March 21, 2024 21:48
chencha3 pushed a commit to chencha3/llvm-project that referenced this pull request Mar 23, 2024
The code model doesn't affect the sub-compilation, so don't check it.

Followup to llvm#70740.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants