xref: /llvm-project/llvm/test/DebugInfo/debugify-each.ll (revision 1c6b0f779f66494cb597884c1a52e377bde4bc54)
1; RUN: opt -debugify-each -O3 -S -o /dev/null < %s 2> %t
2; RUN: FileCheck %s -input-file=%t -check-prefix=MODULE-PASS
3; RUN: FileCheck %s -input-file=%t -check-prefix=FUNCTION-PASS
4; RUN: opt -disable-output -debugify-each -passes='default<O3>' %s 2> %t
5; RUN: FileCheck %s -input-file=%t -check-prefix=MODULE-PASS
6; RUN: FileCheck %s -input-file=%t -check-prefix=FUNCTION-PASS
7
8; RUN: opt -enable-debugify -debugify-each -O3 -S -o /dev/null < %s 2> %t
9; RUN: FileCheck %s -input-file=%t -check-prefix=MODULE-PASS
10; RUN: FileCheck %s -input-file=%t -check-prefix=FUNCTION-PASS
11
12; RUN: opt -debugify-each -passes='instrprof,instrprof,sroa,sccp' -S -o /dev/null < %s 2> %t
13; RUN: FileCheck %s -input-file=%t -check-prefix=MODULE-PASS
14; RUN: FileCheck %s -input-file=%t -check-prefix=FUNCTION-PASS
15
16; Verify that debugify each can be safely used with piping
17; RUN: opt -debugify-each -O1 < %s | opt -O2 -o /dev/null
18
19; Check that the quiet mode emits no messages.
20; RUN: opt -disable-output -debugify-quiet -debugify-each -O1 < %s 2>&1 | count 0
21
22; Check that stripped textual IR compares equal before and after applying
23; debugify.
24; RUN: opt -O1 < %s -S -o %t.before
25; RUN: opt -O1 -debugify-each < %s -S -o %t.after
26; RUN: diff %t.before %t.after
27
28; Check that stripped IR compares equal before and after applying debugify.
29; RUN: opt -O1 < %s | llvm-dis -o %t.before
30; RUN: opt -O1 -debugify-each < %s | llvm-dis -o %t.after
31; RUN: diff %t.before %t.after
32
33; Check that we only run debugify once per function per function pass.
34; This ensures that we don't run it for pass managers/verifiers/printers.
35; RUN: opt -debugify-each -passes=instsimplify -S -o /dev/null < %s 2> %t
36; RUN: FileCheck %s -input-file=%t -check-prefix=FUNCTION-PASS-ONE
37
38; Check that we only run debugify once per module pass
39; (plus the implicitly added begin/end verifier passes).
40; RUN: opt -debugify-each -passes=globalopt -S -o /dev/null < %s 2> %t
41; RUN: FileCheck %s -input-file=%t -check-prefix=MODULE-PASS-ONE
42
43; Repeat the same checks with debug intrinsics enabled.
44; RUN: opt --experimental-debuginfo-iterators=false -debugify-each -O3 -S -o /dev/null < %s 2> %t
45; RUN: FileCheck %s -input-file=%t -check-prefix=MODULE-PASS
46; RUN: FileCheck %s -input-file=%t -check-prefix=FUNCTION-PASS
47; RUN: opt --experimental-debuginfo-iterators=false -disable-output -debugify-each -passes='default<O3>' %s 2> %t
48; RUN: FileCheck %s -input-file=%t -check-prefix=MODULE-PASS
49; RUN: FileCheck %s -input-file=%t -check-prefix=FUNCTION-PASS
50
51; RUN: opt --experimental-debuginfo-iterators=false -enable-debugify -debugify-each -O3 -S -o /dev/null < %s 2> %t
52; RUN: FileCheck %s -input-file=%t -check-prefix=MODULE-PASS
53; RUN: FileCheck %s -input-file=%t -check-prefix=FUNCTION-PASS
54
55; RUN: opt --experimental-debuginfo-iterators=false -debugify-each -passes='instrprof,instrprof,sroa,sccp' -S -o /dev/null < %s 2> %t
56; RUN: FileCheck %s -input-file=%t -check-prefix=MODULE-PASS
57; RUN: FileCheck %s -input-file=%t -check-prefix=FUNCTION-PASS
58
59; RUN: opt --experimental-debuginfo-iterators=false -debugify-each -O1 < %s | opt -O2 -o /dev/null
60
61; RUN: opt --experimental-debuginfo-iterators=false -disable-output -debugify-quiet -debugify-each -O1 < %s 2>&1 | count 0
62
63; RUN: opt --experimental-debuginfo-iterators=false -O1 < %s -S -o %t.before
64; RUN: opt --experimental-debuginfo-iterators=false -O1 -debugify-each < %s -S -o %t.after
65; RUN: diff %t.before %t.after
66
67; RUN: opt --experimental-debuginfo-iterators=false -O1 < %s | llvm-dis -o %t.before
68; RUN: opt --experimental-debuginfo-iterators=false -O1 -debugify-each < %s | llvm-dis -o %t.after
69; RUN: diff %t.before %t.after
70
71; RUN: opt --experimental-debuginfo-iterators=false -debugify-each -passes=instsimplify -S -o /dev/null < %s 2> %t
72; RUN: FileCheck %s -input-file=%t -check-prefix=FUNCTION-PASS-ONE
73
74; RUN: opt --experimental-debuginfo-iterators=false -debugify-each -passes=globalopt -S -o /dev/null < %s 2> %t
75; RUN: FileCheck %s -input-file=%t -check-prefix=MODULE-PASS-ONE
76
77define void @foo(i32 %arg) {
78  call i32 asm "bswap $0", "=r,r"(i32 %arg)
79  ret void
80}
81
82define void @bar() {
83  ret void
84}
85
86; Verify that the module & function (check-)debugify passes run at least twice.
87
88; MODULE-PASS: CheckModuleDebugify [{{.*}}]
89; MODULE-PASS: CheckModuleDebugify [{{.*}}]
90
91; FUNCTION-PASS: CheckFunctionDebugify [{{.*}}]
92; FUNCTION-PASS: CheckFunctionDebugify [{{.*}}]
93; FUNCTION-PASS: CheckFunctionDebugify [{{.*}}]
94; FUNCTION-PASS: CheckFunctionDebugify [{{.*}}]
95
96; MODULE-PASS-ONE: CheckModuleDebugify [{{.*}}]
97; MODULE-PASS-ONE-NOT: CheckModuleDebugify [{{.*}}]
98
99; FUNCTION-PASS-ONE: CheckFunctionDebugify [{{.*}}]
100; FUNCTION-PASS-ONE: CheckFunctionDebugify [{{.*}}]
101; FUNCTION-PASS-ONE-NOT: CheckFunctionDebugify [{{.*}}]
102