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