[PATCH] D153987: [BOLT][NFC] Add extra debug logging to buildCallGraph
Amir Ayupov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 28 17:53:19 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3fe2c2187230: [BOLT][NFC] Add extra debug logging to buildCallGraph (authored by Amir).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153987/new/
https://reviews.llvm.org/D153987
Files:
bolt/lib/Passes/BinaryFunctionCallGraph.cpp
Index: bolt/lib/Passes/BinaryFunctionCallGraph.cpp
===================================================================
--- bolt/lib/Passes/BinaryFunctionCallGraph.cpp
+++ bolt/lib/Passes/BinaryFunctionCallGraph.cpp
@@ -135,32 +135,39 @@
uint64_t Offset = 0;
auto recordCall = [&](const MCSymbol *DestSymbol, const uint64_t Count) {
- if (BinaryFunction *DstFunc =
- DestSymbol ? BC.getFunctionForSymbol(DestSymbol) : nullptr) {
- if (DstFunc == Function) {
- LLVM_DEBUG(dbgs() << "BOLT-INFO: recursive call detected in "
- << *DstFunc << "\n");
- ++RecursiveCallsites;
- if (IgnoreRecursiveCalls)
- return false;
- }
- if (Filter(*DstFunc))
- return false;
+ BinaryFunction *DstFunc =
+ DestSymbol ? BC.getFunctionForSymbol(DestSymbol) : nullptr;
+ if (!DstFunc) {
+ LLVM_DEBUG(if (opts::Verbosity > 1) dbgs()
+ << "BOLT-DEBUG: buildCallGraph: no function for symbol\n");
+ return false;
+ }
- const CallGraph::NodeId DstId = lookupNode(DstFunc);
- const bool IsValidCount = Count != COUNT_NO_PROFILE;
- const uint64_t AdjCount = UseEdgeCounts && IsValidCount ? Count : 1;
- if (!IsValidCount)
- ++NoProfileCallsites;
- Cg.incArcWeight(SrcId, DstId, AdjCount, Offset);
- LLVM_DEBUG(if (opts::Verbosity > 1) {
- dbgs() << "BOLT-DEBUG: buildCallGraph: call " << *Function << " -> "
- << *DstFunc << " @ " << Offset << "\n";
- });
- return true;
+ if (DstFunc == Function) {
+ LLVM_DEBUG(dbgs() << "BOLT-INFO: recursive call detected in "
+ << *DstFunc << "\n");
+ ++RecursiveCallsites;
+ if (IgnoreRecursiveCalls)
+ return false;
+ }
+ if (Filter(*DstFunc)) {
+ LLVM_DEBUG(if (opts::Verbosity > 1) dbgs()
+ << "BOLT-DEBUG: buildCallGraph: filtered " << *DstFunc
+ << '\n');
+ return false;
}
- return false;
+ const CallGraph::NodeId DstId = lookupNode(DstFunc);
+ const bool IsValidCount = Count != COUNT_NO_PROFILE;
+ const uint64_t AdjCount = UseEdgeCounts && IsValidCount ? Count : 1;
+ if (!IsValidCount)
+ ++NoProfileCallsites;
+ Cg.incArcWeight(SrcId, DstId, AdjCount, Offset);
+ LLVM_DEBUG(if (opts::Verbosity > 1) {
+ dbgs() << "BOLT-DEBUG: buildCallGraph: call " << *Function << " -> "
+ << *DstFunc << " @ " << Offset << "\n";
+ });
+ return true;
};
// Pairs of (symbol, count) for each target at this callsite.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153987.535588.patch
Type: text/x-patch
Size: 2709 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230629/9d9bd2a7/attachment-0001.bin>
More information about the llvm-commits
mailing list