From bf7316650e5fa3c5c8d3063c550590cb1a92b08b Mon Sep 17 00:00:00 2001 From: Artem Belevich Date: Mon, 30 Oct 2023 15:32:42 -0700 Subject: [PATCH] [CUDA, NVPTX] accept/ignore any -mcmodel arguments. Code model has no impact on NVPTX as we do not produce any object files, but we need to avoid erroring out on the -mcmodel argument passed to the top-level compilation and propagated to all sub-compilations. --- clang/lib/Driver/ToolChains/Clang.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 43a92adbef64b..fb90fcd033b1a 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -5743,6 +5743,10 @@ 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. + Ok = true; } if (Ok) { CmdArgs.push_back(Args.MakeArgString("-mcmodel=" + CM));