[PATCH] D152122: Set isRequired true for CFGViewer/CFGPrinter passes

Wenju He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 5 22:26:20 PDT 2023


wenju updated this revision to Diff 528684.
wenju added a comment.

update llvm/test/Other/cfg-printer-filter.ll to test optnone


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152122/new/

https://reviews.llvm.org/D152122

Files:
  llvm/include/llvm/Analysis/CFGPrinter.h
  llvm/test/Other/cfg-printer-filter.ll


Index: llvm/test/Other/cfg-printer-filter.ll
===================================================================
--- llvm/test/Other/cfg-printer-filter.ll
+++ 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 @@
 }
 
 ; 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
Index: llvm/include/llvm/Analysis/CFGPrinter.h
===================================================================
--- llvm/include/llvm/Analysis/CFGPrinter.h
+++ llvm/include/llvm/Analysis/CFGPrinter.h
@@ -35,21 +35,25 @@
 class CFGViewerPass : public PassInfoMixin<CFGViewerPass> {
 public:
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  static bool isRequired() { return true; }
 };
 
 class CFGOnlyViewerPass : public PassInfoMixin<CFGOnlyViewerPass> {
 public:
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  static bool isRequired() { return true; }
 };
 
 class CFGPrinterPass : public PassInfoMixin<CFGPrinterPass> {
 public:
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  static bool isRequired() { return true; }
 };
 
 class CFGOnlyPrinterPass : public PassInfoMixin<CFGOnlyPrinterPass> {
 public:
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  static bool isRequired() { return true; }
 };
 
 class DOTFuncInfo {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152122.528684.patch
Type: text/x-patch
Size: 1860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230606/254bc31f/attachment.bin>


More information about the llvm-commits mailing list