1 ; This test checks -print-after/before on loop passes
2 ; Besides of the loop itself it should be dumping loop pre-header and exits.
4 ; RUN: opt < %s 2>&1 -disable-output \
5 ; RUN: -passes='loop(loop-deletion)' -print-before=loop-deletion \
6 ; RUN: | FileCheck %s -check-prefix=DEL
7 ; RUN: opt < %s 2>&1 -disable-output \
8 ; RUN: -passes='require<opt-remark-emit>,loop(loop-unroll-full)' -print-after=loop-unroll-full -filter-print-funcs=bar \
9 ; RUN: | FileCheck %s -check-prefix=BAR
10 ; RUN: opt < %s 2>&1 -disable-output \
11 ; RUN: -passes='require<opt-remark-emit>,loop(loop-unroll-full)' -print-after=loop-unroll-full -filter-print-funcs=foo -print-module-scope \
12 ; RUN: | FileCheck %s -check-prefix=FOO-MODULE
14 ; DEL: IR Dump Before {{Delete dead loops|LoopDeletionPass}}
16 ; DEL-NEXT: %idx = alloca i32, align 4
22 ; DEL: IR Dump Before {{Delete dead loops|LoopDeletionPass}}
24 ; DEL-NEXT: br label %loop
30 ; BAR: IR Dump After {{Unroll|LoopFullUnrollPass}}
32 ; BAR-NEXT: br label %loop
38 ; FOO-MODULE: IR Dump After {{Unroll|LoopFullUnrollPass}} {{.*}}loop
39 ; FOO-MODULE-NEXT: ModuleID =
40 ; FOO-MODULE: define void @foo
41 ; FOO-MODULE: define void @bar
44 %idx = alloca i32, align 4
45 store i32 0, ptr %idx, align 4
49 %1 = load i32, ptr %idx, align 4
50 %2 = icmp slt i32 %1, 10
51 br i1 %2, label %cont, label %done
54 %3 = load i32, ptr %idx, align 4
55 %4 = add nsw i32 %3, 1
56 store i32 %4, ptr %idx, align 4
66 br i1 1, label %loop, label %end