1; RUN: opt -enable-new-pm=0 < %s -disable-output -instcombine -instcombine -licm -time-passes 2>&1 | FileCheck %s --check-prefix=TIME --check-prefix=TIME-LEGACY
2; RUN: opt -enable-new-pm=0 < %s -disable-output -instcombine -instcombine -licm -licm -time-passes 2>&1 | FileCheck %s --check-prefix=TIME --check-prefix=TIME-LEGACY --check-prefix=TIME-DOUBLE-LICM-LEGACY
3; RUN: opt < %s -disable-output -passes='default<O2>' -time-passes 2>&1 | FileCheck %s --check-prefix=TIME
4;
5; For new pass manager, check that -time-passes-per-run emit one report for each pass run.
6; RUN: opt < %s -disable-output -passes='instcombine,instcombine,loop(licm)' -time-passes-per-run 2>&1 | FileCheck %s --check-prefix=TIME --check-prefix=TIME-NEW
7; RUN: opt < %s -disable-output -passes='instcombine,loop(licm),instcombine,loop(licm)' -time-passes-per-run 2>&1 | FileCheck %s --check-prefix=TIME --check-prefix=TIME-NEW -check-prefix=TIME-DOUBLE-LICM-NEW
8;
9; For new pass manager, check that -time-passes emit one report for each pass.
10; RUN: opt < %s -disable-output -passes='instcombine,instcombine,loop(licm)' -time-passes 2>&1 | FileCheck %s --check-prefixes=TIME,TIME-NEW-PER-PASS
11; RUN: opt < %s -disable-output -passes='instcombine,loop(licm),instcombine,loop(licm)' -time-passes 2>&1 | FileCheck %s --check-prefixes=TIME,TIME-NEW-PER-PASS
12;
13; The following 4 test runs verify -info-output-file interaction (default goes to stderr, '-' goes to stdout).
14; RUN: opt -enable-new-pm=0 < %s -disable-output -O2 -time-passes -info-output-file='-' 2>/dev/null | FileCheck %s --check-prefix=TIME
15; RUN: opt < %s -disable-output -passes='default<O2>' -time-passes -info-output-file='-' 2>/dev/null | FileCheck %s --check-prefix=TIME
16;
17; RUN: rm -f %t; opt < %s -disable-output -O2 -time-passes -info-output-file=%t
18; RUN:   cat %t | FileCheck %s --check-prefix=TIME
19;
20; RUN: rm -f %t; opt < %s -disable-output -passes='default<O2>' -time-passes -info-output-file=%t
21; RUN:   cat %t | FileCheck %s --check-prefix=TIME
22;
23; TIME: Pass execution timing report
24; TIME: Total Execution Time:
25; TIME: Name
26; TIME-LEGACY-DAG:   Combine redundant instructions{{$}}
27; TIME-LEGACY-DAG:   Combine redundant instructions #2
28; TIME-LEGACY-DAG:   Loop Invariant Code Motion{{$}}
29; TIME-DOUBLE-LICM-LEGACY-DAG: Loop Invariant Code Motion #2
30; TIME-LEGACY-DAG:   Scalar Evolution Analysis
31; TIME-LEGACY-DAG:   Loop-Closed SSA Form Pass
32; TIME-LEGACY-DAG:   LCSSA Verifier
33; TIME-LEGACY-DAG:   Canonicalize natural loops
34; TIME-LEGACY-DAG:   Natural Loop Information
35; TIME-LEGACY-DAG:   Dominator Tree Construction
36; TIME-LEGACY-DAG:   Module Verifier
37; TIME-LEGACY-DAG:   Target Library Information
38; TIME-NEW-DAG:      InstCombinePass #1
39; TIME-NEW-DAG:      InstCombinePass #2
40; TIME-NEW-DAG:      InstCombinePass #3
41; TIME-NEW-DAG:      InstCombinePass #4
42; TIME-NEW-DAG:      LICMPass #1
43; TIME-NEW-DAG:      LICMPass #2
44; TIME-NEW-DAG:      LICMPass #3
45; TIME-DOUBLE-LICM-NEW-DAG:      LICMPass #4
46; TIME-DOUBLE-LICM-NEW-DAG:      LICMPass #5
47; TIME-DOUBLE-LICM-NEW-DAG:      LICMPass #6
48; TIME-NEW-DAG:      LCSSAPass
49; TIME-NEW-DAG:      LoopSimplifyPass
50; TIME-NEW-DAG:      ScalarEvolutionAnalysis
51; TIME-NEW-DAG:      LoopAnalysis
52; TIME-NEW-DAG:      VerifierPass
53; TIME-NEW-DAG:      DominatorTreeAnalysis
54; TIME-NEW-DAG:      TargetLibraryAnalysis
55; TIME-NEW-PER-PASS-DAG:   InstCombinePass
56; TIME-NEW-PER-PASS-DAG:   LICMPass
57; TIME-NEW-PER-PASS-DAG:   LCSSAPass
58; TIME-NEW-PER-PASS-DAG:   LoopSimplifyPass
59; TIME-NEW-PER-PASS-DAG:   ScalarEvolutionAnalysis
60; TIME-NEW-PER-PASS-DAG:   LoopAnalysis
61; TIME-NEW-PER-PASS-DAG:   VerifierPass
62; TIME-NEW-PER-PASS-DAG:   DominatorTreeAnalysis
63; TIME-NEW-PER-PASS-DAG:   TargetLibraryAnalysis
64; TIME-NEW-PER-PASS-NOT:   InstCombinePass #
65; TIME-NEW-PER-PASS-NOT:   LICMPass #
66; TIME-NEW-PER-PASS-NOT:   LCSSAPass #
67; TIME-NEW-PER-PASS-NOT:   LoopSimplifyPass #
68; TIME-NEW-PER-PASS-NOT:   ScalarEvolutionAnalysis #
69; TIME-NEW-PER-PASS-NOT:   LoopAnalysis #
70; TIME-NEW-PER-PASS-NOT:   VerifierPass #
71; TIME-NEW-PER-PASS-NOT:   DominatorTreeAnalysis #
72; TIME-NEW-PER-PASS-NOT:   TargetLibraryAnalysis #
73; TIME: Total{{$}}
74
75define i32 @foo() {
76  %res = add i32 5, 4
77  br label %loop1
78loop1:
79  br i1 false, label %loop1, label %end
80end:
81  ret i32 %res
82}
83
84define void @bar_with_loops() {
85  br label %loop1
86loop1:
87  br i1 false, label %loop1, label %loop2
88loop2:
89  br i1 true, label %loop2, label %end
90end:
91  ret void
92
93}
94