1; RUN: opt %loadPolly -polly-analysis-computeout=0 -polly-scops -polly-rtc-max-parameters=8 -analyze < %s | FileCheck %s --check-prefix=MAX8
2; RUN: opt %loadPolly -polly-analysis-computeout=0 -polly-scops -polly-rtc-max-parameters=7 -analyze < %s | FileCheck %s --check-prefix=MAX7
3;
4; Check that we allow this SCoP even though it has 10 parameters involved in posisbly aliasing accesses.
5; However, only 7 are involved in accesses through B, 8 through C and none in accesses through A.
6;
7; MAX8-LABEL:  Function: jd
8; MAX8-NEXT: Region: %for.cond---%for.end
9
10; MAX7:  Invalid Scop!
11;
12;    void jd(int *A, int *B, int *C, long p1, long p2, long p3, long p4, long p5,
13;            long p6, long p7, long p8, long p9, long p10) {
14;      for (int i = 0; i < 1024; i++)
15;        A[i] = B[p1] - B[p2] + B[-p3] - B[p4] + B[p5] - B[-p6] + B[p7] - C[p3] +
16;               C[-p4] - C[p5] + C[p6] - C[-p7] + C[p8] - C[p9] + C[-p10];
17;    }
18;
19target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
20
21define void @jd(i32* %A, i32* %B, i32* %C, i64 %p1, i64 %p2, i64 %p3, i64 %p4, i64 %p5, i64 %p6, i64 %p7, i64 %p8, i64 %p9, i64 %p10) {
22entry:
23  br label %for.cond
24
25for.cond:                                         ; preds = %for.inc, %entry
26  %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
27  %exitcond = icmp ne i64 %indvars.iv, 1024
28  br i1 %exitcond, label %for.body, label %for.end
29
30for.body:                                         ; preds = %for.cond
31  %arrayidx = getelementptr inbounds i32, i32* %B, i64 %p1
32  %tmp = load i32, i32* %arrayidx, align 4
33  %arrayidx1 = getelementptr inbounds i32, i32* %B, i64 %p2
34  %tmp1 = load i32, i32* %arrayidx1, align 4
35  %sub = sub nsw i32 %tmp, %tmp1
36  %sub2 = sub nsw i64 0, %p3
37  %arrayidx3 = getelementptr inbounds i32, i32* %B, i64 %sub2
38  %tmp2 = load i32, i32* %arrayidx3, align 4
39  %add = add nsw i32 %sub, %tmp2
40  %arrayidx4 = getelementptr inbounds i32, i32* %B, i64 %p4
41  %tmp3 = load i32, i32* %arrayidx4, align 4
42  %sub5 = sub nsw i32 %add, %tmp3
43  %arrayidx6 = getelementptr inbounds i32, i32* %B, i64 %p5
44  %tmp4 = load i32, i32* %arrayidx6, align 4
45  %add7 = add nsw i32 %sub5, %tmp4
46  %sub8 = sub nsw i64 0, %p6
47  %arrayidx9 = getelementptr inbounds i32, i32* %B, i64 %sub8
48  %tmp5 = load i32, i32* %arrayidx9, align 4
49  %sub10 = sub nsw i32 %add7, %tmp5
50  %arrayidx11 = getelementptr inbounds i32, i32* %B, i64 %p7
51  %tmp6 = load i32, i32* %arrayidx11, align 4
52  %add12 = add nsw i32 %sub10, %tmp6
53  %arrayidx13 = getelementptr inbounds i32, i32* %C, i64 %p3
54  %tmp7 = load i32, i32* %arrayidx13, align 4
55  %sub14 = sub nsw i32 %add12, %tmp7
56  %sub15 = sub nsw i64 0, %p4
57  %arrayidx16 = getelementptr inbounds i32, i32* %C, i64 %sub15
58  %tmp8 = load i32, i32* %arrayidx16, align 4
59  %add17 = add nsw i32 %sub14, %tmp8
60  %arrayidx18 = getelementptr inbounds i32, i32* %C, i64 %p5
61  %tmp9 = load i32, i32* %arrayidx18, align 4
62  %sub19 = sub nsw i32 %add17, %tmp9
63  %arrayidx20 = getelementptr inbounds i32, i32* %C, i64 %p6
64  %tmp10 = load i32, i32* %arrayidx20, align 4
65  %add21 = add nsw i32 %sub19, %tmp10
66  %sub22 = sub nsw i64 0, %p7
67  %arrayidx23 = getelementptr inbounds i32, i32* %C, i64 %sub22
68  %tmp11 = load i32, i32* %arrayidx23, align 4
69  %sub24 = sub nsw i32 %add21, %tmp11
70  %arrayidx25 = getelementptr inbounds i32, i32* %C, i64 %p8
71  %tmp12 = load i32, i32* %arrayidx25, align 4
72  %add26 = add nsw i32 %sub24, %tmp12
73  %arrayidx27 = getelementptr inbounds i32, i32* %C, i64 %p9
74  %tmp13 = load i32, i32* %arrayidx27, align 4
75  %sub28 = sub nsw i32 %add26, %tmp13
76  %sub29 = sub nsw i64 0, %p10
77  %arrayidx30 = getelementptr inbounds i32, i32* %C, i64 %sub29
78  %tmp14 = load i32, i32* %arrayidx30, align 4
79  %add31 = add nsw i32 %sub28, %tmp14
80  %arrayidx32 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
81  store i32 %add31, i32* %arrayidx32, align 4
82  br label %for.inc
83
84for.inc:                                          ; preds = %for.body
85  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
86  br label %for.cond
87
88for.end:                                          ; preds = %for.cond
89  ret void
90}
91