[PATCH] D91019: [NewPM] Bail from PassManager::run() if there are no passes
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 7 16:49:44 PST 2020
aeubanks created this revision.
aeubanks added reviewers: MaskRay, ychen, asbirlea.
Herald added a reviewer: bollu.
Herald added subscribers: llvm-commits, dexonsmith.
Herald added a project: LLVM.
aeubanks requested review of this revision.
With D89158 <https://reviews.llvm.org/D89158>, we have the possibility of creating empty pass managers due
to callbacks choosing to not add passes under -O0. e.g. Polly can add
EP callbacks but not add any passes. This affects some tests that use
-debug-pass-manager, like the one fixed in 8eb338a92a4e <https://reviews.llvm.org/rG8eb338a92a4ea300bc3cbdd423500ca8b24f2094>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D91019
Files:
llvm/include/llvm/IR/PassManager.h
llvm/test/Other/new-pass-manager.ll
Index: llvm/test/Other/new-pass-manager.ll
===================================================================
--- llvm/test/Other/new-pass-manager.ll
+++ llvm/test/Other/new-pass-manager.ll
@@ -356,17 +356,11 @@
; CHECK-CALLGRAPH: Running analysis: CallGraphAnalysis
; CHECK-CALLGRAPH: Finished llvm::Module pass manager run
-;; If Polly is enabled, registerPollyPasses adds an ep-vectorizer-start callback.
-;; There may or may not be a function pass manager run.
-;; Add a no-op-function to unify the two cases.
; RUN: opt -disable-output -disable-verify -debug-pass-manager \
-; RUN: -passes='default<O0>' -passes-ep-vectorizer-start=no-op-function %s 2>&1 \
+; RUN: -passes='default<O0>' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-O0
; CHECK-O0: Starting llvm::Module pass manager run
; CHECK-O0-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}>
-; CHECK-O0-NEXT: Starting llvm::Function pass manager run
-; CHECK-O0-NEXT: Running pass: NoOpFunctionPass on foo
-; CHECK-O0-NEXT: Finished llvm::Function pass manager run
; CHECK-O0-NEXT: Finished llvm::Module pass manager run
; RUN: opt -disable-output -disable-verify -debug-pass-manager \
Index: llvm/include/llvm/IR/PassManager.h
===================================================================
--- llvm/include/llvm/IR/PassManager.h
+++ llvm/include/llvm/IR/PassManager.h
@@ -491,6 +491,9 @@
ExtraArgTs... ExtraArgs) {
PreservedAnalyses PA = PreservedAnalyses::all();
+ if (Passes.empty())
+ return PA;
+
// Request PassInstrumentation from analysis manager, will use it to run
// instrumenting callbacks for the passes later.
// Here we use std::tuple wrapper over getResult which helps to extract
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91019.303684.patch
Type: text/x-patch
Size: 1758 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201108/5380fc38/attachment.bin>
More information about the llvm-commits
mailing list