1; RUN: opt < %s -analyze -basicaa -da | FileCheck %s 2 3target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" 4target triple = "thumbv8m.main-arm-none-eabi" 5 6; CHECK-LABEL: t1 7;; for (int i = 0; i < n; i++) 8;; for (int j = 0; j < m; j++) 9;; for (int k = 0; k < o; k++) 10;; = A[i*m*o + j*o + k] 11;; A[i*m*o + j*o + k] = 12define void @t1(i32 %n, i32 %m, i32 %o, i32* nocapture %A) { 13; CHECK: da analyze - none! 14; CHECK: da analyze - consistent anti [0 0 0|<]! 15; CHECK: da analyze - none! 16entry: 17 %cmp49 = icmp sgt i32 %n, 0 18 br i1 %cmp49, label %for.cond1.preheader.lr.ph, label %for.cond.cleanup 19 20for.cond1.preheader.lr.ph: ; preds = %entry 21 %cmp247 = icmp sgt i32 %m, 0 22 %cmp645 = icmp sgt i32 %o, 0 23 br label %for.cond1.preheader 24 25for.cond1.preheader: ; preds = %for.cond.cleanup3, %for.cond1.preheader.lr.ph 26 %i.050 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %inc23, %for.cond.cleanup3 ] 27 br i1 %cmp247, label %for.cond5.preheader.lr.ph, label %for.cond.cleanup3 28 29for.cond5.preheader.lr.ph: ; preds = %for.cond1.preheader 30 %mul = mul nsw i32 %i.050, %m 31 br label %for.cond5.preheader 32 33for.cond5.preheader: ; preds = %for.cond.cleanup7, %for.cond5.preheader.lr.ph 34 %j.048 = phi i32 [ 0, %for.cond5.preheader.lr.ph ], [ %inc20, %for.cond.cleanup7 ] 35 br i1 %cmp645, label %for.body8.lr.ph, label %for.cond.cleanup7 36 37for.body8.lr.ph: ; preds = %for.cond5.preheader 38 %mul944 = add i32 %j.048, %mul 39 %add = mul i32 %mul944, %o 40 br label %for.body8 41 42for.body8: ; preds = %for.body8, %for.body8.lr.ph 43 %k.046 = phi i32 [ 0, %for.body8.lr.ph ], [ %inc, %for.body8 ] 44 %add11 = add nsw i32 %k.046, %add 45 %arrayidx = getelementptr inbounds i32, i32* %A, i32 %add11 46 %0 = load i32, i32* %arrayidx, align 4 47 %add12 = add nsw i32 %0, 1 48 store i32 %add12, i32* %arrayidx, align 4 49 %inc = add nuw nsw i32 %k.046, 1 50 %exitcond = icmp eq i32 %inc, %o 51 br i1 %exitcond, label %for.cond.cleanup7, label %for.body8 52 53for.cond.cleanup7: ; preds = %for.body8, %for.cond5.preheader 54 %inc20 = add nuw nsw i32 %j.048, 1 55 %exitcond51 = icmp eq i32 %inc20, %m 56 br i1 %exitcond51, label %for.cond.cleanup3, label %for.cond5.preheader 57 58for.cond.cleanup3: ; preds = %for.cond.cleanup7, %for.cond1.preheader 59 %inc23 = add nuw nsw i32 %i.050, 1 60 %exitcond52 = icmp eq i32 %inc23, %n 61 br i1 %exitcond52, label %for.cond.cleanup, label %for.cond1.preheader 62 63for.cond.cleanup: ; preds = %for.cond.cleanup3, %entry 64 ret void 65} 66 67; CHECK-LABEL: t2 68;; for (int i = 0; i < n; i++) 69;; for (int j = 0; j < m; j++) 70;; for (int k = 0; k < o; k++) 71;; = A[i*m*o + j*o + k] 72;; A[i*m*o + j*o + k + 1] = 73define void @t2(i32 %n, i32 %m, i32 %o, i32* nocapture %A) { 74; CHECK: da analyze - none! 75; CHECK: da analyze - anti [* * *|<]! 76; CHECK: da analyze - output [* * *]! 77entry: 78 %cmp49 = icmp sgt i32 %n, 0 79 br i1 %cmp49, label %for.cond1.preheader.lr.ph, label %for.cond.cleanup 80 81for.cond1.preheader.lr.ph: ; preds = %entry 82 %cmp247 = icmp sgt i32 %m, 0 83 %cmp645 = icmp sgt i32 %o, 0 84 br label %for.cond1.preheader 85 86for.cond1.preheader: ; preds = %for.cond.cleanup3, %for.cond1.preheader.lr.ph 87 %i.050 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %inc23, %for.cond.cleanup3 ] 88 br i1 %cmp247, label %for.cond5.preheader.lr.ph, label %for.cond.cleanup3 89 90for.cond5.preheader.lr.ph: ; preds = %for.cond1.preheader 91 %mul = mul nsw i32 %i.050, %m 92 br label %for.cond5.preheader 93 94for.cond5.preheader: ; preds = %for.cond.cleanup7, %for.cond5.preheader.lr.ph 95 %j.048 = phi i32 [ 0, %for.cond5.preheader.lr.ph ], [ %inc20, %for.cond.cleanup7 ] 96 br i1 %cmp645, label %for.body8.lr.ph, label %for.cond.cleanup7 97 98for.body8.lr.ph: ; preds = %for.cond5.preheader 99 %mul944 = add i32 %j.048, %mul 100 %add = mul i32 %mul944, %o 101 br label %for.body8 102 103for.body8: ; preds = %for.body8, %for.body8.lr.ph 104 %k.046 = phi i32 [ 0, %for.body8.lr.ph ], [ %inc, %for.body8 ] 105 %add11 = add nsw i32 %k.046, %add 106 %arrayidx = getelementptr inbounds i32, i32* %A, i32 %add11 107 %0 = load i32, i32* %arrayidx, align 4 108 %add12 = add nsw i32 %0, 1 109 %add111 = add nsw i32 %add11, 1 110 %arrayidx2 = getelementptr inbounds i32, i32* %A, i32 %add111 111 store i32 %add12, i32* %arrayidx2, align 4 112 %inc = add nuw nsw i32 %k.046, 1 113 %exitcond = icmp eq i32 %inc, %o 114 br i1 %exitcond, label %for.cond.cleanup7, label %for.body8 115 116for.cond.cleanup7: ; preds = %for.body8, %for.cond5.preheader 117 %inc20 = add nuw nsw i32 %j.048, 1 118 %exitcond51 = icmp eq i32 %inc20, %m 119 br i1 %exitcond51, label %for.cond.cleanup3, label %for.cond5.preheader 120 121for.cond.cleanup3: ; preds = %for.cond.cleanup7, %for.cond1.preheader 122 %inc23 = add nuw nsw i32 %i.050, 1 123 %exitcond52 = icmp eq i32 %inc23, %n 124 br i1 %exitcond52, label %for.cond.cleanup, label %for.cond1.preheader 125 126for.cond.cleanup: ; preds = %for.cond.cleanup3, %entry 127 ret void 128} 129 130; CHECK-LABEL: t3 131;; for (int i = 0; i < n; i++) 132;; for (int j = 0; j < m; j++) 133;; for (int k = 0; k < o; k++) 134;; = A[i*m*o + j*o + k] 135;; A[i*m*o + j*o + k - 1] = 136define void @t3(i32 %n, i32 %m, i32 %o, i32* nocapture %A) { 137; CHECK: da analyze - none! 138; CHECK: da analyze - anti [* * *|<]! 139; CHECK: da analyze - output [* * *]! 140entry: 141 %cmp49 = icmp sgt i32 %n, 0 142 br i1 %cmp49, label %for.cond1.preheader.lr.ph, label %for.cond.cleanup 143 144for.cond1.preheader.lr.ph: ; preds = %entry 145 %cmp247 = icmp sgt i32 %m, 0 146 %cmp645 = icmp sgt i32 %o, 0 147 br label %for.cond1.preheader 148 149for.cond1.preheader: ; preds = %for.cond.cleanup3, %for.cond1.preheader.lr.ph 150 %i.050 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %inc23, %for.cond.cleanup3 ] 151 br i1 %cmp247, label %for.cond5.preheader.lr.ph, label %for.cond.cleanup3 152 153for.cond5.preheader.lr.ph: ; preds = %for.cond1.preheader 154 %mul = mul nsw i32 %i.050, %m 155 br label %for.cond5.preheader 156 157for.cond5.preheader: ; preds = %for.cond.cleanup7, %for.cond5.preheader.lr.ph 158 %j.048 = phi i32 [ 0, %for.cond5.preheader.lr.ph ], [ %inc20, %for.cond.cleanup7 ] 159 br i1 %cmp645, label %for.body8.lr.ph, label %for.cond.cleanup7 160 161for.body8.lr.ph: ; preds = %for.cond5.preheader 162 %mul944 = add i32 %j.048, %mul 163 %add = mul i32 %mul944, %o 164 br label %for.body8 165 166for.body8: ; preds = %for.body8, %for.body8.lr.ph 167 %k.046 = phi i32 [ 0, %for.body8.lr.ph ], [ %inc, %for.body8 ] 168 %add11 = add nsw i32 %k.046, %add 169 %arrayidx = getelementptr inbounds i32, i32* %A, i32 %add11 170 %0 = load i32, i32* %arrayidx, align 4 171 %add12 = add nsw i32 %0, 1 172 %add111 = sub nsw i32 %add11, 1 173 %arrayidx2 = getelementptr inbounds i32, i32* %A, i32 %add111 174 store i32 %add12, i32* %arrayidx2, align 4 175 %inc = add nuw nsw i32 %k.046, 1 176 %exitcond = icmp eq i32 %inc, %o 177 br i1 %exitcond, label %for.cond.cleanup7, label %for.body8 178 179for.cond.cleanup7: ; preds = %for.body8, %for.cond5.preheader 180 %inc20 = add nuw nsw i32 %j.048, 1 181 %exitcond51 = icmp eq i32 %inc20, %m 182 br i1 %exitcond51, label %for.cond.cleanup3, label %for.cond5.preheader 183 184for.cond.cleanup3: ; preds = %for.cond.cleanup7, %for.cond1.preheader 185 %inc23 = add nuw nsw i32 %i.050, 1 186 %exitcond52 = icmp eq i32 %inc23, %n 187 br i1 %exitcond52, label %for.cond.cleanup, label %for.cond1.preheader 188 189for.cond.cleanup: ; preds = %for.cond.cleanup3, %entry 190 ret void 191} 192 193; CHECK-LABEL: t4 194;; for (int i = 0; i < n; i++) 195;; for (int j = 0; j < m; j++) 196;; for (int k = 0; k < o; k++) 197;; = A[i*m*o + j*o + k] 198;; A[i*m*o + j*o + k + o] = 199define void @t4(i32 %n, i32 %m, i32 %o, i32* nocapture %A) { 200; CHECK: da analyze - none! 201; CHECK: da analyze - anti [* * *|<]! 202; CHECK: da analyze - output [* * *]! 203entry: 204 %cmp49 = icmp sgt i32 %n, 0 205 br i1 %cmp49, label %for.cond1.preheader.lr.ph, label %for.cond.cleanup 206 207for.cond1.preheader.lr.ph: ; preds = %entry 208 %cmp247 = icmp sgt i32 %m, 0 209 %cmp645 = icmp sgt i32 %o, 0 210 br label %for.cond1.preheader 211 212for.cond1.preheader: ; preds = %for.cond.cleanup3, %for.cond1.preheader.lr.ph 213 %i.050 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %inc23, %for.cond.cleanup3 ] 214 br i1 %cmp247, label %for.cond5.preheader.lr.ph, label %for.cond.cleanup3 215 216for.cond5.preheader.lr.ph: ; preds = %for.cond1.preheader 217 %mul = mul nsw i32 %i.050, %m 218 br label %for.cond5.preheader 219 220for.cond5.preheader: ; preds = %for.cond.cleanup7, %for.cond5.preheader.lr.ph 221 %j.048 = phi i32 [ 0, %for.cond5.preheader.lr.ph ], [ %inc20, %for.cond.cleanup7 ] 222 br i1 %cmp645, label %for.body8.lr.ph, label %for.cond.cleanup7 223 224for.body8.lr.ph: ; preds = %for.cond5.preheader 225 %mul944 = add i32 %j.048, %mul 226 %add = mul i32 %mul944, %o 227 br label %for.body8 228 229for.body8: ; preds = %for.body8, %for.body8.lr.ph 230 %k.046 = phi i32 [ 0, %for.body8.lr.ph ], [ %inc, %for.body8 ] 231 %add11 = add nsw i32 %k.046, %add 232 %arrayidx = getelementptr inbounds i32, i32* %A, i32 %add11 233 %0 = load i32, i32* %arrayidx, align 4 234 %add12 = add nsw i32 %0, 1 235 %add111 = add nsw i32 %add11, %o 236 %arrayidx2 = getelementptr inbounds i32, i32* %A, i32 %add111 237 store i32 %add12, i32* %arrayidx2, align 4 238 %inc = add nuw nsw i32 %k.046, 1 239 %exitcond = icmp eq i32 %inc, %o 240 br i1 %exitcond, label %for.cond.cleanup7, label %for.body8 241 242for.cond.cleanup7: ; preds = %for.body8, %for.cond5.preheader 243 %inc20 = add nuw nsw i32 %j.048, 1 244 %exitcond51 = icmp eq i32 %inc20, %m 245 br i1 %exitcond51, label %for.cond.cleanup3, label %for.cond5.preheader 246 247for.cond.cleanup3: ; preds = %for.cond.cleanup7, %for.cond1.preheader 248 %inc23 = add nuw nsw i32 %i.050, 1 249 %exitcond52 = icmp eq i32 %inc23, %n 250 br i1 %exitcond52, label %for.cond.cleanup, label %for.cond1.preheader 251 252for.cond.cleanup: ; preds = %for.cond.cleanup3, %entry 253 ret void 254} 255 256; CHECK-LABEL: t5 257;; for (int i = 0; i < n; i++) 258;; for (int j = 0; j < m; j++) 259;; for (int k = 0; k < o; k++) 260;; = A[i*m*o + j*o + k] 261;; A[i*m*o + j*o + k - o] = 262define void @t5(i32 %n, i32 %m, i32 %o, i32* nocapture %A) { 263; CHECK: da analyze - none! 264; CHECK: da analyze - anti [* * *|<]! 265; CHECK: da analyze - output [* * *]! 266entry: 267 %cmp49 = icmp sgt i32 %n, 0 268 br i1 %cmp49, label %for.cond1.preheader.lr.ph, label %for.cond.cleanup 269 270for.cond1.preheader.lr.ph: ; preds = %entry 271 %cmp247 = icmp sgt i32 %m, 0 272 %cmp645 = icmp sgt i32 %o, 0 273 br label %for.cond1.preheader 274 275for.cond1.preheader: ; preds = %for.cond.cleanup3, %for.cond1.preheader.lr.ph 276 %i.050 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %inc23, %for.cond.cleanup3 ] 277 br i1 %cmp247, label %for.cond5.preheader.lr.ph, label %for.cond.cleanup3 278 279for.cond5.preheader.lr.ph: ; preds = %for.cond1.preheader 280 %mul = mul nsw i32 %i.050, %m 281 br label %for.cond5.preheader 282 283for.cond5.preheader: ; preds = %for.cond.cleanup7, %for.cond5.preheader.lr.ph 284 %j.048 = phi i32 [ 0, %for.cond5.preheader.lr.ph ], [ %inc20, %for.cond.cleanup7 ] 285 br i1 %cmp645, label %for.body8.lr.ph, label %for.cond.cleanup7 286 287for.body8.lr.ph: ; preds = %for.cond5.preheader 288 %mul944 = add i32 %j.048, %mul 289 %add = mul i32 %mul944, %o 290 br label %for.body8 291 292for.body8: ; preds = %for.body8, %for.body8.lr.ph 293 %k.046 = phi i32 [ 0, %for.body8.lr.ph ], [ %inc, %for.body8 ] 294 %add11 = add nsw i32 %k.046, %add 295 %arrayidx = getelementptr inbounds i32, i32* %A, i32 %add11 296 %0 = load i32, i32* %arrayidx, align 4 297 %add12 = add nsw i32 %0, 1 298 %add111 = sub nsw i32 %add11, %o 299 %arrayidx2 = getelementptr inbounds i32, i32* %A, i32 %add111 300 store i32 %add12, i32* %arrayidx2, align 4 301 %inc = add nuw nsw i32 %k.046, 1 302 %exitcond = icmp eq i32 %inc, %o 303 br i1 %exitcond, label %for.cond.cleanup7, label %for.body8 304 305for.cond.cleanup7: ; preds = %for.body8, %for.cond5.preheader 306 %inc20 = add nuw nsw i32 %j.048, 1 307 %exitcond51 = icmp eq i32 %inc20, %m 308 br i1 %exitcond51, label %for.cond.cleanup3, label %for.cond5.preheader 309 310for.cond.cleanup3: ; preds = %for.cond.cleanup7, %for.cond1.preheader 311 %inc23 = add nuw nsw i32 %i.050, 1 312 %exitcond52 = icmp eq i32 %inc23, %n 313 br i1 %exitcond52, label %for.cond.cleanup, label %for.cond1.preheader 314 315for.cond.cleanup: ; preds = %for.cond.cleanup3, %entry 316 ret void 317} 318 319; CHECK-LABEL: t6 320;; for (int i = 0; i < n; i++) 321;; for (int j = 0; j < m; j++) 322;; for (int k = 0; k < o; k++) 323;; = A[i*m*o + j*o + k] 324;; A[i*m*o + j*o + k + m*o] = 325define void @t6(i32 %n, i32 %m, i32 %o, i32* nocapture %A) { 326; CHECK: da analyze - none! 327; CHECK: da analyze - consistent anti [-1 0 0]! 328; CHECK: da analyze - none! 329entry: 330 %cmp49 = icmp sgt i32 %n, 0 331 br i1 %cmp49, label %for.cond1.preheader.lr.ph, label %for.cond.cleanup 332 333for.cond1.preheader.lr.ph: ; preds = %entry 334 %cmp247 = icmp sgt i32 %m, 0 335 %cmp645 = icmp sgt i32 %o, 0 336 br label %for.cond1.preheader 337 338for.cond1.preheader: ; preds = %for.cond.cleanup3, %for.cond1.preheader.lr.ph 339 %i.050 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %inc23, %for.cond.cleanup3 ] 340 br i1 %cmp247, label %for.cond5.preheader.lr.ph, label %for.cond.cleanup3 341 342for.cond5.preheader.lr.ph: ; preds = %for.cond1.preheader 343 %mul = mul nsw i32 %i.050, %m 344 br label %for.cond5.preheader 345 346for.cond5.preheader: ; preds = %for.cond.cleanup7, %for.cond5.preheader.lr.ph 347 %j.048 = phi i32 [ 0, %for.cond5.preheader.lr.ph ], [ %inc20, %for.cond.cleanup7 ] 348 br i1 %cmp645, label %for.body8.lr.ph, label %for.cond.cleanup7 349 350for.body8.lr.ph: ; preds = %for.cond5.preheader 351 %mul944 = add i32 %j.048, %mul 352 %add = mul i32 %mul944, %o 353 br label %for.body8 354 355for.body8: ; preds = %for.body8, %for.body8.lr.ph 356 %k.046 = phi i32 [ 0, %for.body8.lr.ph ], [ %inc, %for.body8 ] 357 %add11 = add nsw i32 %k.046, %add 358 %arrayidx = getelementptr inbounds i32, i32* %A, i32 %add11 359 %0 = load i32, i32* %arrayidx, align 4 360 %add12 = add nsw i32 %0, 1 361 %mo = mul i32 %m, %o 362 %add111 = add nsw i32 %add11, %mo 363 %arrayidx2 = getelementptr inbounds i32, i32* %A, i32 %add111 364 store i32 %add12, i32* %arrayidx2, align 4 365 %inc = add nuw nsw i32 %k.046, 1 366 %exitcond = icmp eq i32 %inc, %o 367 br i1 %exitcond, label %for.cond.cleanup7, label %for.body8 368 369for.cond.cleanup7: ; preds = %for.body8, %for.cond5.preheader 370 %inc20 = add nuw nsw i32 %j.048, 1 371 %exitcond51 = icmp eq i32 %inc20, %m 372 br i1 %exitcond51, label %for.cond.cleanup3, label %for.cond5.preheader 373 374for.cond.cleanup3: ; preds = %for.cond.cleanup7, %for.cond1.preheader 375 %inc23 = add nuw nsw i32 %i.050, 1 376 %exitcond52 = icmp eq i32 %inc23, %n 377 br i1 %exitcond52, label %for.cond.cleanup, label %for.cond1.preheader 378 379for.cond.cleanup: ; preds = %for.cond.cleanup3, %entry 380 ret void 381} 382 383; CHECK-LABEL: t7 384;; for (int i = 0; i < n; i++) 385;; for (int j = 0; j < m; j++) 386;; for (int k = 0; k < o; k++) 387;; = A[i*m*o + j*o + k] 388;; A[i*m*o + j*o + k - m*o] = 389define void @t7(i32 %n, i32 %m, i32 %o, i32* nocapture %A) { 390; CHECK: da analyze - none! 391; CHECK: da analyze - consistent anti [1 0 0]! 392; CHECK: da analyze - none! 393entry: 394 %cmp49 = icmp sgt i32 %n, 0 395 br i1 %cmp49, label %for.cond1.preheader.lr.ph, label %for.cond.cleanup 396 397for.cond1.preheader.lr.ph: ; preds = %entry 398 %cmp247 = icmp sgt i32 %m, 0 399 %cmp645 = icmp sgt i32 %o, 0 400 br label %for.cond1.preheader 401 402for.cond1.preheader: ; preds = %for.cond.cleanup3, %for.cond1.preheader.lr.ph 403 %i.050 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %inc23, %for.cond.cleanup3 ] 404 br i1 %cmp247, label %for.cond5.preheader.lr.ph, label %for.cond.cleanup3 405 406for.cond5.preheader.lr.ph: ; preds = %for.cond1.preheader 407 %mul = mul nsw i32 %i.050, %m 408 br label %for.cond5.preheader 409 410for.cond5.preheader: ; preds = %for.cond.cleanup7, %for.cond5.preheader.lr.ph 411 %j.048 = phi i32 [ 0, %for.cond5.preheader.lr.ph ], [ %inc20, %for.cond.cleanup7 ] 412 br i1 %cmp645, label %for.body8.lr.ph, label %for.cond.cleanup7 413 414for.body8.lr.ph: ; preds = %for.cond5.preheader 415 %mul944 = add i32 %j.048, %mul 416 %add = mul i32 %mul944, %o 417 br label %for.body8 418 419for.body8: ; preds = %for.body8, %for.body8.lr.ph 420 %k.046 = phi i32 [ 0, %for.body8.lr.ph ], [ %inc, %for.body8 ] 421 %add11 = add nsw i32 %k.046, %add 422 %arrayidx = getelementptr inbounds i32, i32* %A, i32 %add11 423 %0 = load i32, i32* %arrayidx, align 4 424 %add12 = add nsw i32 %0, 1 425 %mo = mul i32 %m, %o 426 %add111 = sub nsw i32 %add11, %mo 427 %arrayidx2 = getelementptr inbounds i32, i32* %A, i32 %add111 428 store i32 %add12, i32* %arrayidx2, align 4 429 %inc = add nuw nsw i32 %k.046, 1 430 %exitcond = icmp eq i32 %inc, %o 431 br i1 %exitcond, label %for.cond.cleanup7, label %for.body8 432 433for.cond.cleanup7: ; preds = %for.body8, %for.cond5.preheader 434 %inc20 = add nuw nsw i32 %j.048, 1 435 %exitcond51 = icmp eq i32 %inc20, %m 436 br i1 %exitcond51, label %for.cond.cleanup3, label %for.cond5.preheader 437 438for.cond.cleanup3: ; preds = %for.cond.cleanup7, %for.cond1.preheader 439 %inc23 = add nuw nsw i32 %i.050, 1 440 %exitcond52 = icmp eq i32 %inc23, %n 441 br i1 %exitcond52, label %for.cond.cleanup, label %for.cond1.preheader 442 443for.cond.cleanup: ; preds = %for.cond.cleanup3, %entry 444 ret void 445} 446 447; CHECK-LABEL: t8 448;; for (int i = 0; i < n; i++) 449;; for (int j = 0; j < m; j++) 450;; for (int k = 1; k < o; k++) 451;; = A[i*m*o + j*o + k] 452;; A[i*m*o + j*o + k - 1] = 453define void @t8(i32 %n, i32 %m, i32 %o, i32* nocapture %A) { 454; CHECK: da analyze - none! 455; CHECK: da analyze - consistent anti [0 0 1]! 456; CHECK: da analyze - none! 457entry: 458 %cmp49 = icmp sgt i32 %n, 0 459 br i1 %cmp49, label %for.cond1.preheader.lr.ph, label %for.cond.cleanup 460 461for.cond1.preheader.lr.ph: ; preds = %entry 462 %cmp247 = icmp sgt i32 %m, 0 463 %cmp645 = icmp sgt i32 %o, 0 464 br label %for.cond1.preheader 465 466for.cond1.preheader: ; preds = %for.cond.cleanup3, %for.cond1.preheader.lr.ph 467 %i.050 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %inc23, %for.cond.cleanup3 ] 468 br i1 %cmp247, label %for.cond5.preheader.lr.ph, label %for.cond.cleanup3 469 470for.cond5.preheader.lr.ph: ; preds = %for.cond1.preheader 471 %mul = mul nsw i32 %i.050, %m 472 br label %for.cond5.preheader 473 474for.cond5.preheader: ; preds = %for.cond.cleanup7, %for.cond5.preheader.lr.ph 475 %j.048 = phi i32 [ 0, %for.cond5.preheader.lr.ph ], [ %inc20, %for.cond.cleanup7 ] 476 br i1 %cmp645, label %for.body8.lr.ph, label %for.cond.cleanup7 477 478for.body8.lr.ph: ; preds = %for.cond5.preheader 479 %mul944 = add i32 %j.048, %mul 480 %add = mul i32 %mul944, %o 481 br label %for.body8 482 483for.body8: ; preds = %for.body8, %for.body8.lr.ph 484 %k.046 = phi i32 [ 1, %for.body8.lr.ph ], [ %inc, %for.body8 ] 485 %add11 = add nsw i32 %k.046, %add 486 %arrayidx = getelementptr inbounds i32, i32* %A, i32 %add11 487 %0 = load i32, i32* %arrayidx, align 4 488 %add12 = add nsw i32 %0, 1 489 %add111 = sub nsw i32 %add11, 1 490 %arrayidx2 = getelementptr inbounds i32, i32* %A, i32 %add111 491 store i32 %add12, i32* %arrayidx2, align 4 492 %inc = add nuw nsw i32 %k.046, 1 493 %exitcond = icmp eq i32 %inc, %o 494 br i1 %exitcond, label %for.cond.cleanup7, label %for.body8 495 496for.cond.cleanup7: ; preds = %for.body8, %for.cond5.preheader 497 %inc20 = add nuw nsw i32 %j.048, 1 498 %exitcond51 = icmp eq i32 %inc20, %m 499 br i1 %exitcond51, label %for.cond.cleanup3, label %for.cond5.preheader 500 501for.cond.cleanup3: ; preds = %for.cond.cleanup7, %for.cond1.preheader 502 %inc23 = add nuw nsw i32 %i.050, 1 503 %exitcond52 = icmp eq i32 %inc23, %n 504 br i1 %exitcond52, label %for.cond.cleanup, label %for.cond1.preheader 505 506for.cond.cleanup: ; preds = %for.cond.cleanup3, %entry 507 ret void 508} 509 510 511; CHECK-LABEL: test_sizes 512define double @test_sizes(i16 %h, i16 %N, i16* nocapture %array) { 513; CHECK: da analyze - consistent input [0 S]! 514; CHECK: da analyze - anti [* *|<]! 515; CHECK: da analyze - output [* *]! 516entry: 517 %cmp28 = icmp sgt i16 %N, 1 518 br i1 %cmp28, label %for.body.lr.ph, label %for.end12 519 520for.body.lr.ph: ; preds = %entry 521 %cmp425 = icmp slt i16 %h, 0 522 %0 = add i16 %h, 1 523 %wide.trip.count = zext i16 %N to i32 524 br label %for.body 525 526for.body: ; preds = %for.inc10, %for.body.lr.ph 527 %indvars.iv32 = phi i32 [ 1, %for.body.lr.ph ], [ %indvars.iv.next33, %for.inc10 ] 528 %indvars.iv = phi i16 [ 2, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc10 ] 529 br i1 %cmp425, label %for.inc10, label %for.body5.lr.ph 530 531for.body5.lr.ph: ; preds = %for.body 532 %1 = sext i16 %indvars.iv to i32 533 %arrayidx = getelementptr inbounds i16, i16* %array, i32 %indvars.iv32 534 br label %for.body5 535 536for.body5: ; preds = %for.body5, %for.body5.lr.ph 537 %indvars.iv30 = phi i32 [ %indvars.iv.next31, %for.body5 ], [ %1, %for.body5.lr.ph ] 538 %j.027 = phi i16 [ %inc, %for.body5 ], [ 0, %for.body5.lr.ph ] 539 %2 = load i16, i16* %arrayidx, align 4 540 %add6 = add nsw i16 %2, %j.027 541 %arrayidx8 = getelementptr inbounds i16, i16* %array, i32 %indvars.iv30 542 store i16 %add6, i16* %arrayidx8, align 4 543 %inc = add nuw nsw i16 %j.027, 1 544 %indvars.iv.next31 = add nsw i32 %indvars.iv30, 1 545 %exitcond = icmp eq i16 %inc, %0 546 br i1 %exitcond, label %for.inc10, label %for.body5 547 548for.inc10: ; preds = %for.body5, %for.body 549 %indvars.iv.next33 = add nuw nsw i32 %indvars.iv32, 1 550 %indvars.iv.next = add i16 %indvars.iv, %0 551 %exitcond34 = icmp eq i32 %indvars.iv.next33, %wide.trip.count 552 br i1 %exitcond34, label %for.end12, label %for.body 553 554for.end12: ; preds = %for.inc10, %entry 555 ret double undef 556} 557 558 559; CHECK-LABEL: nonnegative 560define void @nonnegative(i32* nocapture %A, i32 %N) { 561; CHECK: da analyze - none! 562; CHECK: da analyze - consistent output [0 0|<]! 563; CHECK: da analyze - none! 564entry: 565 %cmp44 = icmp eq i32 %N, 0 566 br i1 %cmp44, label %exit, label %for.outer 567 568for.outer: 569 %h.045 = phi i32 [ %add19, %for.latch ], [ 0, %entry ] 570 %mul = mul i32 %h.045, %N 571 br label %for.inner 572 573for.inner: 574 %i.043 = phi i32 [ 0, %for.outer ], [ %add16, %for.inner ] 575 %add = add i32 %i.043, %mul 576 %arrayidx = getelementptr inbounds i32, i32* %A, i32 %add 577 store i32 1, i32* %arrayidx, align 4 578 store i32 2, i32* %arrayidx, align 4 579 %add16 = add nuw i32 %i.043, 1 580 %exitcond46 = icmp eq i32 %add16, %N 581 br i1 %exitcond46, label %for.latch, label %for.inner 582 583for.latch: 584 %add19 = add nuw i32 %h.045, 1 585 %exitcond47 = icmp eq i32 %add19, %N 586 br i1 %exitcond47, label %exit, label %for.outer 587 588exit: 589 ret void 590} 591