1; Legacy pass manager
2; RUN: opt %loadPolly -enable-new-pm=0 -O3 -polly -polly-position=early             -polly-dump-before-file=%t-legacy-before-early.ll --disable-output < %s && FileCheck --input-file=%t-legacy-before-early.ll --check-prefix=EARLY  %s
3; RUN: opt %loadPolly -enable-new-pm=0 -O3 -polly -polly-position=before-vectorizer -polly-dump-before-file=%t-legacy-before-late.ll  --disable-output < %s && FileCheck --input-file=%t-legacy-before-late.ll  --check-prefix=LATE   %s
4; RUN: opt %loadPolly -enable-new-pm=0 -O3 -polly -polly-position=early             -polly-dump-after-file=%t-legacy-after-early.ll   --disable-output < %s && FileCheck --input-file=%t-legacy-after-early.ll  --check-prefix=EARLY --check-prefix=AFTEREARLY %s
5; RUN: opt %loadPolly -enable-new-pm=0 -O3 -polly -polly-position=before-vectorizer -polly-dump-after-file=%t-legacy-after-late.ll    --disable-output < %s && FileCheck --input-file=%t-legacy-after-late.ll   --check-prefix=LATE  --check-prefix=AFTERLATE  %s
6;
7; New pass manager
8; RUN: opt %loadNPMPolly -enable-new-pm=1 -O3 -polly -polly-position=early             -polly-dump-before-file=%t-npm-before-early.ll    --disable-output < %s && FileCheck --input-file=%t-npm-before-early.ll    --check-prefix=EARLY %s
9; RUN: opt %loadNPMPolly -enable-new-pm=1 -O3 -polly -polly-position=early             -polly-dump-after-file=%t-npm-after-early.ll      --disable-output < %s && FileCheck --input-file=%t-npm-after-early.ll     --check-prefix=EARLY --check-prefix=AFTEREARLY %s
10;
11; Check the module dumping before Polly at specific positions in the
12; pass pipeline.
13;
14; void callee(int n, double A[], int i) {
15;   for (int j = 0; j < n; j += 1)
16;     A[i+j] = 42.0;
17; }
18;
19; void caller(int n, double A[]) {
20;   for (int i = 0; i < n; i += 1)
21;     callee(n, A, i);
22; }
23
24
25define internal void @callee(i32 %n, double* noalias nonnull %A, i32 %i) {
26entry:
27  br label %for
28
29for:
30  %j = phi i32 [0, %entry], [%j.inc, %inc]
31  %j.cmp = icmp slt i32 %j, %n
32  br i1 %j.cmp, label %body, label %exit
33
34    body:
35      %idx = add i32 %i, %j
36      %arrayidx = getelementptr inbounds double, double* %A, i32 %idx
37      store double 42.0, double* %arrayidx
38      br label %inc
39
40inc:
41  %j.inc = add nuw nsw i32 %j, 1
42  br label %for
43
44exit:
45  br label %return
46
47return:
48  ret void
49}
50
51
52define void @caller(i32 %n, double* noalias nonnull %A) {
53entry:
54  br label %for
55
56for:
57  %i = phi i32 [0, %entry], [%j.inc, %inc]
58  %i.cmp = icmp slt i32 %i, %n
59  br i1 %i.cmp, label %body, label %exit
60
61    body:
62      call void @callee(i32 %n, double* %A, i32 %i)
63      br label %inc
64
65inc:
66  %j.inc = add nuw nsw i32 %i, 1
67  br label %for
68
69exit:
70  br label %return
71
72return:
73  ret void
74}
75
76
77; EARLY-LABEL: @callee(
78; AFTEREARLY:  polly.split_new_and_old:
79; EARLY:         store double 4.200000e+01, double* %arrayidx
80; EARLY-LABEL: @caller(
81; EARLY:         call void @callee(
82
83; LATE-LABEL: @caller(
84; AFTERLATE:  polly.split_new_and_old:
85; LATE:          store double 4.200000e+01, double* %arrayidx
86