[PATCH] D92897: Set legacy pass manager OptBisect to same as NPM OptBisect
Samuel Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 8 16:38:57 PST 2020
swamulism created this revision.
swamulism added a reviewer: aeubanks.
swamulism requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.
Currently there is an issue where the legacy pass manager uses a different OptBisect counter than the new pass manager.
This means that when using OptBisect under the NPM it runs twice when it should only run once.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D92897
Files:
clang/lib/CodeGen/BackendUtil.cpp
clang/test/CodeGen/new-pass-manager-O1-opt-bisect.c
llvm/include/llvm/Passes/StandardInstrumentations.h
Index: llvm/include/llvm/Passes/StandardInstrumentations.h
===================================================================
--- llvm/include/llvm/Passes/StandardInstrumentations.h
+++ llvm/include/llvm/Passes/StandardInstrumentations.h
@@ -281,6 +281,7 @@
void registerCallbacks(PassInstrumentationCallbacks &PIC);
TimePassesHandler &getTimePasses() { return TimePasses; }
+ OptBisectInstrumentation &getOptBisect() { return OptBisect; }
};
extern template class ChangeReporter<std::string>;
Index: clang/test/CodeGen/new-pass-manager-O1-opt-bisect.c
===================================================================
--- /dev/null
+++ clang/test/CodeGen/new-pass-manager-O1-opt-bisect.c
@@ -0,0 +1,8 @@
+// Test NPM with -O1/opt-bisect
+//
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -O1 -fexperimental-new-pass-manager %s -fdebug-pass-manager -mllvm -opt-bisect-limit=-1 -emit-llvm -o /dev/null 2>&1 | FileCheck %s
+
+// CHECK: BISECT: running pass (1)
+// CHECK-NOT: BISECT: running pass (1)
+
+int func(int a) { return a; }
Index: clang/lib/CodeGen/BackendUtil.cpp
===================================================================
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -1149,6 +1149,9 @@
SI.registerCallbacks(PIC);
PassBuilder PB(CodeGenOpts.DebugPassManager, TM.get(), PTO, PGOOpt, &PIC);
+ // Sets legacy pass manager OptBisect to the same one as npm so passes are properly skipped
+ TheModule->getContext().setOptPassGate(SI.getOptBisect());
+
// Attempt to load pass plugins and register their callbacks with PB.
for (auto &PluginFN : CodeGenOpts.PassPlugins) {
auto PassPlugin = PassPlugin::Load(PluginFN);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92897.310386.patch
Type: text/x-patch
Size: 1698 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201209/7b7aba0e/attachment.bin>
More information about the llvm-commits
mailing list