[clang] [AMDGPU] Use the AMDGPUToolChain when targeting C/C++ directly (PR #99687)

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 20 21:04:11 PST 2024


================
@@ -6405,7 +6424,12 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
       TC = std::make_unique<toolchains::NVPTXToolChain>(*this, Target, Args);
       break;
     case llvm::Triple::AMDHSA:
-      TC = std::make_unique<toolchains::ROCMToolChain>(*this, Target, Args);
+      TC =
+          llvm::any_of(Inputs,
+                       [](auto &Input) { return types::isOpenCL(Input.first); })
+              ? std::make_unique<toolchains::ROCMToolChain>(*this, Target, Args)
----------------
yxsamliu wrote:

The same C/C++ source file will be compiled differently, depending on whether they are compiled with OpenCL programs. This may cause confusion to the users. Can we let ROCMToolChain behave the same as AMDGPUToolChain for C/C++ programs?

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


More information about the cfe-commits mailing list