diff --git a/llvm/include/llvm/Analysis/CFGPrinter.h b/llvm/include/llvm/Analysis/CFGPrinter.h index eeac11bc7af12..8c4c0c3f182f2 100644 --- a/llvm/include/llvm/Analysis/CFGPrinter.h +++ b/llvm/include/llvm/Analysis/CFGPrinter.h @@ -35,21 +35,25 @@ template struct GraphTraits; class CFGViewerPass : public PassInfoMixin { public: PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); + static bool isRequired() { return true; } }; class CFGOnlyViewerPass : public PassInfoMixin { public: PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); + static bool isRequired() { return true; } }; class CFGPrinterPass : public PassInfoMixin { public: PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); + static bool isRequired() { return true; } }; class CFGOnlyPrinterPass : public PassInfoMixin { public: PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); + static bool isRequired() { return true; } }; class DOTFuncInfo { diff --git a/llvm/test/Other/cfg-printer-filter.ll b/llvm/test/Other/cfg-printer-filter.ll index 4ec6b73dda6a7..2a25c465a2bc1 100644 --- a/llvm/test/Other/cfg-printer-filter.ll +++ b/llvm/test/Other/cfg-printer-filter.ll @@ -1,6 +1,8 @@ ; RUN: rm -f %t.other.dot %t-only.other.dot ;; Both f and func are dumped because their names contain the pattern 'f' as a substring. +;; Also checks dot-cfg pass runs on func which has optnone attribute. + ; RUN: opt < %s -passes=dot-cfg -cfg-dot-filename-prefix=%t -cfg-func-name=f 2>/dev/null > /dev/null ; RUN: FileCheck %s -input-file=%t.f.dot -check-prefix=F ; RUN: FileCheck %s -input-file=%t.func.dot -check-prefix=Func @@ -23,7 +25,7 @@ exit: ; preds = %entry, %if } ; Func: digraph "CFG for 'func' function" -define void @func(i32) { +define void @func(i32) optnone noinline { entry: %check = icmp sgt i32 %0, 0 br label %exit