[llvm] [ThinLTO][NFC] Add Debug Prints of Module Names when Generating Module Maps (PR #67820)

Qiongsi Wu via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 29 08:50:32 PDT 2023


https://github.com/qiongsiwu created https://github.com/llvm/llvm-project/pull/67820

When computing the module maps, `ThinLTOCodeGenerator` asserts if it sees a duplicating module name. This PR adds debug print, so that the list of modules already added can be printed. With this information, one can identify which module is causing the duplication. 

>From 26bf5aad8af57a492b363049c1c1236ad06c68fe Mon Sep 17 00:00:00 2001
From: Qiongsi Wu <qwu at ibm.com>
Date: Fri, 29 Sep 2023 12:29:11 -0400
Subject: [PATCH] Adding debug print of module names when adding modules

---
 llvm/lib/LTO/ThinLTOCodeGenerator.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
index acff1e2cf3b33b0..443439b71e7566c 100644
--- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -151,6 +151,7 @@ static StringMap<lto::InputFile *>
 generateModuleMap(std::vector<std::unique_ptr<lto::InputFile>> &Modules) {
   StringMap<lto::InputFile *> ModuleMap;
   for (auto &M : Modules) {
+    LLVM_DEBUG(dbgs() << "Adding module " << M->getName() << " to ModuleMap\n");
     assert(!ModuleMap.contains(M->getName()) &&
            "Expect unique Buffer Identifier");
     ModuleMap[M->getName()] = M.get();



More information about the llvm-commits mailing list