[bazel] Replace strip_include_prefix in lldb with includes (#125293)
[llvm-project.git] / llvm / test / Other / print-loop-func-scope.ll
blob507ff70a5fd96c5fdd8381917e73cc4b0af569cc
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
24 ; VANILLA: Preheader:
25 ; VANILLA: Loop:
26 ; VANILLA: Exit blocks
28 ; LOOPFUNC: IR Dump After LICMPass
29 ; LOOPFUNC: (loop:
30 ; LOOPFUNC: define void @foo
31 ; LOOPFUNC-NOT: Preheader:
32 ; LOOPFUNC-NOT: Loop:
33 ; LOOPFUNC-NOT: Exit blocks
35 ; MODULE: IR Dump After LICMPass
36 ; MODULE: ModuleID =
37 ; MODULE: define void @foo
38 ; MODULE-NOT: Preheader:
39 ; MODULE-NOT: Loop:
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) {
54 entry:
55   br label %loop_cond
57 loop_cond:
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
62 loop_body:
63   call void @baz(i32 %i)
64   %i_next = add i32 %i, 1
65   br label %loop_cond
67 loop_end:
68   ret void
71 define void @bar() {
72   ret void
75 declare void @baz(i32)