• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; The IR below was crafted so as:
2; 1) To have a loop, so we create a loop pass manager
3; 2) To be "immutable" in the sense that no pass in the standard
4;    pipeline will modify it.
5; Since no transformations take place, we don't expect any analyses
6; to be invalidated.
7; Any invalidation that shows up here is a bug, unless we started modifying
8; the IR, in which case we need to make it immutable harder.
9
10; RUN: opt -disable-verify -debug-pass-manager \
11; RUN:     -passes='default<O0>' -S %s 2>&1 \
12; RUN:     | FileCheck %s --check-prefixes=CHECK,CHECK-DEFAULT
13; RUN: opt -disable-verify -debug-pass-manager -enable-matrix \
14; RUN:     -passes='default<O0>' -S %s 2>&1 \
15; RUN:     | FileCheck %s --check-prefixes=CHECK,CHECK-DEFAULT,CHECK-MATRIX
16; RUN: opt -disable-verify -debug-pass-manager \
17; RUN:     -passes='thinlto-pre-link<O0>' -S %s 2>&1 \
18; RUN:     | FileCheck %s --check-prefixes=CHECK,CHECK-DEFAULT,CHECK-PRE-LINK
19; RUN: opt -disable-verify -debug-pass-manager \
20; RUN:     -passes='lto-pre-link<O0>' -S %s 2>&1 \
21; RUN:     | FileCheck %s --check-prefixes=CHECK,CHECK-DEFAULT,CHECK-PRE-LINK
22; RUN: opt -disable-verify -debug-pass-manager \
23; RUN:     -passes='thinlto<O0>' -S %s 2>&1 \
24; RUN:     | FileCheck %s --check-prefixes=CHECK,CHECK-THINLTO
25; RUN: opt -disable-verify -debug-pass-manager \
26; RUN:     -passes='lto<O0>' -S %s 2>&1 \
27; RUN:     | FileCheck %s --check-prefixes=CHECK,CHECK-LTO
28
29; CHECK: Starting llvm::Module pass manager run.
30; CHECK-DEFAULT-NEXT: Running pass: AlwaysInlinerPass
31; CHECK-DEFAULT-NEXT: Running analysis: InnerAnalysisManagerProxy
32; CHECK-DEFAULT-NEXT: Running analysis: ProfileSummaryAnalysis
33; CHECK-MATRIX-NEXT: Running pass: LowerMatrixIntrinsicsPass
34; CHECK-MATRIX-NEXT: Running analysis: TargetIRAnalysis
35; CHECK-PRE-LINK-NEXT: Running pass: CanonicalizeAliasesPass
36; CHECK-PRE-LINK-NEXT: Running pass: NameAnonGlobalPass
37; CHECK-THINLTO-NEXT: Running pass: Annotation2MetadataPass
38; CHECK-LTO-NEXT: Running pass: Annotation2MetadataPass
39; CHECK-LTO-NEXT: Running pass: WholeProgramDevirtPass
40; CHECK-LTO-NEXT: Running analysis: InnerAnalysisManagerProxy
41; CHECK-LTO-NEXT: Running pass: LowerTypeTestsPass
42; CHECK-LTO-NEXT: Running pass: LowerTypeTestsPass
43; CHECK-LTO-NEXT: Running pass: AnnotationRemarksPass
44; CHECK-NEXT: Running pass: PrintModulePass
45
46; Make sure we get the IR back out without changes when we print the module.
47; CHECK-LABEL: define void @foo(i32 %n) local_unnamed_addr {
48; CHECK-NEXT: entry:
49; CHECK-NEXT:   br label %loop
50; CHECK:      loop:
51; CHECK-NEXT:   %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
52; CHECK-NEXT:   %iv.next = add i32 %iv, 1
53; CHECK-NEXT:   tail call void @bar()
54; CHECK-NEXT:   %cmp = icmp eq i32 %iv, %n
55; CHECK-NEXT:   br i1 %cmp, label %exit, label %loop
56; CHECK:      exit:
57; CHECK-NEXT:   ret void
58; CHECK-NEXT: }
59;
60; CHECK-NEXT: Finished llvm::Module pass manager run.
61
62declare void @bar() local_unnamed_addr
63
64define void @foo(i32 %n) local_unnamed_addr {
65entry:
66  br label %loop
67loop:
68  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
69  %iv.next = add i32 %iv, 1
70  tail call void @bar()
71  %cmp = icmp eq i32 %iv, %n
72  br i1 %cmp, label %exit, label %loop
73exit:
74  ret void
75}
76