diff options
Diffstat (limited to 'llvm/lib/LTO/LTOBackend.cpp')
| -rw-r--r-- | llvm/lib/LTO/LTOBackend.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp index 21aed799d6fa..d5d642f0d25e 100644 --- a/llvm/lib/LTO/LTOBackend.cpp +++ b/llvm/lib/LTO/LTOBackend.cpp @@ -143,7 +143,7 @@ Error Config::addSaveTemps(std::string OutputFileName, bool UseInputModulePath, writeIndexToFile(Index, OS); Path = OutputFileName + "index.dot"; - raw_fd_ostream OSDot(Path, EC, sys::fs::OpenFlags::OF_None); + raw_fd_ostream OSDot(Path, EC, sys::fs::OpenFlags::OF_Text); if (EC) reportOpenError(Path, EC.message()); Index.exportToDot(OSDot, GUIDPreservedSymbols); @@ -191,12 +191,8 @@ static void RegisterPassPlugins(ArrayRef<std::string> PassPlugins, // Load requested pass plugins and let them register pass builder callbacks for (auto &PluginFN : PassPlugins) { auto PassPlugin = PassPlugin::Load(PluginFN); - if (!PassPlugin) { - errs() << "Failed to load passes from '" << PluginFN - << "'. Request ignored.\n"; - continue; - } - + if (!PassPlugin) + report_fatal_error(PassPlugin.takeError(), /*gen_crash_diag=*/false); PassPlugin->registerPassBuilderCallbacks(PB); } } @@ -720,7 +716,14 @@ bool lto::initImportList(const Module &M, if (Summary->modulePath() == M.getModuleIdentifier()) continue; // Add an entry to provoke importing by thinBackend. - ImportList[Summary->modulePath()].insert(GUID); + // Try emplace the entry first. If an entry with the same key already + // exists, set the value to 'std::min(existing-value, new-value)' to make + // sure a definition takes precedence over a declaration. + auto [Iter, Inserted] = ImportList[Summary->modulePath()].try_emplace( + GUID, Summary->importType()); + + if (!Inserted) + Iter->second = std::min(Iter->second, Summary->importType()); } } return true; |
