[PATCH] D99441: [CSSPGO][NFC] Fix a debug dump issue.

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 26 13:18:43 PDT 2021


hoy created this revision.
Herald added subscribers: wenlei, hiraditya.
hoy requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99441

Files:
  llvm/lib/Transforms/IPO/SampleContextTracker.cpp


Index: llvm/lib/Transforms/IPO/SampleContextTracker.cpp
===================================================================
--- llvm/lib/Transforms/IPO/SampleContextTracker.cpp
+++ llvm/lib/Transforms/IPO/SampleContextTracker.cpp
@@ -545,8 +545,11 @@
   } 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()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99441.333619.patch
Type: text/x-patch
Size: 833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210326/0dd70457/attachment.bin>


More information about the llvm-commits mailing list