[PATCH] D126722: [BOLT][NFC] Warning for deprecated option '-reorder-blocks=cache+'
Huan Nguyen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 1 13:50:49 PDT 2022
nhuhuan updated this revision to Diff 433536.
nhuhuan added a comment.
Added test file, fix option switch.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126722/new/
https://reviews.llvm.org/D126722
Files:
bolt/include/bolt/Passes/BinaryPasses.h
bolt/lib/Passes/BinaryPasses.cpp
bolt/test/cache+-deprecated.test
Index: bolt/test/cache+-deprecated.test
===================================================================
--- /dev/null
+++ bolt/test/cache+-deprecated.test
@@ -0,0 +1,8 @@
+# Check for the replacement of calls to identical functions.
+
+REQUIRES: system-linux
+
+RUN: %clangxx %p/Inputs/bolt_icf.cpp -g -Wl,-q -o %t.exe
+RUN: llvm-bolt %t.exe -reorder-blocks=cache+ -relocs -o %t 2>&1 | FileCheck %s
+
+CHECK: '-reorder-blocks=cache+' is deprecated, please use '-reorder-blocks=ext-tsp' instead.
Index: bolt/lib/Passes/BinaryPasses.cpp
===================================================================
--- bolt/lib/Passes/BinaryPasses.cpp
+++ bolt/lib/Passes/BinaryPasses.cpp
@@ -176,13 +176,21 @@
clEnumValN(bolt::ReorderBasicBlocks::LT_OPTIMIZE_CACHE, "cache",
"perform optimal layout prioritizing I-cache "
"behavior"),
- clEnumValN(bolt::ReorderBasicBlocks::LT_OPTIMIZE_EXT_TSP, "cache+",
+ clEnumValN(bolt::ReorderBasicBlocks::LT_OPTIMIZE_CACHE_PLUS, "cache+",
"perform layout optimizing I-cache behavior"),
clEnumValN(bolt::ReorderBasicBlocks::LT_OPTIMIZE_EXT_TSP, "ext-tsp",
"perform layout optimizing I-cache behavior"),
clEnumValN(bolt::ReorderBasicBlocks::LT_OPTIMIZE_SHUFFLE,
"cluster-shuffle", "perform random layout of clusters")),
- cl::ZeroOrMore, cl::cat(BoltOptCategory));
+ cl::ZeroOrMore, cl::cat(BoltOptCategory),
+ cl::callback([&](const bolt::ReorderBasicBlocks::LayoutType &option) {
+ if (option == bolt::ReorderBasicBlocks::LT_OPTIMIZE_CACHE_PLUS) {
+ WithColor::warning()
+ << "'-reorder-blocks=cache+' is deprecated, "
+ << "please use '-reorder-blocks=ext-tsp' instead.\n";
+ ReorderBlocks = bolt::ReorderBasicBlocks::LT_OPTIMIZE_EXT_TSP;
+ }
+ }));
static cl::opt<unsigned>
ReportBadLayout("report-bad-layout",
Index: bolt/include/bolt/Passes/BinaryPasses.h
===================================================================
--- bolt/include/bolt/Passes/BinaryPasses.h
+++ bolt/include/bolt/Passes/BinaryPasses.h
@@ -142,6 +142,8 @@
/// LT_OPTIMIZE_CACHE piggybacks on the idea from Ispike paper (CGO '04)
/// that suggests putting frequently executed chains first in the layout.
LT_OPTIMIZE_CACHE,
+ // CACHE_PLUS and EXT_TSP are synonyms, emit warnings of depreciation.
+ LT_OPTIMIZE_CACHE_PLUS,
/// Block reordering guided by the extended TSP metric.
LT_OPTIMIZE_EXT_TSP,
/// Create clusters and use random order for them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126722.433536.patch
Type: text/x-patch
Size: 2600 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220601/c871623b/attachment.bin>
More information about the llvm-commits
mailing list