https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/201360
Summary: This was accidentally missed when I merged the refactor because it showed up after I made the PR and didn't have any merge conflicts I noticed. >From f03583db46fdb9f8b80398f7c0f46619fbf7426c Mon Sep 17 00:00:00 2001 From: Joseph Huber <[email protected]> Date: Wed, 3 Jun 2026 08:49:43 -0500 Subject: [PATCH] [Clang] Fix leftover use of old LTO path Summary: This was accidentally missed when I merged the refactor because it showed up after I made the PR and didn't have any merge conflicts I noticed. --- clang/lib/Driver/ToolChains/Clang.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 4f9fae6b04f57..25bf84a2bde33 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -9713,6 +9713,17 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA, } } } + + if (JA.getType() == types::TY_HIP_FATBIN && Kind == Action::OFK_HIP) { + // Non-RDC HIP uses the conventional non-LTO pipeline unless the user + // opts into offload LTO. + bool UsesProfileGenerate = Args.hasArg( + options::OPT_fprofile_generate, options::OPT_fprofile_generate_EQ, + options::OPT_fprofile_instr_generate, + options::OPT_fprofile_instr_generate_EQ); + if (TC->getLTOMode(Args, Kind) == LTOK_None && !UsesProfileGenerate) + CmdArgs.push_back("--no-lto"); + } } } @@ -9820,23 +9831,13 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA, JA.getType() == types::TY_Image); if (JA.getType() == types::TY_HIP_FATBIN) { CmdArgs.push_back("--emit-fatbin-only"); - // Non-RDC HIP uses the conventional non-LTO pipeline unless the user opts - // into offload LTO. The device backend then runs in the linker wrapper's - // parallel device-link step rather than being deferred to the LTO link. - // Profile generation still needs LTO so the device profile runtime is - // linked and optimized together with the device code. - bool UsesProfileGenerate = Args.hasArg( - options::OPT_fprofile_generate, options::OPT_fprofile_generate_EQ, - options::OPT_fprofile_instr_generate, - options::OPT_fprofile_instr_generate_EQ); - if (C.getDriver().getOffloadLTOMode() == LTOK_None && !UsesProfileGenerate) - CmdArgs.push_back("--no-lto"); CmdArgs.append({"-o", Output.getFilename()}); for (auto Input : Inputs) CmdArgs.push_back(Input.getFilename()); - } else + } else { for (const char *LinkArg : LinkCommand->getArguments()) CmdArgs.push_back(LinkArg); + } addOffloadCompressArgs(Args, CmdArgs); _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
