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: -loop-deletion -print-before=loop-deletion \
6 ; RUN: | FileCheck %s -check-prefix=DEL
7 ; RUN: opt < %s 2>&1 -disable-output \
8 ; RUN: -passes='loop(loop-deletion)' -print-before-all \
9 ; RUN: | FileCheck %s -check-prefix=DEL
10 ; RUN: opt < %s 2>&1 -disable-output \
11 ; RUN: -loop-unroll -print-after=loop-unroll -filter-print-funcs=bar \
12 ; RUN: | FileCheck %s -check-prefix=BAR -check-prefix=BAR-OLD
13 ; RUN: opt < %s 2>&1 -disable-output \
14 ; RUN: -passes='require<opt-remark-emit>,loop(unroll-full)' -print-after-all -filter-print-funcs=bar \
15 ; RUN: | FileCheck %s -check-prefix=BAR
16 ; RUN: opt < %s 2>&1 -disable-output \
17 ; RUN: -loop-unroll -print-after=loop-unroll -filter-print-funcs=foo -print-module-scope \
18 ; RUN: | FileCheck %s -check-prefix=FOO-MODULE -check-prefix=FOO-MODULE-OLD
19 ; RUN: opt < %s 2>&1 -disable-output \
20 ; RUN: -passes='require<opt-remark-emit>,loop(unroll-full)' -print-after-all -filter-print-funcs=foo -print-module-scope \
21 ; RUN: | FileCheck %s -check-prefix=FOO-MODULE
23 ; DEL: IR Dump Before {{Delete dead loops|LoopDeletionPass}}
25 ; DEL-NEXT: %idx = alloca i32, align 4
31 ; DEL: IR Dump Before {{Delete dead loops|LoopDeletionPass}}
33 ; DEL-NEXT: br label %loop
39 ; BAR: IR Dump After {{Unroll|LoopFullUnrollPass}}
41 ; BAR-NEXT: br label %loop
46 ; BAR-OLD-NOT: IR Dump
49 ; FOO-MODULE: IR Dump After {{Unroll|LoopFullUnrollPass}}
50 ; FOO-MODULE-SAME: loop: %loop
51 ; FOO-MODULE-NEXT: ModuleID =
52 ; FOO-MODULE: define void @foo
53 ; FOO-MODULE: define void @bar
54 ; FOO-MODULE-OLD-NOT: IR Dump
57 %idx = alloca i32, align 4
58 store i32 0, i32* %idx, align 4
62 %1 = load i32, i32* %idx, align 4
63 %2 = icmp slt i32 %1, 10
64 br i1 %2, label %cont, label %done
67 %3 = load i32, i32* %idx, align 4
68 %4 = add nsw i32 %3, 1
69 store i32 %4, i32* %idx, align 4
79 br i1 1, label %loop, label %end