[clang] [AMDGPU] Accept/Ignore any -mcmodel arguments. (PR #70760)

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 6 05:58:48 PST 2023


================
@@ -5743,9 +5743,9 @@ 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()) {
-      // NVPTX does not care about the code model and will accept whatever works
-      // for the host.
+    } else if (Triple.isNVPTX() || Triple.isAMDGPU()) {
+      // NVPTX/AMDGPU does not care about the code model and will accept
+      // whatever works for the host.
       Ok = true;
     }
     if (Ok) {
----------------
yxsamliu wrote:

neither nvptx or amdgpu backend accepts -mcmodel=tiny and kernel. the backends will fail with error:

fatal error: error in backend: Target does not support the tiny CodeModel

for tiny and kernel, we should not pass them to clang -cc1 and emit a warning that they are ignored.

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


More information about the cfe-commits mailing list