xref: /llvm-project/llvm/test/Other/cfg-printer-filter.ll (revision ae32ba4e015b6fe6a3f359fd5a2fde64fa96276e)
1; RUN: rm -f %t.other.dot %t-only.other.dot
2
3;; Both f and func are dumped because their names contain the pattern 'f' as a substring.
4;; Also checks dot-cfg pass runs on func which has optnone attribute.
5
6; RUN: opt < %s -passes=dot-cfg -cfg-dot-filename-prefix=%t -cfg-func-name=f 2>/dev/null > /dev/null
7; RUN: FileCheck %s -input-file=%t.f.dot -check-prefix=F
8; RUN: FileCheck %s -input-file=%t.func.dot -check-prefix=Func
9; RUN: not test -f %t.other.dot
10
11; RUN: opt < %s -passes=dot-cfg-only -cfg-dot-filename-prefix=%t-only -cfg-func-name=f 2>/dev/null > /dev/null
12; RUN: FileCheck %s -input-file=%t-only.f.dot -check-prefix=F
13; RUN: FileCheck %s -input-file=%t-only.func.dot -check-prefix=Func
14; RUN: not test -f %t-only.other.dot
15
16; F: digraph "CFG for 'f' function"
17define void @f(i32) {
18entry:
19  %check = icmp sgt i32 %0, 0
20  br i1 %check, label %if, label %exit
21if:                     ; preds = %entry
22  br label %exit
23exit:                   ; preds = %entry, %if
24  ret void
25}
26
27; Func: digraph "CFG for 'func' function"
28define void @func(i32) optnone noinline {
29entry:
30  %check = icmp sgt i32 %0, 0
31  br label %exit
32exit:                   ; preds = %entry
33  ret void
34}
35
36define void @other(i32) {
37entry:
38  %check = icmp sgt i32 %0, 0
39  br label %exit
40exit:                   ; preds = %entry
41  ret void
42}
43