@@ -783,7 +783,7 @@ Error LTO::addModule(InputFile &Input, unsigned ModI,
783783 LTOInfo->HasSummary );
784784
785785 if (IsThinLTO)
786- return addThinLTO (BM, ModSyms, ResI, ResE);
786+ return addThinLTO (BM, ModSyms, ResI, ResE, Input. getTargetTriple () );
787787
788788 RegularLTO.EmptyCombinedModule = false ;
789789 Expected<RegularLTOState::AddedModule> ModOrErr =
@@ -1030,7 +1030,7 @@ Error LTO::linkRegularLTO(RegularLTOState::AddedModule Mod,
10301030// Add a ThinLTO module to the link.
10311031Error LTO::addThinLTO (BitcodeModule BM, ArrayRef<InputFile::Symbol> Syms,
10321032 const SymbolResolution *&ResI,
1033- const SymbolResolution *ResE) {
1033+ const SymbolResolution *ResE, StringRef Triple ) {
10341034 const SymbolResolution *ResITmp = ResI;
10351035 for (const InputFile::Symbol &Sym : Syms) {
10361036 assert (ResITmp != ResE);
@@ -1090,6 +1090,8 @@ Error LTO::addThinLTO(BitcodeModule BM, ArrayRef<InputFile::Symbol> Syms,
10901090 " Expected at most one ThinLTO module per bitcode file" ,
10911091 inconvertibleErrorCode ());
10921092
1093+ ThinLTO.ModuleTriples .insert ({BM.getModuleIdentifier (), Triple.str ()});
1094+
10931095 if (!Conf.ThinLTOModulesToCompile .empty ()) {
10941096 if (!ThinLTO.ModulesToCompile )
10951097 ThinLTO.ModulesToCompile = ModuleMapType ();
@@ -1496,7 +1498,8 @@ class InProcessThinBackend : public ThinBackendProc {
14961498 const FunctionImporter::ImportMapTy &ImportList,
14971499 const FunctionImporter::ExportSetTy &ExportList,
14981500 const std::map<GlobalValue::GUID, GlobalValue::LinkageTypes> &ResolvedODR,
1499- MapVector<StringRef, BitcodeModule> &ModuleMap) override {
1501+ MapVector<StringRef, BitcodeModule> &ModuleMap,
1502+ DenseMap<StringRef, std::string> & /* ModuleTriples*/ ) override {
15001503 StringRef ModulePath = BM.getModuleIdentifier ();
15011504 assert (ModuleToDefinedGVSummaries.count (ModulePath));
15021505 const GVSummaryMapTy &DefinedGlobals =
@@ -1776,7 +1779,8 @@ class WriteIndexesThinBackend : public ThinBackendProc {
17761779 const FunctionImporter::ImportMapTy &ImportList,
17771780 const FunctionImporter::ExportSetTy &ExportList,
17781781 const std::map<GlobalValue::GUID, GlobalValue::LinkageTypes> &ResolvedODR,
1779- MapVector<StringRef, BitcodeModule> &ModuleMap) override {
1782+ MapVector<StringRef, BitcodeModule> &ModuleMap,
1783+ DenseMap<StringRef, std::string> & /* ModuleTriples*/ ) override {
17801784 StringRef ModulePath = BM.getModuleIdentifier ();
17811785
17821786 // The contents of this file may be used as input to a native link, and must
@@ -2013,7 +2017,7 @@ Error LTO::runThinLTO(AddStreamFn AddStream, FileCache Cache,
20132017 return BackendProcess->start (
20142018 RegularLTO.ParallelCodeGenParallelismLevel + I, Mod.second ,
20152019 ImportLists[Mod.first ], ExportLists[Mod.first ],
2016- ResolvedODR[Mod.first ], ThinLTO.ModuleMap );
2020+ ResolvedODR[Mod.first ], ThinLTO.ModuleMap , ThinLTO. ModuleTriples );
20172021 };
20182022
20192023 if (BackendProcess->getThreadCount () == 1 ||
0 commit comments