[PATCH] D103640: Add an option to hide "cold" blocks from CFG graph
Artur Pilipenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 8 11:29:58 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9197bac297f7: Add an option to hide "cold" blocks from CFG graph (authored by apilipenko).
Changed prior to commit:
https://reviews.llvm.org/D103640?vs=349621&id=350674#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103640/new/
https://reviews.llvm.org/D103640
Files:
llvm/lib/Analysis/CFGPrinter.cpp
Index: llvm/lib/Analysis/CFGPrinter.cpp
===================================================================
--- llvm/lib/Analysis/CFGPrinter.cpp
+++ llvm/lib/Analysis/CFGPrinter.cpp
@@ -42,6 +42,10 @@
static cl::opt<bool> HideDeoptimizePaths("cfg-hide-deoptimize-paths",
cl::init(false));
+static cl::opt<double> HideColdPaths(
+ "cfg-hide-cold-paths", cl::init(0.0),
+ cl::desc("Hide blocks with relative frequency below the given value"));
+
static cl::opt<bool> ShowHeatColors("cfg-heat-colors", cl::init(true),
cl::Hidden,
cl::desc("Show heat colors in CFG"));
@@ -296,6 +300,14 @@
bool DOTGraphTraits<DOTFuncInfo *>::isNodeHidden(const BasicBlock *Node,
const DOTFuncInfo *CFGInfo) {
+ if (HideColdPaths.getNumOccurrences() > 0)
+ if (auto *BFI = CFGInfo->getBFI()) {
+ uint64_t NodeFreq = BFI->getBlockFreq(Node).getFrequency();
+ uint64_t EntryFreq = BFI->getEntryFreq();
+ // Hide blocks with relative frequency below HideColdPaths threshold.
+ if ((double)NodeFreq / EntryFreq < HideColdPaths)
+ return true;
+ }
if (HideUnreachablePaths || HideDeoptimizePaths) {
if (isOnDeoptOrUnreachablePath.find(Node) ==
isOnDeoptOrUnreachablePath.end())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103640.350674.patch
Type: text/x-patch
Size: 1383 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210608/a65aa93b/attachment.bin>
More information about the llvm-commits
mailing list