1 ; RUN: opt %loadPolly -polly-scops -analyze -polly-allow-modref-calls \
2 ; RUN: < %s | FileCheck %s
3 ; RUN: opt %loadPolly -polly-scops -polly-allow-nonaffine \
4 ; RUN: -polly-allow-modref-calls -analyze < %s | FileCheck %s --check-prefix=NONAFFINE
6 ; TODO: We should delinearize the accesses despite the use in a call to a
7 ; readonly function. For now we verify we do not delinearize them though.
10 ; CHECK-NEXT: Region: %bb12---%bb28
11 ; CHECK-NEXT: Max Loop Depth: 1
12 ; CHECK-NEXT: Invariant Accesses: {
13 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
14 ; CHECK-NEXT: [tmp14, p_1] -> { Stmt_bb12[] -> MemRef_arg1[0] };
15 ; CHECK-NEXT: Execution Context: [tmp14, p_1] -> { : }
17 ; CHECK-NEXT: Context:
18 ; CHECK-NEXT: [tmp14, p_1] -> { : -9223372036854775808 <= tmp14 <= 9223372036854775807 and -9223372036854775808 <= p_1 <= 9223372036854775807 }
19 ; CHECK-NEXT: Assumed Context:
20 ; CHECK-NEXT: [tmp14, p_1] -> { : }
21 ; CHECK-NEXT: Invalid Context:
22 ; CHECK-NEXT: [tmp14, p_1] -> { : tmp14 > 0 and (p_1 <= -1152921504606846977 or tmp14 >= 1152921504606846977 or p_1 >= 1152921504606846977 - tmp14) }
23 ; CHECK-NEXT: p0: %tmp14
24 ; CHECK-NEXT: p1: {0,+,(0 smax %tmp)}<%bb12>
25 ; CHECK-NEXT: Arrays {
26 ; CHECK-NEXT: i64 MemRef_tmp13; // Element size 8
27 ; CHECK-NEXT: i64 MemRef_arg1[*]; // Element size 8
28 ; CHECK-NEXT: [1000 x double]* MemRef_arg4[*]; // Element size 8
30 ; CHECK-NEXT: Arrays (Bounds as pw_affs) {
31 ; CHECK-NEXT: i64 MemRef_tmp13; // Element size 8
32 ; CHECK-NEXT: i64 MemRef_arg1[*]; // Element size 8
33 ; CHECK-NEXT: [1000 x double]* MemRef_arg4[*]; // Element size 8
35 ; CHECK-NEXT: Alias Groups (0):
37 ; CHECK-NEXT: Statements {
38 ; CHECK-NEXT: Stmt_bb12
39 ; CHECK-NEXT: Domain :=
40 ; CHECK-NEXT: [tmp14, p_1] -> { Stmt_bb12[] };
41 ; CHECK-NEXT: Schedule :=
42 ; CHECK-NEXT: [tmp14, p_1] -> { Stmt_bb12[] -> [0, 0] };
43 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
44 ; CHECK-NEXT: [tmp14, p_1] -> { Stmt_bb12[] -> MemRef_tmp13[] };
45 ; CHECK-NEXT: Stmt_bb17
46 ; CHECK-NEXT: Domain :=
47 ; CHECK-NEXT: [tmp14, p_1] -> { Stmt_bb17[i0] : 0 <= i0 < tmp14 };
48 ; CHECK-NEXT: Schedule :=
49 ; CHECK-NEXT: [tmp14, p_1] -> { Stmt_bb17[i0] -> [1, i0] };
50 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
51 ; CHECK-NEXT: [tmp14, p_1] -> { Stmt_bb17[i0] -> MemRef_arg4[o0] };
52 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
53 ; CHECK-NEXT: [tmp14, p_1] -> { Stmt_bb17[i0] -> MemRef_arg4[p_1 + i0] };
57 ; NONAFFINE: Function: ham
58 ; NONAFFINE-NEXT: Region: %bb5---%bb32
59 ; NONAFFINE-NEXT: Max Loop Depth: 2
60 ; NONAFFINE-NEXT: Invariant Accesses: {
61 ; NONAFFINE-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
62 ; NONAFFINE-NEXT: [tmp9, tmp14] -> { Stmt_bb5[] -> MemRef_arg[0] };
63 ; NONAFFINE-NEXT: Execution Context: [tmp9, tmp14] -> { : }
64 ; NONAFFINE-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
65 ; NONAFFINE-NEXT: [tmp9, tmp14] -> { Stmt_bb12[i0] -> MemRef_arg1[0] };
66 ; NONAFFINE-NEXT: Execution Context: [tmp9, tmp14] -> { : }
68 ; NONAFFINE-NEXT: Context:
69 ; NONAFFINE-NEXT: [tmp9, tmp14] -> { : -9223372036854775808 <= tmp9 <= 9223372036854775807 and -9223372036854775808 <= tmp14 <= 9223372036854775807 }
70 ; NONAFFINE-NEXT: Assumed Context:
71 ; NONAFFINE-NEXT: [tmp9, tmp14] -> { : }
72 ; NONAFFINE-NEXT: Invalid Context:
73 ; NONAFFINE-NEXT: [tmp9, tmp14] -> { : 1 = 0 }
74 ; NONAFFINE-NEXT: p0: %tmp9
75 ; NONAFFINE-NEXT: p1: %tmp14
76 ; NONAFFINE-NEXT: Arrays {
77 ; NONAFFINE-NEXT: i64 MemRef_arg1[*]; // Element size 8
78 ; NONAFFINE-NEXT: i64 MemRef_arg[*]; // Element size 8
79 ; NONAFFINE-NEXT: i64 MemRef_tmp7; // Element size 8
80 ; NONAFFINE-NEXT: i64 MemRef_tmp8; // Element size 8
81 ; NONAFFINE-NEXT: [1000 x double]* MemRef_arg4[*]; // Element size 8
83 ; NONAFFINE-NEXT: Arrays (Bounds as pw_affs) {
84 ; NONAFFINE-NEXT: i64 MemRef_arg1[*]; // Element size 8
85 ; NONAFFINE-NEXT: i64 MemRef_arg[*]; // Element size 8
86 ; NONAFFINE-NEXT: i64 MemRef_tmp7; // Element size 8
87 ; NONAFFINE-NEXT: i64 MemRef_tmp8; // Element size 8
88 ; NONAFFINE-NEXT: [1000 x double]* MemRef_arg4[*]; // Element size 8
90 ; NONAFFINE-NEXT: Alias Groups (0):
92 ; NONAFFINE-NEXT: Statements {
93 ; NONAFFINE-NEXT: Stmt_bb5
94 ; NONAFFINE-NEXT: Domain :=
95 ; NONAFFINE-NEXT: [tmp9, tmp14] -> { Stmt_bb5[] };
96 ; NONAFFINE-NEXT: Schedule :=
97 ; NONAFFINE-NEXT: [tmp9, tmp14] -> { Stmt_bb5[] -> [0, 0, 0] };
98 ; NONAFFINE-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
99 ; NONAFFINE-NEXT: [tmp9, tmp14] -> { Stmt_bb5[] -> MemRef_tmp7[] };
100 ; NONAFFINE-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
101 ; NONAFFINE-NEXT: [tmp9, tmp14] -> { Stmt_bb5[] -> MemRef_tmp8[] };
102 ; NONAFFINE-NEXT: Stmt_bb17
103 ; NONAFFINE-NEXT: Domain :=
104 ; NONAFFINE-NEXT: [tmp9, tmp14] -> { Stmt_bb17[i0, i1] : 0 <= i0 < tmp9 and 0 <= i1 < tmp14 };
105 ; NONAFFINE-NEXT: Schedule :=
106 ; NONAFFINE-NEXT: [tmp9, tmp14] -> { Stmt_bb17[i0, i1] -> [1, i0, i1] };
107 ; NONAFFINE-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
108 ; NONAFFINE-NEXT: [tmp9, tmp14] -> { Stmt_bb17[i0, i1] -> MemRef_tmp7[] };
109 ; NONAFFINE-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
110 ; NONAFFINE-NEXT: [tmp9, tmp14] -> { Stmt_bb17[i0, i1] -> MemRef_tmp8[] };
111 ; NONAFFINE-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
112 ; NONAFFINE-NEXT: [tmp9, tmp14] -> { Stmt_bb17[i0, i1] -> MemRef_arg4[o0] };
113 ; NONAFFINE-NEXT: MayWriteAccess := [Reduction Type: NONE] [Scalar: 0]
114 ; NONAFFINE-NEXT: [tmp9, tmp14] -> { Stmt_bb17[i0, i1] -> MemRef_arg4[o0] : -1152921504606846976 <= o0 <= 1152921504606846975 };
117 target datalayout = "e-p:64:64:64-S128-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:128:128-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
119 define void @ham(i64* noalias %arg, i64* noalias %arg1, i64* noalias %arg2, i64* noalias %arg3, [1000 x double]* noalias %arg4) gc "dummy" {
124 %tmp = load i64, i64* %arg1, align 8
125 %tmp6 = icmp slt i64 %tmp, 0
126 %tmp7 = select i1 %tmp6, i64 0, i64 %tmp
127 %tmp8 = xor i64 %tmp7, -1
128 %tmp9 = load i64, i64* %arg, align 8
129 %tmp10 = icmp sgt i64 %tmp9, 0
130 br i1 %tmp10, label %bb11, label %bb32
135 bb12: ; preds = %bb28, %bb11
136 %tmp13 = phi i64 [ %tmp30, %bb28 ], [ 1, %bb11 ]
137 %tmp14 = load i64, i64* %arg1, align 8
138 %tmp15 = icmp sgt i64 %tmp14, 0
139 br i1 %tmp15, label %bb16, label %bb28
141 bb16: ; preds = %bb12
144 bb17: ; preds = %bb17, %bb16
145 %tmp18 = phi i64 [ %tmp26, %bb17 ], [ 1, %bb16 ]
146 %tmp19 = mul i64 %tmp13, %tmp7
147 %tmp20 = add i64 %tmp19, %tmp8
148 %tmp21 = add i64 %tmp20, %tmp18
149 %tmp22 = add i64 %tmp18, %tmp13
150 %tmp23 = sitofp i64 %tmp22 to double
151 %tmp24 = getelementptr [1000 x double], [1000 x double]* %arg4, i64 0, i64 %tmp21
152 %bc = bitcast double* %tmp24 to i8*
153 %dummy = call i8* @llvm.gcread(i8* %bc, i8** null)
154 store double %tmp23, double* %tmp24, align 8
155 %tmp25 = icmp eq i64 %tmp18, %tmp14
156 %tmp26 = add i64 %tmp18, 1
157 br i1 %tmp25, label %bb27, label %bb17
159 bb27: ; preds = %bb17
162 bb28: ; preds = %bb27, %bb12
163 %tmp29 = icmp eq i64 %tmp13, %tmp9
164 %tmp30 = add i64 %tmp13, 1
165 br i1 %tmp29, label %bb31, label %bb12
167 bb31: ; preds = %bb28
170 bb32: ; preds = %bb31, %bb5
174 declare i8* @llvm.gcread(i8*, i8**)