[llvm] 12ac040 - [CSSPGO][NFC] Fix a debug dump issue.
Hongtao Yu via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 26 16:07:15 PDT 2021
Author: Hongtao Yu
Date: 2021-03-26T16:06:56-07:00
New Revision: 12ac0403b1d9a1eef1a06f8ef710580874d43b7d
URL: https://github.com/llvm/llvm-project/commit/12ac0403b1d9a1eef1a06f8ef710580874d43b7d
DIFF: https://github.com/llvm/llvm-project/commit/12ac0403b1d9a1eef1a06f8ef710580874d43b7d.diff
LOG: [CSSPGO][NFC] Fix a debug dump issue.
During context promotion, intermediate nodes that are on a call path but do not come with a profile can be promoted together with their parent nodes. Do not print sample context string for such nodes since they do not have profile.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D99441
Added:
Modified:
llvm/lib/Transforms/IPO/SampleContextTracker.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/SampleContextTracker.cpp b/llvm/lib/Transforms/IPO/SampleContextTracker.cpp
index 9b7af455e69d..5ad0ba20b3e0 100644
--- a/llvm/lib/Transforms/IPO/SampleContextTracker.cpp
+++ b/llvm/lib/Transforms/IPO/SampleContextTracker.cpp
@@ -542,8 +542,11 @@ ContextTrieNode &SampleContextTracker::promoteMergeContextSamplesTree(
} else {
// Destination node exists, merge samples for the context tree
mergeContextNode(FromNode, *ToNode, ContextStrToRemove);
- LLVM_DEBUG(dbgs() << " Context promoted and merged to: "
- << ToNode->getFunctionSamples()->getContext() << "\n");
+ LLVM_DEBUG({
+ if (ToNode->getFunctionSamples())
+ dbgs() << " Context promoted and merged to: "
+ << ToNode->getFunctionSamples()->getContext() << "\n";
+ });
// Recursively promote and merge children
for (auto &It : FromNode.getAllChildContext()) {
More information about the llvm-commits
mailing list