1 ; This test documents how the IR dumped for loop passes differs with -print-loop-func-scope
2 ; and -print-module-scope
3 ; - Without -print-loop-func-scope, dumps only the loop, with 3 sections- preheader,
4 ; loop, and exit blocks
5 ; - With -print-loop-func-scope, dumps only the function which contains the loop
6 ; - With -print-module-scope, dumps the entire module containing the loop, and disregards
7 ; the -print-loop-func-scope flag.
9 ; RUN: opt < %s 2>&1 -disable-output \
10 ; RUN: -passes=licm -print-after=licm \
11 ; RUN: | FileCheck %s -check-prefix=VANILLA
12 ; RUN: opt < %s 2>&1 -disable-output \
13 ; RUN: -passes=licm -print-after=licm -print-loop-func-scope \
14 ; RUN: | FileCheck %s -check-prefix=LOOPFUNC
15 ; RUN: opt < %s 2>&1 -disable-output \
16 ; RUN: -passes=licm -print-after=licm -print-module-scope \
17 ; RUN: | FileCheck %s -check-prefix=MODULE
18 ; RUN: opt < %s 2>&1 -disable-output \
19 ; RUN: -passes=licm -print-after=licm -print-module-scope -print-loop-func-scope\
20 ; RUN: | FileCheck %s -check-prefix=MODULEWITHLOOP
22 ; VANILLA: IR Dump After LICMPass
23 ; VANILLA-NOT: define void @foo
26 ; VANILLA: Exit blocks
28 ; LOOPFUNC: IR Dump After LICMPass
30 ; LOOPFUNC: define void @foo
31 ; LOOPFUNC-NOT: Preheader:
33 ; LOOPFUNC-NOT: Exit blocks
35 ; MODULE: IR Dump After LICMPass
37 ; MODULE: define void @foo
38 ; MODULE-NOT: Preheader:
40 ; MODULE-NOT: Exit blocks
41 ; MODULE: define void @bar
42 ; MODULE: declare void @baz(i32)
44 ; MODULEWITHLOOP: IR Dump After LICMPass
45 ; MODULEWITHLOOP: ModuleID =
46 ; MODULEWITHLOOP: define void @foo
47 ; MODULEWITHLOOP-NOT: Preheader:
48 ; MODULEWITHLOOP-NOT: Loop:
49 ; MODULEWITHLOOP-NOT: Exit blocks
50 ; MODULEWITHLOOP: define void @bar
51 ; MODULEWITHLOOP: declare void @baz(i32)
53 define void @foo(i32 %n) {
58 %i = phi i32 [ 0, %entry ], [ %i_next, %loop_body ]
59 %cmp = icmp slt i32 %i, %n
60 br i1 %cmp, label %loop_body, label %loop_end
63 call void @baz(i32 %i)
64 %i_next = add i32 %i, 1
75 declare void @baz(i32)