blob: bb338d42253afdef6dac5694458fddb3cb0cd31e [file] [log] [blame]
Chandler Carruth52eef882014-01-12 12:15:39 +00001; This test is essentially doing very basic things with the opt tool and the
2; new pass manager pipeline. It will be used to flesh out the feature
3; completeness of the opt tool when the new pass manager is engaged. The tests
4; may not be useful once it becomes the default or may get spread out into other
5; files, but for now this is just going to step the new process through its
6; paces.
7
8; RUN: opt -disable-output -debug-pass-manager -passes=print %s 2>&1 \
9; RUN: | FileCheck %s --check-prefix=CHECK-MODULE-PRINT
10; CHECK-MODULE-PRINT: Starting module pass manager
Chandler Carruth4d356312014-01-20 11:34:08 +000011; CHECK-MODULE-PRINT: Running module pass: VerifierPass
Chandler Carruth52eef882014-01-12 12:15:39 +000012; CHECK-MODULE-PRINT: Running module pass: PrintModulePass
13; CHECK-MODULE-PRINT: ModuleID
14; CHECK-MODULE-PRINT: define void @foo()
Chandler Carruth4d356312014-01-20 11:34:08 +000015; CHECK-MODULE-PRINT: Running module pass: VerifierPass
Chandler Carruth52eef882014-01-12 12:15:39 +000016; CHECK-MODULE-PRINT: Finished module pass manager
17
Chandler Carruth9c31db42015-01-05 00:08:53 +000018; RUN: opt -disable-output -debug-pass-manager -disable-verify -passes='print,verify' %s 2>&1 \
19; RUN: | FileCheck %s --check-prefix=CHECK-MODULE-VERIFY
20; CHECK-MODULE-VERIFY: Starting module pass manager
21; CHECK-MODULE-VERIFY: Running module pass: PrintModulePass
22; CHECK-MODULE-VERIFY: ModuleID
23; CHECK-MODULE-VERIFY: define void @foo()
24; CHECK-MODULE-VERIFY: Running module pass: VerifierPass
25; CHECK-MODULE-VERIFY: Finished module pass manager
26
Chandler Carruth52eef882014-01-12 12:15:39 +000027; RUN: opt -disable-output -debug-pass-manager -passes='function(print)' %s 2>&1 \
28; RUN: | FileCheck %s --check-prefix=CHECK-FUNCTION-PRINT
29; CHECK-FUNCTION-PRINT: Starting module pass manager
Chandler Carruth4d356312014-01-20 11:34:08 +000030; CHECK-FUNCTION-PRINT: Running module pass: VerifierPass
Chandler Carruthe5e8fb32015-01-05 12:21:44 +000031; CHECK-FUNCTION-PRINT: Running module pass: ModuleToFunctionPassAdaptor
32; CHECK-FUNCTION-PRINT: Running module analysis: FunctionAnalysisManagerModuleProxy
Chandler Carruth52eef882014-01-12 12:15:39 +000033; CHECK-FUNCTION-PRINT: Starting function pass manager
34; CHECK-FUNCTION-PRINT: Running function pass: PrintFunctionPass
35; CHECK-FUNCTION-PRINT-NOT: ModuleID
36; CHECK-FUNCTION-PRINT: define void @foo()
37; CHECK-FUNCTION-PRINT: Finished function pass manager
Chandler Carruth4d356312014-01-20 11:34:08 +000038; CHECK-FUNCTION-PRINT: Running module pass: VerifierPass
Chandler Carruth52eef882014-01-12 12:15:39 +000039; CHECK-FUNCTION-PRINT: Finished module pass manager
40
Chandler Carruth9c31db42015-01-05 00:08:53 +000041; RUN: opt -disable-output -debug-pass-manager -disable-verify -passes='function(print,verify)' %s 2>&1 \
42; RUN: | FileCheck %s --check-prefix=CHECK-FUNCTION-VERIFY
43; CHECK-FUNCTION-VERIFY: Starting module pass manager
44; CHECK-FUNCTION-VERIFY: Starting function pass manager
45; CHECK-FUNCTION-VERIFY: Running function pass: PrintFunctionPass
46; CHECK-FUNCTION-VERIFY-NOT: ModuleID
47; CHECK-FUNCTION-VERIFY: define void @foo()
48; CHECK-FUNCTION-VERIFY: Running function pass: VerifierPass
49; CHECK-FUNCTION-VERIFY: Finished function pass manager
50; CHECK-FUNCTION-VERIFY: Finished module pass manager
51
Chandler Carruthb353c3f2014-01-13 05:16:45 +000052; RUN: opt -S -o - -passes='no-op-module,no-op-module' %s \
53; RUN: | FileCheck %s --check-prefix=CHECK-NOOP
54; CHECK-NOOP: define void @foo() {
55; CHECK-NOOP: ret void
56; CHECK-NOOP: }
57
Chandler Carruthb7bdfd62014-01-13 07:38:24 +000058; Round trip through bitcode.
59; RUN: opt -f -o - -passes='no-op-module,no-op-module' %s \
60; RUN: | llvm-dis \
61; RUN: | FileCheck %s --check-prefix=CHECK-NOOP
62
Chandler Carruth4d356312014-01-20 11:34:08 +000063; RUN: opt -disable-output -debug-pass-manager -verify-each -passes='no-op-module,function(no-op-function)' %s 2>&1 \
64; RUN: | FileCheck %s --check-prefix=CHECK-VERIFY-EACH
65; CHECK-VERIFY-EACH: Starting module pass manager
66; CHECK-VERIFY-EACH: Running module pass: VerifierPass
67; CHECK-VERIFY-EACH: Running module pass: NoOpModulePass
68; CHECK-VERIFY-EACH: Running module pass: VerifierPass
69; CHECK-VERIFY-EACH: Starting function pass manager
70; CHECK-VERIFY-EACH: Running function pass: NoOpFunctionPass
71; CHECK-VERIFY-EACH: Running function pass: VerifierPass
72; CHECK-VERIFY-EACH: Finished function pass manager
73; CHECK-VERIFY-EACH: Running module pass: VerifierPass
74; CHECK-VERIFY-EACH: Finished module pass manager
75
76; RUN: opt -disable-output -debug-pass-manager -disable-verify -passes='no-op-module,function(no-op-function)' %s 2>&1 \
77; RUN: | FileCheck %s --check-prefix=CHECK-NO-VERIFY
78; CHECK-NO-VERIFY: Starting module pass manager
79; CHECK-NO-VERIFY-NOT: VerifierPass
80; CHECK-NO-VERIFY: Running module pass: NoOpModulePass
81; CHECK-NO-VERIFY-NOT: VerifierPass
82; CHECK-NO-VERIFY: Starting function pass manager
83; CHECK-NO-VERIFY: Running function pass: NoOpFunctionPass
84; CHECK-NO-VERIFY-NOT: VerifierPass
85; CHECK-NO-VERIFY: Finished function pass manager
86; CHECK-NO-VERIFY-NOT: VerifierPass
87; CHECK-NO-VERIFY: Finished module pass manager
88
Chandler Carruthe5e8fb32015-01-05 12:21:44 +000089; RUN: opt -disable-output -debug-pass-manager -debug-cgscc-pass-manager -passes='cgscc(no-op-cgscc)' %s 2>&1 \
90; RUN: | FileCheck %s --check-prefix=CHECK-LCG-ANALYSIS
91; CHECK-LCG-ANALYSIS: Starting module pass manager
92; CHECK-LCG-ANALYSIS: Running module pass: ModuleToPostOrderCGSCCPassAdaptor
93; CHECK-LCG-ANALYSIS: Running module analysis: CGSCCAnalysisManagerModuleProxy
94; CHECK-LCG-ANALYSIS: Running module analysis: Lazy CallGraph Analysis
95; CHECK-LCG-ANALYSIS: Starting CGSCC pass manager run.
96
Chandler Carruth539dc4b2015-01-05 12:32:11 +000097; Make sure no-op passes that preserve all analyses don't even try to do any
98; analysis invalidation.
99; RUN: opt -disable-output -debug-pass-manager -debug-cgscc-pass-manager -passes='cgscc(function(no-op-function))' %s 2>&1 \
100; RUN: | FileCheck %s --check-prefix=CHECK-NO-OP-INVALIDATION
101; CHECK-NO-OP-INVALIDATION: Starting module pass manager
102; CHECK-NO-OP-INVALIDATION-NOT: Invalidating all non-preserved analyses
103
Chandler Carruth52eef882014-01-12 12:15:39 +0000104define void @foo() {
105 ret void
106}