[lld] [llvm] [DTLTO][ELF][COFF] Add archive support for DTLTO. (PR #157043)
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 9 08:32:53 PST 2025
================
@@ -194,13 +195,16 @@ BitcodeCompiler::BitcodeCompiler(Ctx &ctx) : ctx(ctx) {
ctx.arg.thinLTOEmitImportsFiles);
}
- constexpr llvm::lto::LTO::LTOKind ltoModes[3] =
- {llvm::lto::LTO::LTOKind::LTOK_UnifiedThin,
- llvm::lto::LTO::LTOKind::LTOK_UnifiedRegular,
- llvm::lto::LTO::LTOKind::LTOK_Default};
- ltoObj = std::make_unique<lto::LTO>(createConfig(ctx), backend,
- ctx.arg.ltoPartitions,
- ltoModes[ctx.arg.ltoKind]);
+ constexpr llvm::lto::LTO::LTOKind ltoModes[3] = {
+ llvm::lto::LTO::LTOKind::LTOK_UnifiedThin,
+ llvm::lto::LTO::LTOKind::LTOK_UnifiedRegular,
+ llvm::lto::LTO::LTOKind::LTOK_Default};
+ ltoObj = std::make_unique<lto::DTLTO>(createConfig(ctx), backend,
----------------
teresajohnson wrote:
Why unconditionally create a DTLTO derived class? This could instead be:
```
ltoObj = ctx.arg.dtltoDistributor.empty() ?
std::make_unique<lto::LTO>(....) :
std::make_unique<lto::DTLTO>(....)
```
Then the Dtlto flag can go away and just rely on virtual class overrides to get the appropriate behavior. I.e. like you have already done to addInput and dtlto_process, although I don't think the base class implementations are being called currently because you are always constructing a DTLTO object.
https://github.com/llvm/llvm-project/pull/157043
More information about the llvm-commits
mailing list