https://github.com/vikramRH created https://github.com/llvm/llvm-project/pull/210250
None >From f6ff8c02a6b966a028e58fc286da6e91ac71eb45 Mon Sep 17 00:00:00 2001 From: vikhegde <[email protected]> Date: Thu, 16 Jul 2026 16:27:28 +0530 Subject: [PATCH] [Clang][LTO][AMDGPU] start using new pass manager for backend codegen --- clang/lib/Driver/ToolChains/Clang.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index bdf72f848aeff..6eb368e1a4555 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -5287,6 +5287,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } } + if (getToolChain().getTriple().isAMDGCN()) { + if (Args.hasFlag(options::OPT_fenable_new_pm_codegen, + options::OPT_fno_enable_new_pm_codegen, true)) { + CmdArgs.push_back(Args.MakeArgString("-fenable-new-pm-codegen")); + } + } + if (IsCuda && !IsCudaDevice) { // We need to figure out which CUDA version we're compiling for, as that // determines how we load and launch GPU kernels. @@ -9917,10 +9924,18 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA, // Forward the LTO mode for this toolchain. auto DeviceLTOMode = TC->getLTOMode(ToolChainArgs, Kind); - if (DeviceLTOMode == LTOK_Full) + if (DeviceLTOMode == LTOK_Full) { CmdArgs.push_back(Args.MakeArgString( "--device-compiler=" + TC->getTripleString() + "=-flto=full")); - else if (DeviceLTOMode == LTOK_Thin) { + + if (TC->getTriple().isAMDGCN() && + Args.hasFlag(options::OPT_fenable_new_pm_codegen, + options::OPT_fno_enable_new_pm_codegen, true)) { + CmdArgs.push_back( + Args.MakeArgString("--device-linker=" + TC->getTripleString() + + "=-plugin-opt=-enable-npm-for-backend")); + } + } else if (DeviceLTOMode == LTOK_Thin) { CmdArgs.push_back(Args.MakeArgString( "--device-compiler=" + TC->getTripleString() + "=-flto=thin")); if (TC->getTriple().isAMDGPU()) { _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
