llvm-project
40 строк · 1.8 Кб
1; RUN: opt -passes="loop(indvars,loop-deletion,loop-unroll-full)" -print-pass-numbers -S -o /dev/null %s 2>&1 | FileCheck %s --check-prefix=NUMBER
2; RUN: opt -passes="loop(indvars,loop-deletion,loop-unroll-full)" -print-pass-numbers -filter-print-funcs=baz -S -o /dev/null %s 2>&1 | FileCheck %s --check-prefix=NUMBER-FILTERED
3; RUN: opt -passes="loop(indvars,loop-deletion,loop-unroll-full)" -print-module-scope -print-before-pass-number=3 -S -o /dev/null %s 2>&1 | FileCheck %s --check-prefix=BEFORE
4; RUN: opt -passes="loop(indvars,loop-deletion,loop-unroll-full)" -print-module-scope -print-after-pass-number=2 -S -o /dev/null %s 2>&1 | FileCheck %s --check-prefix=AFTER
5
6define i32 @bar(i32 %arg) {
7; BEFORE: *** IR Dump Before 3-IndVarSimplifyPass on loop %bb1 in function bar ***
8; BEFORE: define i32 @bar(i32 %arg) {
9; AFTER: *** IR Dump After 2-LCSSAPass on bar ***
10; AFTER: define i32 @bar(i32 %arg) {
11
12bb:
13br label %bb1
14
15bb1: ; preds = %bb1, %bb
16%phi = phi i32 [ 0, %bb ], [ %add, %bb1 ]
17%phi2 = phi i32 [ 0, %bb ], [ %add3, %bb1 ]
18%add = add i32 %phi, 1
19%add3 = add i32 %phi2, %add
20%icmp = icmp slt i32 %phi, %arg
21br i1 %icmp, label %bb1, label %bb4
22
23bb4: ; preds = %bb1
24ret i32 %add3
25}
26
27define i32 @baz(i32 %arg) {
28ret i32 0;
29}
30
31; NUMBER: Running pass 1 LoopSimplifyPass on bar
32; NUMBER-NEXT: Running pass 2 LCSSAPass on bar
33; NUMBER-NEXT: Running pass 3 IndVarSimplifyPass on loop %bb1 in function bar
34; NUMBER-NEXT: Running pass 4 LoopDeletionPass on loop %bb1 in function bar
35; NUMBER-NEXT: Running pass 5 LoopSimplifyPass on baz
36; NUMBER-NEXT: Running pass 6 LCSSAPass on baz
37; NUMBER-NOT: Running pass
38
39; NUMBER-FILTERED: Running pass 1 LoopSimplifyPass on baz
40; NUMBER-FILTERED-NEXT: Running pass 2 LCSSAPass on baz
41
42