Skip to content

[ThinLTO][NFC] Add Module Name Debug Print when Generating Module Maps #67820

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 3, 2023

Conversation

qiongsiwu
Copy link
Contributor

@qiongsiwu qiongsiwu commented Sep 29, 2023

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

@qiongsiwu qiongsiwu self-assigned this Sep 29, 2023
@qiongsiwu qiongsiwu requested a review from w2yehia September 29, 2023 15:50
@llvmbot llvmbot added the LTO Link time optimization (regular/full LTO or ThinLTO) label Sep 29, 2023
@llvmbot
Copy link
Member

llvmbot commented Sep 29, 2023

@llvm/pr-subscribers-lto

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/67820.diff

1 Files Affected:

  • (modified) llvm/lib/LTO/ThinLTOCodeGenerator.cpp (+1)
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();

@qiongsiwu qiongsiwu changed the title [ThinLTO][NFC] Add Debug Prints of Module Names when Generating Module Maps [ThinLTO][NFC] Add Debug Print of Module Names when Generating Module Maps Sep 29, 2023
@qiongsiwu qiongsiwu changed the title [ThinLTO][NFC] Add Debug Print of Module Names when Generating Module Maps [ThinLTO][NFC] Add Module Name Debug Print when Generating Module Maps Sep 29, 2023
Copy link
Contributor

@w2yehia w2yehia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@qiongsiwu qiongsiwu merged commit 9084934 into llvm:main Oct 3, 2023
Guzhu-AMD pushed a commit to GPUOpen-Drivers/llvm-project that referenced this pull request Oct 12, 2023
Local branch amd-gfx 7303492 Merged main:dd654274081f into amd-gfx:79475f0094d4
Remote branch main 9084934 [ThinLTO][NFC] Add Module Name Debug Print when Generating Module Maps (llvm#67820)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTO Link time optimization (regular/full LTO or ThinLTO)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants