[PATCH] D137467: [NFC][BlockPlacement]Add an option to renumber blocks based on function layout order.
Mingming Liu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 7 07:53:01 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG36e8e19337b9: [NFC][BlockPlacement]Add an option to renumber blocks based on function layout… (authored by mingmingl).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137467/new/
https://reviews.llvm.org/D137467
Files:
llvm/lib/CodeGen/MachineBlockPlacement.cpp
Index: llvm/lib/CodeGen/MachineBlockPlacement.cpp
===================================================================
--- llvm/lib/CodeGen/MachineBlockPlacement.cpp
+++ llvm/lib/CodeGen/MachineBlockPlacement.cpp
@@ -201,6 +201,18 @@
cl::init(2),
cl::Hidden);
+// Use case: When block layout is visualized after MBP pass, the basic blocks
+// are labeled in layout order; meanwhile blocks could be numbered in a
+// different order. It's hard to map between the graph and pass output.
+// With this option on, the basic blocks are renumbered in function layout
+// order. For debugging only.
+static cl::opt<bool> RenumberBlocksBeforeView(
+ "renumber-blocks-before-view",
+ cl::desc(
+ "If true, basic blocks are re-numbered before MBP layout is printed "
+ "into a dot graph. Only used when a function is being printed."),
+ cl::init(false), cl::Hidden);
+
extern cl::opt<bool> EnableExtTspBlockPlacement;
extern cl::opt<bool> ApplyExtTspWithoutProfile;
@@ -3466,6 +3478,8 @@
if (ViewBlockLayoutWithBFI != GVDT_None &&
(ViewBlockFreqFuncName.empty() ||
F->getFunction().getName().equals(ViewBlockFreqFuncName))) {
+ if (RenumberBlocksBeforeView)
+ MF.RenumberBlocks();
MBFI->view("MBP." + MF.getName(), false);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137467.473678.patch
Type: text/x-patch
Size: 1289 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221107/439a5fd2/attachment.bin>
More information about the llvm-commits
mailing list