-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[JITLink] Add LinkGraph name / triple to debugging output. #161772
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Adds the name and triple of the graph to LinkGraph::dump output before the rest of the graph content. Calls from JITLinkGeneric.cpp to dump the graph are updated to avoid redundantly naming the graph.
@llvm/pr-subscribers-backend-risc-v Author: Lang Hames (lhames) ChangesAdds the name and triple of the graph to LinkGraph::dump output before the rest of the graph content. Calls from JITLinkGeneric.cpp to dump the graph are updated to avoid redundantly naming the graph. Full diff: https://github.com/llvm/llvm-project/pull/161772.diff 5 Files Affected:
diff --git a/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp b/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
index 23b72daedacaa..6e316f105715d 100644
--- a/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
@@ -280,6 +280,9 @@ std::vector<Block *> LinkGraph::splitBlockImpl(std::vector<Block *> Blocks,
void LinkGraph::dump(raw_ostream &OS) {
DenseMap<Block *, std::vector<Symbol *>> BlockSymbols;
+ OS << "LinkGraph \"" << getName()
+ << "\" (triple = " << getTargetTriple().str() << ")\n";
+
// Map from blocks to the symbols pointing at them.
for (auto *Sym : defined_symbols())
BlockSymbols[&Sym->getBlock()].push_back(Sym);
diff --git a/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp b/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp
index 584b9f0067460..17050b0a52480 100644
--- a/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp
@@ -21,23 +21,21 @@ JITLinkerBase::~JITLinkerBase() = default;
void JITLinkerBase::linkPhase1(std::unique_ptr<JITLinkerBase> Self) {
- LLVM_DEBUG({
- dbgs() << "Starting link phase 1 for graph " << G->getName() << "\n";
- });
+ LLVM_DEBUG(dbgs() << "Starting link phase 1\n");
// Prune and optimize the graph.
if (auto Err = runPasses(Passes.PrePrunePasses))
return Ctx->notifyFailed(std::move(Err));
LLVM_DEBUG({
- dbgs() << "Link graph \"" << G->getName() << "\" pre-pruning:\n";
+ dbgs() << "Link graph pre-pruning:\n";
G->dump(dbgs());
});
prune(*G);
LLVM_DEBUG({
- dbgs() << "Link graph \"" << G->getName() << "\" post-pruning:\n";
+ dbgs() << "Link graph post-pruning:\n";
G->dump(dbgs());
});
@@ -67,14 +65,15 @@ void JITLinkerBase::linkPhase1(std::unique_ptr<JITLinkerBase> Self) {
void JITLinkerBase::linkPhase2(std::unique_ptr<JITLinkerBase> Self,
AllocResult AR) {
+ LLVM_DEBUG(dbgs() << "Starting link phase 2\n");
+
if (AR)
Alloc = std::move(*AR);
else
return Ctx->notifyFailed(AR.takeError());
LLVM_DEBUG({
- dbgs() << "Link graph \"" << G->getName()
- << "\" before post-allocation passes:\n";
+ dbgs() << "Link graph before post-allocation passes:\n";
G->dump(dbgs());
});
@@ -131,9 +130,7 @@ void JITLinkerBase::linkPhase2(std::unique_ptr<JITLinkerBase> Self,
void JITLinkerBase::linkPhase3(std::unique_ptr<JITLinkerBase> Self,
Expected<AsyncLookupResult> LR) {
- LLVM_DEBUG({
- dbgs() << "Starting link phase 3 for graph " << G->getName() << "\n";
- });
+ LLVM_DEBUG(dbgs() << "Starting link phase 3\n");
// If the lookup failed, bail out.
if (!LR)
@@ -143,8 +140,7 @@ void JITLinkerBase::linkPhase3(std::unique_ptr<JITLinkerBase> Self,
applyLookupResult(*LR);
LLVM_DEBUG({
- dbgs() << "Link graph \"" << G->getName()
- << "\" before pre-fixup passes:\n";
+ dbgs() << "Link graph before pre-fixup passes:\n";
G->dump(dbgs());
});
@@ -152,7 +148,7 @@ void JITLinkerBase::linkPhase3(std::unique_ptr<JITLinkerBase> Self,
return abandonAllocAndBailOut(std::move(Self), std::move(Err));
LLVM_DEBUG({
- dbgs() << "Link graph \"" << G->getName() << "\" before copy-and-fixup:\n";
+ dbgs() << "Link graph before copy-and-fixup:\n";
G->dump(dbgs());
});
@@ -161,7 +157,7 @@ void JITLinkerBase::linkPhase3(std::unique_ptr<JITLinkerBase> Self,
return abandonAllocAndBailOut(std::move(Self), std::move(Err));
LLVM_DEBUG({
- dbgs() << "Link graph \"" << G->getName() << "\" after copy-and-fixup:\n";
+ dbgs() << "Link graph after copy-and-fixup:\n";
G->dump(dbgs());
});
@@ -186,16 +182,14 @@ void JITLinkerBase::linkPhase3(std::unique_ptr<JITLinkerBase> Self,
void JITLinkerBase::linkPhase4(std::unique_ptr<JITLinkerBase> Self,
FinalizeResult FR) {
- LLVM_DEBUG({
- dbgs() << "Starting link phase 4 for graph " << G->getName() << "\n";
- });
+ LLVM_DEBUG(dbgs() << "Starting link phase 4\n");
if (!FR)
return Ctx->notifyFailed(FR.takeError());
Ctx->notifyFinalized(std::move(*FR));
- LLVM_DEBUG({ dbgs() << "Link of graph " << G->getName() << " complete\n"; });
+ LLVM_DEBUG({ dbgs() << "Link complete\n"; });
}
Error JITLinkerBase::runPasses(LinkGraphPassList &Passes) {
diff --git a/llvm/test/ExecutionEngine/JITLink/AArch32/ELF_data_alignment.s b/llvm/test/ExecutionEngine/JITLink/AArch32/ELF_data_alignment.s
index 9296f048e51ed..ed76a286263f2 100644
--- a/llvm/test/ExecutionEngine/JITLink/AArch32/ELF_data_alignment.s
+++ b/llvm/test/ExecutionEngine/JITLink/AArch32/ELF_data_alignment.s
@@ -22,7 +22,7 @@
# CHECK-OBJ: Contents of section .rodata:
# CHECK-OBJ: 0000 48310048 32004833 00 H1.H2.H3.
-# CHECK-LG: Starting link phase 1 for graph
+# CHECK-LG: Starting link phase 1
# CHECK-LG: section .rodata:
# CHECK-LG: block 0x0 size = 0x00000009, align = 1, alignment-offset = 0
diff --git a/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call.s b/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call.s
index 2b5c9e383c04f..5f6babfcd6008 100644
--- a/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call.s
+++ b/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call.s
@@ -102,7 +102,7 @@ p:
call o
.size p, .-p
-# CHECK: Link graph "{{.*}}" before copy-and-fixup:
+# CHECK: Link graph before copy-and-fixup:
# CHECK: section .text:
# CHECK: block 0x1000
# CHECK: symbols:
diff --git a/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call_rvc.s b/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call_rvc.s
index 3bbfd557a0a6c..c31250b546504 100644
--- a/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call_rvc.s
+++ b/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call_rvc.s
@@ -131,7 +131,7 @@ p:
call o
.size p, .-p
-# CHECK: Link graph "{{.*}}" before copy-and-fixup:
+# CHECK: Link graph before copy-and-fixup:
# CHECK: section .text:
# CHECK: block 0x1000
# CHECK: symbols:
|
MixedMatched
pushed a commit
to MixedMatched/llvm-project
that referenced
this pull request
Oct 3, 2025
Adds the name and triple of the graph to LinkGraph::dump output before the rest of the graph content. Calls from JITLinkGeneric.cpp to dump the graph are updated to avoid redundantly naming the graph.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds the name and triple of the graph to LinkGraph::dump output before the rest of the graph content. Calls from JITLinkGeneric.cpp to dump the graph are updated to avoid redundantly naming the graph.