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));