1 ; This file verifies the behavior of the OptBisect class, which is used to
2 ; diagnose optimization related failures. The tests check various
3 ; invocations that result in different sets of optimization passes that
4 ; are run in different ways.
6 ; This set of tests exercises the legacy pass manager interface to the OptBisect
7 ; class. Because the exact set of optimizations that will be run may
8 ; change over time, these tests are written in a more general manner than the
9 ; corresponding tests for the new pass manager.
11 ; Don't use NEXT checks or hard-code pass numbering so that this won't fail if
12 ; new passes are inserted.
15 ; Verify that the file can be compiled to an object file at -O3 with all
16 ; skippable passes skipped.
18 ; REQUIRES: default_triple
19 ; RUN: opt -O3 -opt-bisect-limit=0 < %s | llc -O3 -opt-bisect-limit=0
22 ; Verify that no skippable passes are run with -opt-bisect-limit=0.
24 ; RUN: opt -disable-output -disable-verify -O3 -opt-bisect-limit=0 %s 2>&1 \
25 ; RUN: | FileCheck %s --check-prefix=CHECK-SKIP-ALL
26 ; CHECK-SKIP-ALL: BISECT: NOT running pass ({{[0-9]+}})
27 ; CHECK-SKIP-ALL-NOT: BISECT: running pass ({{[0-9]+}})
30 ; Verify that no passes run at -O0 are skipped
31 ; RUN: opt -opt-bisect-limit=0 < %s 2>&1 | FileCheck %s --check-prefix=OPTBISECT-O0
32 ; OPTBISECT-O0-NOT: BISECT: NOT running
34 ; FIXME: There are still some AMDGPU passes being skipped that run at -O0.
37 ; Verify that we can use the opt-bisect-helper.py script (derived from
38 ; utils/bisect) to locate the optimization that inlines the call to
41 ; RUN: %python %S/opt-bisect-helper.py --start=0 --end=256 --optcmd=opt \
42 ; RUN: --filecheckcmd=FileCheck --test=%s \
43 ; RUN: --prefix=CHECK-BISECT-INLINE-HELPER \
44 ; RUN: | FileCheck %s --check-prefix=CHECK-BISECT-INLINE-RESULT
45 ; The helper script uses this to find the optimization that inlines the call.
46 ; CHECK-BISECT-INLINE-HELPER: call i32 @f2()
47 ; These checks verifies that the optimization was found.
48 ; CHECK-BISECT-INLINE-RESULT-NOT: Last good count: 0
49 ; CHECK-BISECT-INLINE-RESULT: Last good count: {{[0-9]+}}
54 ; RUN: opt -disable-output -disable-verify -deadargelim -opt-bisect-limit=-1 %s \
55 ; RUN: 2>&1 | FileCheck %s --check-prefix=CHECK-DEADARG
56 ; CHECK-DEADARG: BISECT: running pass ({{[0-9]+}}) Dead Argument Elimination on module
58 ; RUN: opt -disable-output -disable-verify -deadargelim -opt-bisect-limit=0 %s \
59 ; RUN: 2>&1 | FileCheck %s --check-prefix=CHECK-NOT-DEADARG
60 ; CHECK-NOT-DEADARG: BISECT: NOT running pass ({{[0-9]+}}) Dead Argument Elimination on module
65 ; RUN: opt -disable-output -disable-verify -inline -opt-bisect-limit=-1 %s \
66 ; RUN: 2>&1 | FileCheck %s --check-prefix=CHECK-INLINE
67 ; CHECK-INLINE: BISECT: running pass ({{[0-9]+}}) Function Integration/Inlining on SCC (<<null function>>)
68 ; CHECK-INLINE: BISECT: running pass ({{[0-9]+}}) Function Integration/Inlining on SCC (g)
69 ; CHECK-INLINE: BISECT: running pass ({{[0-9]+}}) Function Integration/Inlining on SCC (f1)
70 ; CHECK-INLINE: BISECT: running pass ({{[0-9]+}}) Function Integration/Inlining on SCC (f2)
71 ; CHECK-INLINE: BISECT: running pass ({{[0-9]+}}) Function Integration/Inlining on SCC (f3)
72 ; CHECK-INLINE: BISECT: running pass ({{[0-9]+}}) Function Integration/Inlining on SCC (<<null function>>)
74 ; RUN: opt -disable-output -disable-verify -inline -opt-bisect-limit=0 %s \
75 ; RUN: 2>&1 | FileCheck %s --check-prefix=CHECK-NOT-INLINE
76 ; CHECK-NOT-INLINE: BISECT: NOT running pass ({{[0-9]+}}) Function Integration/Inlining on SCC (<<null function>>)
77 ; CHECK-NOT-INLINE: BISECT: NOT running pass ({{[0-9]+}}) Function Integration/Inlining on SCC (g)
78 ; CHECK-NOT-INLINE: BISECT: NOT running pass ({{[0-9]+}}) Function Integration/Inlining on SCC (f1)
79 ; CHECK-NOT-INLINE: BISECT: NOT running pass ({{[0-9]+}}) Function Integration/Inlining on SCC (f2)
80 ; CHECK-NOT-INLINE: BISECT: NOT running pass ({{[0-9]+}}) Function Integration/Inlining on SCC (f3)
81 ; CHECK-NOT-INLINE: BISECT: NOT running pass ({{[0-9]+}}) Function Integration/Inlining on SCC (<<null function>>)
84 ; Test a function pass.
86 ; RUN: opt -disable-output -disable-verify -early-cse -opt-bisect-limit=-1 \
87 ; RUN: %s 2>&1 | FileCheck %s --check-prefix=CHECK-EARLY-CSE
88 ; CHECK-EARLY-CSE: BISECT: running pass ({{[0-9]+}}) Early CSE on function (f1)
89 ; CHECK-EARLY-CSE: BISECT: running pass ({{[0-9]+}}) Early CSE on function (f2)
90 ; CHECK-EARLY-CSE: BISECT: running pass ({{[0-9]+}}) Early CSE on function (f3)
92 ; RUN: opt -disable-output -disable-verify -early-cse -opt-bisect-limit=0 %s \
93 ; RUN: 2>&1 | FileCheck %s --check-prefix=CHECK-NOT-EARLY-CSE
94 ; CHECK-NOT-EARLY-CSE: BISECT: NOT running pass ({{[0-9]+}}) Early CSE on function (f1)
95 ; CHECK-NOT-EARLY-CSE: BISECT: NOT running pass ({{[0-9]+}}) Early CSE on function (f2)
96 ; CHECK-NOT-EARLY-CSE: BISECT: NOT running pass ({{[0-9]+}}) Early CSE on function (f3)
101 ; RUN: opt -disable-output -disable-verify -loop-reduce -opt-bisect-limit=-1 \
102 ; RUN: %s 2>&1 | FileCheck %s --check-prefix=CHECK-LOOP-REDUCE
103 ; CHECK-LOOP-REDUCE: BISECT: running pass ({{[0-9]+}}) Loop Strength Reduction on loop
104 ; CHECK-LOOP-REDUCE: BISECT: running pass ({{[0-9]+}}) Loop Strength Reduction on loop
105 ; CHECK-LOOP-REDUCE: BISECT: running pass ({{[0-9]+}}) Loop Strength Reduction on loop
106 ; CHECK-LOOP-REDUCE: BISECT: running pass ({{[0-9]+}}) Loop Strength Reduction on loop
107 ; CHECK-LOOP-REDUCE: BISECT: running pass ({{[0-9]+}}) Loop Strength Reduction on loop
109 ; RUN: opt -disable-output -disable-verify -loop-reduce -opt-bisect-limit=0 \
110 ; RUN: %s 2>&1 | FileCheck %s --check-prefix=CHECK-NOT-LOOP-REDUCE
111 ; CHECK-NOT-LOOP-REDUCE: BISECT: NOT running pass ({{[0-9]+}}) Loop Strength Reduction on loop
112 ; CHECK-NOT-LOOP-REDUCE: BISECT: NOT running pass ({{[0-9]+}}) Loop Strength Reduction on loop
113 ; CHECK-NOT-LOOP-REDUCE: BISECT: NOT running pass ({{[0-9]+}}) Loop Strength Reduction on loop
114 ; CHECK-NOT-LOOP-REDUCE: BISECT: NOT running pass ({{[0-9]+}}) Loop Strength Reduction on loop
115 ; CHECK-NOT-LOOP-REDUCE: BISECT: NOT running pass ({{[0-9]+}}) Loop Strength Reduction on loop
124 br i1 undef, label %loop.0.0, label %loop.1
126 br i1 undef, label %loop.0.0, label %loop.0.1
128 br i1 undef, label %loop.0.1, label %loop.0
130 br i1 undef, label %loop.1, label %loop.1.bb1
132 br i1 undef, label %loop.1, label %loop.1.bb2
134 br i1 undef, label %end, label %loop.1.0
136 br i1 undef, label %loop.1.0, label %loop.1
148 %temp = call i32 @g()
149 %icmp = icmp ugt i32 %temp, 2
150 br i1 %icmp, label %bb.true, label %bb.false
152 %temp2 = call i32 @f2()
158 ; This function is here to verify that opt-bisect can skip all passes for
159 ; functions that contain lifetime intrinsics.
162 %i = alloca i32, align 4
163 %tmp = bitcast i32* %i to i8*
164 call void @llvm.lifetime.start(i64 4, i8* %tmp)
168 br i1 undef, label %for.body, label %for.end
177 declare void @llvm.lifetime.start(i64, i8* nocapture)