1; RUN: opt %loadPolly -polly-opt-isl -stats -disable-output < %s 2>&1 | FileCheck %s -match-full-lines 2 3; REQUIRES: asserts 4 5; void foo_1d(float *A) { 6; for (long i = 0; i < 1024; i++) 7; A[i] += i; 8; } 9; 10; void foo_2d(float *A) { 11; for (long i = 0; i < 1024; i++) 12; for (long j = 0; j < 1024; j++) 13; A[i + j] += i + j; 14; } 15; 16; void foo_3d(float *A) { 17; for (long i = 0; i < 1024; i++) 18; for (long j = 0; j < 1024; j++) 19; for (long k = 0; k < 1024; k++) 20; A[i + j + k] += i + j + k; 21; } 22; 23; void foo_4d(float *A) { 24; for (long i = 0; i < 1024; i++) 25; for (long j = 0; j < 1024; j++) 26; for (long k = 0; k < 1024; k++) 27; for (long l = 0; l < 1024; l++) 28; A[i + j + k + l] += i + j + k + l; 29; } 30; 31; void foo_zero_iterations(float *S) { 32; for (long i = 0; i < 0; i++) 33; A[i] += i; 34; } 35target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 36 37define void @foo_1d(float* %A) { 38bb: 39 br label %bb1 40 41bb1: ; preds = %bb6, %bb 42 %i.0 = phi i64 [ 0, %bb ], [ %tmp7, %bb6 ] 43 %exitcond = icmp ne i64 %i.0, 1024 44 br i1 %exitcond, label %bb2, label %bb8 45 46bb2: ; preds = %bb1 47 %tmp = sitofp i64 %i.0 to float 48 %tmp3 = getelementptr inbounds float, float* %A, i64 %i.0 49 %tmp4 = load float, float* %tmp3, align 4 50 %tmp5 = fadd float %tmp4, %tmp 51 store float %tmp5, float* %tmp3, align 4 52 br label %bb6 53 54bb6: ; preds = %bb2 55 %tmp7 = add nuw nsw i64 %i.0, 1 56 br label %bb1 57 58bb8: ; preds = %bb1 59 ret void 60} 61 62define void @foo_2d(float* %A) { 63bb: 64 br label %bb2 65 66bb2: ; preds = %bb14, %bb 67 %i.0 = phi i64 [ 0, %bb ], [ %tmp15, %bb14 ] 68 %exitcond1 = icmp ne i64 %i.0, 1024 69 br i1 %exitcond1, label %bb3, label %bb16 70 71bb3: ; preds = %bb2 72 br label %bb4 73 74bb4: ; preds = %bb11, %bb3 75 %j.0 = phi i64 [ 0, %bb3 ], [ %tmp12, %bb11 ] 76 %exitcond = icmp ne i64 %j.0, 1024 77 br i1 %exitcond, label %bb5, label %bb13 78 79bb5: ; preds = %bb4 80 %tmp = add nuw nsw i64 %i.0, %j.0 81 %tmp6 = sitofp i64 %tmp to float 82 %tmp7 = add nuw nsw i64 %i.0, %j.0 83 %tmp8 = getelementptr inbounds float, float* %A, i64 %tmp7 84 %tmp9 = load float, float* %tmp8, align 4 85 %tmp10 = fadd float %tmp9, %tmp6 86 store float %tmp10, float* %tmp8, align 4 87 br label %bb11 88 89bb11: ; preds = %bb5 90 %tmp12 = add nuw nsw i64 %j.0, 1 91 br label %bb4 92 93bb13: ; preds = %bb4 94 br label %bb14 95 96bb14: ; preds = %bb13 97 %tmp15 = add nuw nsw i64 %i.0, 1 98 br label %bb2 99 100bb16: ; preds = %bb2 101 ret void 102} 103 104define void @foo_3d(float* %A) { 105bb: 106 br label %bb3 107 108bb3: ; preds = %bb22, %bb 109 %i.0 = phi i64 [ 0, %bb ], [ %tmp23, %bb22 ] 110 %exitcond2 = icmp ne i64 %i.0, 1024 111 br i1 %exitcond2, label %bb4, label %bb24 112 113bb4: ; preds = %bb3 114 br label %bb5 115 116bb5: ; preds = %bb19, %bb4 117 %j.0 = phi i64 [ 0, %bb4 ], [ %tmp20, %bb19 ] 118 %exitcond1 = icmp ne i64 %j.0, 1024 119 br i1 %exitcond1, label %bb6, label %bb21 120 121bb6: ; preds = %bb5 122 br label %bb7 123 124bb7: ; preds = %bb16, %bb6 125 %k.0 = phi i64 [ 0, %bb6 ], [ %tmp17, %bb16 ] 126 %exitcond = icmp ne i64 %k.0, 1024 127 br i1 %exitcond, label %bb8, label %bb18 128 129bb8: ; preds = %bb7 130 %tmp = add nuw nsw i64 %i.0, %j.0 131 %tmp9 = add nuw nsw i64 %tmp, %k.0 132 %tmp10 = sitofp i64 %tmp9 to float 133 %tmp11 = add nuw nsw i64 %i.0, %j.0 134 %tmp12 = add nuw nsw i64 %tmp11, %k.0 135 %tmp13 = getelementptr inbounds float, float* %A, i64 %tmp12 136 %tmp14 = load float, float* %tmp13, align 4 137 %tmp15 = fadd float %tmp14, %tmp10 138 store float %tmp15, float* %tmp13, align 4 139 br label %bb16 140 141bb16: ; preds = %bb8 142 %tmp17 = add nuw nsw i64 %k.0, 1 143 br label %bb7 144 145bb18: ; preds = %bb7 146 br label %bb19 147 148bb19: ; preds = %bb18 149 %tmp20 = add nuw nsw i64 %j.0, 1 150 br label %bb5 151 152bb21: ; preds = %bb5 153 br label %bb22 154 155bb22: ; preds = %bb21 156 %tmp23 = add nuw nsw i64 %i.0, 1 157 br label %bb3 158 159bb24: ; preds = %bb3 160 ret void 161} 162 163define void @foo_4d(float* %A) { 164bb: 165 br label %bb4 166 167bb4: ; preds = %bb30, %bb 168 %i.0 = phi i64 [ 0, %bb ], [ %tmp31, %bb30 ] 169 %exitcond3 = icmp ne i64 %i.0, 1024 170 br i1 %exitcond3, label %bb5, label %bb32 171 172bb5: ; preds = %bb4 173 br label %bb6 174 175bb6: ; preds = %bb27, %bb5 176 %j.0 = phi i64 [ 0, %bb5 ], [ %tmp28, %bb27 ] 177 %exitcond2 = icmp ne i64 %j.0, 1024 178 br i1 %exitcond2, label %bb7, label %bb29 179 180bb7: ; preds = %bb6 181 br label %bb8 182 183bb8: ; preds = %bb24, %bb7 184 %k.0 = phi i64 [ 0, %bb7 ], [ %tmp25, %bb24 ] 185 %exitcond1 = icmp ne i64 %k.0, 1024 186 br i1 %exitcond1, label %bb9, label %bb26 187 188bb9: ; preds = %bb8 189 br label %bb10 190 191bb10: ; preds = %bb21, %bb9 192 %l.0 = phi i64 [ 0, %bb9 ], [ %tmp22, %bb21 ] 193 %exitcond = icmp ne i64 %l.0, 1024 194 br i1 %exitcond, label %bb11, label %bb23 195 196bb11: ; preds = %bb10 197 %tmp = add nuw nsw i64 %i.0, %j.0 198 %tmp12 = add nuw nsw i64 %tmp, %k.0 199 %tmp13 = add nuw nsw i64 %tmp12, %l.0 200 %tmp14 = sitofp i64 %tmp13 to float 201 %tmp15 = add nuw nsw i64 %i.0, %j.0 202 %tmp16 = add nuw nsw i64 %tmp15, %k.0 203 %tmp17 = add nuw nsw i64 %tmp16, %l.0 204 %tmp18 = getelementptr inbounds float, float* %A, i64 %tmp17 205 %tmp19 = load float, float* %tmp18, align 4 206 %tmp20 = fadd float %tmp19, %tmp14 207 store float %tmp20, float* %tmp18, align 4 208 br label %bb21 209 210bb21: ; preds = %bb11 211 %tmp22 = add nuw nsw i64 %l.0, 1 212 br label %bb10 213 214bb23: ; preds = %bb10 215 br label %bb24 216 217bb24: ; preds = %bb23 218 %tmp25 = add nuw nsw i64 %k.0, 1 219 br label %bb8 220 221bb26: ; preds = %bb8 222 br label %bb27 223 224bb27: ; preds = %bb26 225 %tmp28 = add nuw nsw i64 %j.0, 1 226 br label %bb6 227 228bb29: ; preds = %bb6 229 br label %bb30 230 231bb30: ; preds = %bb29 232 %tmp31 = add nuw nsw i64 %i.0, 1 233 br label %bb4 234 235bb32: ; preds = %bb4 236 ret void 237} 238 239define void @foo_zero_iterations(float* %A) { 240bb: 241 br label %bb1 242 243bb1: ; preds = %bb6, %bb 244 %i.0 = phi i64 [ 0, %bb ], [ %tmp7, %bb6 ] 245 %exitcond = icmp ne i64 %i.0, 0 246 br i1 %exitcond, label %bb2, label %bb8 247 248bb2: ; preds = %bb1 249 %tmp = sitofp i64 %i.0 to float 250 %tmp3 = getelementptr inbounds float, float* %A, i64 %i.0 251 %tmp4 = load float, float* %tmp3, align 4 252 %tmp5 = fadd float %tmp4, %tmp 253 store float %tmp5, float* %tmp3, align 4 254 br label %bb6 255 256bb6: ; preds = %bb2 257 %tmp7 = add nuw nsw i64 %i.0, 1 258 br label %bb1 259 260bb8: ; preds = %bb1 261 ret void 262} 263 264 265; CHECK-DAG: 1 polly-opt-isl - Number of first level tiling applied 266; CHECK-DAG: 9 polly-opt-isl - Number of affine loops optimized 267; CHECK-DAG: 10 polly-opt-isl - Number of band members (original) 268; CHECK-DAG: 10 polly-opt-isl - Number of band members (after scheduler) 269; CHECK-DAG: 12 polly-opt-isl - Number of band members (after optimizer) 270; CHECK-DAG: 10 polly-opt-isl - Number of bands (original) 271; CHECK-DAG: 7 polly-opt-isl - Number of bands (after scheduler) 272; CHECK-DAG: 8 polly-opt-isl - Number of bands (after optimizer) 273; CHECK-DAG: 4 polly-opt-isl - Number of coincident band members (after scheduler) 274; CHECK-DAG: 5 polly-opt-isl - Number of coincident band members (after optimizer) 275; CHECK-DAG: 7 polly-opt-isl - Number of permutable bands (after scheduler) 276; CHECK-DAG: 8 polly-opt-isl - Number of permutable bands (after optimizer) 277; CHECK-DAG: 3 polly-opt-isl - Number of scops optimized 278; CHECK-DAG: 4 polly-opt-isl - Number of scops processed 279; CHECK-DAG: 4 polly-opt-isl - Number of scops rescheduled 280