1; RUN: opt < %s -analyze -basicaa -da | FileCheck %s 2 3target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" 4target triple = "x86_64-apple-macosx10.6.0" 5 6 7;; for (long int i = 0; i < 50; i++) 8;; for (long int j = 0; j < 50; j++) 9;; for (long int k = 0; k < 50; k++) 10;; for (long int l = 0; l < 50; l++) { 11;; A[n][i][j + k] = i; 12;; *B++ = A[10][i + 10][2*j - l]; 13 14define void @sep0([100 x [100 x i32]]* %A, i32* %B, i32 %n) nounwind uwtable ssp { 15entry: 16 br label %for.cond1.preheader 17 18; CHECK: da analyze - output [= * * S]! 19; CHECK: da analyze - flow [* * * *|<]! 20; CHECK: da analyze - confused! 21; CHECK: da analyze - input [* * S *]! 22; CHECK: da analyze - confused! 23; CHECK: da analyze - none! 24 25for.cond1.preheader: ; preds = %entry, %for.inc22 26 %B.addr.08 = phi i32* [ %B, %entry ], [ %scevgep11, %for.inc22 ] 27 %i.07 = phi i64 [ 0, %entry ], [ %inc23, %for.inc22 ] 28 br label %for.cond4.preheader 29 30for.cond4.preheader: ; preds = %for.cond1.preheader, %for.inc19 31 %B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %scevgep9, %for.inc19 ] 32 %j.05 = phi i64 [ 0, %for.cond1.preheader ], [ %inc20, %for.inc19 ] 33 br label %for.cond7.preheader 34 35for.cond7.preheader: ; preds = %for.cond4.preheader, %for.inc16 36 %B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %scevgep, %for.inc16 ] 37 %k.03 = phi i64 [ 0, %for.cond4.preheader ], [ %inc17, %for.inc16 ] 38 br label %for.body9 39 40for.body9: ; preds = %for.cond7.preheader, %for.body9 41 %l.02 = phi i64 [ 0, %for.cond7.preheader ], [ %inc, %for.body9 ] 42 %B.addr.31 = phi i32* [ %B.addr.24, %for.cond7.preheader ], [ %incdec.ptr, %for.body9 ] 43 %conv = trunc i64 %i.07 to i32 44 %add = add nsw i64 %j.05, %k.03 45 %idxprom = sext i32 %n to i64 46 %arrayidx11 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %A, i64 %idxprom, i64 %i.07, i64 %add 47 store i32 %conv, i32* %arrayidx11, align 4 48 %mul = shl nsw i64 %j.05, 1 49 %sub = sub nsw i64 %mul, %l.02 50 %add12 = add nsw i64 %i.07, 10 51 %arrayidx15 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %A, i64 10, i64 %add12, i64 %sub 52 %0 = load i32, i32* %arrayidx15, align 4 53 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.31, i64 1 54 store i32 %0, i32* %B.addr.31, align 4 55 %inc = add nsw i64 %l.02, 1 56 %exitcond = icmp ne i64 %inc, 50 57 br i1 %exitcond, label %for.body9, label %for.inc16 58 59for.inc16: ; preds = %for.body9 60 %scevgep = getelementptr i32, i32* %B.addr.24, i64 50 61 %inc17 = add nsw i64 %k.03, 1 62 %exitcond10 = icmp ne i64 %inc17, 50 63 br i1 %exitcond10, label %for.cond7.preheader, label %for.inc19 64 65for.inc19: ; preds = %for.inc16 66 %scevgep9 = getelementptr i32, i32* %B.addr.16, i64 2500 67 %inc20 = add nsw i64 %j.05, 1 68 %exitcond12 = icmp ne i64 %inc20, 50 69 br i1 %exitcond12, label %for.cond4.preheader, label %for.inc22 70 71for.inc22: ; preds = %for.inc19 72 %scevgep11 = getelementptr i32, i32* %B.addr.08, i64 125000 73 %inc23 = add nsw i64 %i.07, 1 74 %exitcond13 = icmp ne i64 %inc23, 50 75 br i1 %exitcond13, label %for.cond1.preheader, label %for.end24 76 77for.end24: ; preds = %for.inc22 78 ret void 79} 80 81 82;; for (long int i = 0; i < 50; i++) 83;; for (long int j = 0; j < 50; j++) 84;; for (long int k = 0; k < 50; k++) 85;; for (long int l = 0; l < 50; l++) { 86;; A[i][i][j + k] = i; 87;; *B++ = A[10][i + 10][2*j - l]; 88 89define void @sep1([100 x [100 x i32]]* %A, i32* %B, i32 %n) nounwind uwtable ssp { 90entry: 91 br label %for.cond1.preheader 92 93; CHECK: da analyze - output [= * * S]! 94; CHECK: da analyze - flow [* * * *|<]! 95; CHECK: da analyze - confused! 96; CHECK: da analyze - input [* * S *]! 97; CHECK: da analyze - confused! 98; CHECK: da analyze - none! 99 100for.cond1.preheader: ; preds = %entry, %for.inc22 101 %B.addr.08 = phi i32* [ %B, %entry ], [ %scevgep11, %for.inc22 ] 102 %i.07 = phi i64 [ 0, %entry ], [ %inc23, %for.inc22 ] 103 br label %for.cond4.preheader 104 105for.cond4.preheader: ; preds = %for.cond1.preheader, %for.inc19 106 %B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %scevgep9, %for.inc19 ] 107 %j.05 = phi i64 [ 0, %for.cond1.preheader ], [ %inc20, %for.inc19 ] 108 br label %for.cond7.preheader 109 110for.cond7.preheader: ; preds = %for.cond4.preheader, %for.inc16 111 %B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %scevgep, %for.inc16 ] 112 %k.03 = phi i64 [ 0, %for.cond4.preheader ], [ %inc17, %for.inc16 ] 113 br label %for.body9 114 115for.body9: ; preds = %for.cond7.preheader, %for.body9 116 %l.02 = phi i64 [ 0, %for.cond7.preheader ], [ %inc, %for.body9 ] 117 %B.addr.31 = phi i32* [ %B.addr.24, %for.cond7.preheader ], [ %incdec.ptr, %for.body9 ] 118 %conv = trunc i64 %i.07 to i32 119 %add = add nsw i64 %j.05, %k.03 120 %arrayidx11 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %A, i64 %i.07, i64 %i.07, i64 %add 121 store i32 %conv, i32* %arrayidx11, align 4 122 %mul = shl nsw i64 %j.05, 1 123 %sub = sub nsw i64 %mul, %l.02 124 %add12 = add nsw i64 %i.07, 10 125 %arrayidx15 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %A, i64 10, i64 %add12, i64 %sub 126 %0 = load i32, i32* %arrayidx15, align 4 127 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.31, i64 1 128 store i32 %0, i32* %B.addr.31, align 4 129 %inc = add nsw i64 %l.02, 1 130 %exitcond = icmp ne i64 %inc, 50 131 br i1 %exitcond, label %for.body9, label %for.inc16 132 133for.inc16: ; preds = %for.body9 134 %scevgep = getelementptr i32, i32* %B.addr.24, i64 50 135 %inc17 = add nsw i64 %k.03, 1 136 %exitcond10 = icmp ne i64 %inc17, 50 137 br i1 %exitcond10, label %for.cond7.preheader, label %for.inc19 138 139for.inc19: ; preds = %for.inc16 140 %scevgep9 = getelementptr i32, i32* %B.addr.16, i64 2500 141 %inc20 = add nsw i64 %j.05, 1 142 %exitcond12 = icmp ne i64 %inc20, 50 143 br i1 %exitcond12, label %for.cond4.preheader, label %for.inc22 144 145for.inc22: ; preds = %for.inc19 146 %scevgep11 = getelementptr i32, i32* %B.addr.08, i64 125000 147 %inc23 = add nsw i64 %i.07, 1 148 %exitcond13 = icmp ne i64 %inc23, 50 149 br i1 %exitcond13, label %for.cond1.preheader, label %for.end24 150 151for.end24: ; preds = %for.inc22 152 ret void 153} 154 155 156;; for (long int i = 0; i < 50; i++) 157;; for (long int j = 0; j < 50; j++) 158;; for (long int k = 0; k < 50; k++) 159;; for (long int l = 0; l < 50; l++) { 160;; A[i][i][i + k][l] = i; 161;; *B++ = A[10][i + 10][j + k][l + 10]; 162 163define void @sep2([100 x [100 x [100 x i32]]]* %A, i32* %B, i32 %n) nounwind uwtable ssp { 164entry: 165 br label %for.cond1.preheader 166 167; CHECK: da analyze - output [= S = =]! 168; CHECK: da analyze - flow [* * * <>]! 169; CHECK: da analyze - confused! 170; CHECK: da analyze - input [= * * *]! 171; CHECK: da analyze - confused! 172; CHECK: da analyze - none! 173 174for.cond1.preheader: ; preds = %entry, %for.inc26 175 %B.addr.08 = phi i32* [ %B, %entry ], [ %scevgep11, %for.inc26 ] 176 %i.07 = phi i64 [ 0, %entry ], [ %inc27, %for.inc26 ] 177 br label %for.cond4.preheader 178 179for.cond4.preheader: ; preds = %for.cond1.preheader, %for.inc23 180 %B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %scevgep9, %for.inc23 ] 181 %j.05 = phi i64 [ 0, %for.cond1.preheader ], [ %inc24, %for.inc23 ] 182 br label %for.cond7.preheader 183 184for.cond7.preheader: ; preds = %for.cond4.preheader, %for.inc20 185 %B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %scevgep, %for.inc20 ] 186 %k.03 = phi i64 [ 0, %for.cond4.preheader ], [ %inc21, %for.inc20 ] 187 br label %for.body9 188 189for.body9: ; preds = %for.cond7.preheader, %for.body9 190 %l.02 = phi i64 [ 0, %for.cond7.preheader ], [ %inc, %for.body9 ] 191 %B.addr.31 = phi i32* [ %B.addr.24, %for.cond7.preheader ], [ %incdec.ptr, %for.body9 ] 192 %conv = trunc i64 %i.07 to i32 193 %add = add nsw i64 %i.07, %k.03 194 %arrayidx12 = getelementptr inbounds [100 x [100 x [100 x i32]]], [100 x [100 x [100 x i32]]]* %A, i64 %i.07, i64 %i.07, i64 %add, i64 %l.02 195 store i32 %conv, i32* %arrayidx12, align 4 196 %add13 = add nsw i64 %l.02, 10 197 %add14 = add nsw i64 %j.05, %k.03 198 %add15 = add nsw i64 %i.07, 10 199 %arrayidx19 = getelementptr inbounds [100 x [100 x [100 x i32]]], [100 x [100 x [100 x i32]]]* %A, i64 10, i64 %add15, i64 %add14, i64 %add13 200 %0 = load i32, i32* %arrayidx19, align 4 201 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.31, i64 1 202 store i32 %0, i32* %B.addr.31, align 4 203 %inc = add nsw i64 %l.02, 1 204 %exitcond = icmp ne i64 %inc, 50 205 br i1 %exitcond, label %for.body9, label %for.inc20 206 207for.inc20: ; preds = %for.body9 208 %scevgep = getelementptr i32, i32* %B.addr.24, i64 50 209 %inc21 = add nsw i64 %k.03, 1 210 %exitcond10 = icmp ne i64 %inc21, 50 211 br i1 %exitcond10, label %for.cond7.preheader, label %for.inc23 212 213for.inc23: ; preds = %for.inc20 214 %scevgep9 = getelementptr i32, i32* %B.addr.16, i64 2500 215 %inc24 = add nsw i64 %j.05, 1 216 %exitcond12 = icmp ne i64 %inc24, 50 217 br i1 %exitcond12, label %for.cond4.preheader, label %for.inc26 218 219for.inc26: ; preds = %for.inc23 220 %scevgep11 = getelementptr i32, i32* %B.addr.08, i64 125000 221 %inc27 = add nsw i64 %i.07, 1 222 %exitcond13 = icmp ne i64 %inc27, 50 223 br i1 %exitcond13, label %for.cond1.preheader, label %for.end28 224 225for.end28: ; preds = %for.inc26 226 ret void 227} 228 229 230;; for (long int i = 0; i < 50; i++) 231;; for (long int j = 0; j < 50; j++) 232;; for (long int k = 0; k < 50; k++) 233;; for (long int l = 0; l < 50; l++) { 234;; A[i][i][i + k][l + k] = i; 235;; *B++ = A[10][i + 10][j + k][l + 10]; 236 237define void @sep3([100 x [100 x [100 x i32]]]* %A, i32* %B, i32 %n) nounwind uwtable ssp { 238entry: 239 br label %for.cond1.preheader 240 241; CHECK: da analyze - output [= S = =]! 242; CHECK: da analyze - flow [* * * *|<]! 243; CHECK: da analyze - confused! 244; CHECK: da analyze - input [= * * *]! 245; CHECK: da analyze - confused! 246; CHECK: da analyze - none! 247 248for.cond1.preheader: ; preds = %entry, %for.inc27 249 %B.addr.08 = phi i32* [ %B, %entry ], [ %scevgep11, %for.inc27 ] 250 %i.07 = phi i64 [ 0, %entry ], [ %inc28, %for.inc27 ] 251 br label %for.cond4.preheader 252 253for.cond4.preheader: ; preds = %for.cond1.preheader, %for.inc24 254 %B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %scevgep9, %for.inc24 ] 255 %j.05 = phi i64 [ 0, %for.cond1.preheader ], [ %inc25, %for.inc24 ] 256 br label %for.cond7.preheader 257 258for.cond7.preheader: ; preds = %for.cond4.preheader, %for.inc21 259 %B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %scevgep, %for.inc21 ] 260 %k.03 = phi i64 [ 0, %for.cond4.preheader ], [ %inc22, %for.inc21 ] 261 br label %for.body9 262 263for.body9: ; preds = %for.cond7.preheader, %for.body9 264 %l.02 = phi i64 [ 0, %for.cond7.preheader ], [ %inc, %for.body9 ] 265 %B.addr.31 = phi i32* [ %B.addr.24, %for.cond7.preheader ], [ %incdec.ptr, %for.body9 ] 266 %conv = trunc i64 %i.07 to i32 267 %add = add nsw i64 %l.02, %k.03 268 %add10 = add nsw i64 %i.07, %k.03 269 %arrayidx13 = getelementptr inbounds [100 x [100 x [100 x i32]]], [100 x [100 x [100 x i32]]]* %A, i64 %i.07, i64 %i.07, i64 %add10, i64 %add 270 store i32 %conv, i32* %arrayidx13, align 4 271 %add14 = add nsw i64 %l.02, 10 272 %add15 = add nsw i64 %j.05, %k.03 273 %add16 = add nsw i64 %i.07, 10 274 %arrayidx20 = getelementptr inbounds [100 x [100 x [100 x i32]]], [100 x [100 x [100 x i32]]]* %A, i64 10, i64 %add16, i64 %add15, i64 %add14 275 %0 = load i32, i32* %arrayidx20, align 4 276 %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.31, i64 1 277 store i32 %0, i32* %B.addr.31, align 4 278 %inc = add nsw i64 %l.02, 1 279 %exitcond = icmp ne i64 %inc, 50 280 br i1 %exitcond, label %for.body9, label %for.inc21 281 282for.inc21: ; preds = %for.body9 283 %scevgep = getelementptr i32, i32* %B.addr.24, i64 50 284 %inc22 = add nsw i64 %k.03, 1 285 %exitcond10 = icmp ne i64 %inc22, 50 286 br i1 %exitcond10, label %for.cond7.preheader, label %for.inc24 287 288for.inc24: ; preds = %for.inc21 289 %scevgep9 = getelementptr i32, i32* %B.addr.16, i64 2500 290 %inc25 = add nsw i64 %j.05, 1 291 %exitcond12 = icmp ne i64 %inc25, 50 292 br i1 %exitcond12, label %for.cond4.preheader, label %for.inc27 293 294for.inc27: ; preds = %for.inc24 295 %scevgep11 = getelementptr i32, i32* %B.addr.08, i64 125000 296 %inc28 = add nsw i64 %i.07, 1 297 %exitcond13 = icmp ne i64 %inc28, 50 298 br i1 %exitcond13, label %for.cond1.preheader, label %for.end29 299 300for.end29: ; preds = %for.inc27 301 ret void 302} 303