366 lines · plain
1; RUN: opt %loadNPMPolly -disable-output '-passes=polly-custom<scops>' -polly-print-scops -polly-invariant-load-hoisting=true < %s 2>&1 | FileCheck %s2;3; Check that propagation of domains from A(X) to A(X+1) will keep the4; domains small and concise.5;6; CHECK: Assumed Context:7; CHECK-NEXT: [tmp5, tmp, tmp8, tmp11, tmp14, tmp17, tmp20, tmp23, tmp26] -> { : }8; CHECK-NEXT: Invalid Context:9; CHECK-NEXT: [tmp5, tmp, tmp8, tmp11, tmp14, tmp17, tmp20, tmp23, tmp26] -> { : false }10;11; CHECK: Stmt_FINAL12; CHECK-NEXT: Domain :=13; CHECK-NEXT: [tmp5, tmp, tmp8, tmp11, tmp14, tmp17, tmp20, tmp23, tmp26] -> { Stmt_FINAL[] };14; CHECK-NEXT: Schedule :=15; CHECK-NEXT: [tmp5, tmp, tmp8, tmp11, tmp14, tmp17, tmp20, tmp23, tmp26] -> { Stmt_FINAL[] -> [16] };16;17;18; void f(short *restrict In, int *restrict Out) {19; int InV, V, Idx;20; Idx = 0;21; V = 999;22;23; A0:24; InV = In[Idx++];25; if (InV < V + 42) {26; B0:27; V = V + 42;28; Out[V]++;29; } else {30; C0:31; V = InV;32; Out[V]--;33; }34;35; A1:36; InV = In[Idx++];37; if (InV < V + 42) {38; B1:39; V = V + 42;40; Out[V]++;41; } else {42; C1:43; V = InV;44; Out[V]--;45; }46; V = 999;47;48; A2:49; InV = In[Idx++];50; if (InV < V + 42) {51; B2:52; V = V + 42;53; Out[V]++;54; } else {55; C2:56; V = InV;57; Out[V]--;58; }59;60; A3:61; InV = In[Idx++];62; if (InV < V + 42) {63; B3:64; V = V + 42;65; Out[V]++;66; } else {67; C3:68; V = InV;69; Out[V]--;70; }71; V = 999;72;73; A4:74; InV = In[Idx++];75; if (InV < V + 42) {76; B4:77; V = V + 42;78; Out[V]++;79; } else {80; C4:81; V = InV;82; Out[V]--;83; }84;85; A5:86; InV = In[Idx++];87; if (InV < V + 42) {88; B5:89; V = V + 42;90; Out[V]++;91; } else {92; C5:93; V = InV;94; Out[V]--;95; }96; V = 999;97;98; A6:99; InV = In[Idx++];100; if (InV < V + 42) {101; B6:102; V = V + 42;103; Out[V]++;104; } else {105; C6:106; V = InV;107; Out[V]--;108; }109;110; A7:111; InV = In[Idx++];112; if (InV < V + 42) {113; B7:114; V = V + 42;115; Out[V]++;116; } else {117; C7:118; V = InV;119; Out[V]--;120; }121; V = 999;122;123; A8:124; InV = In[Idx++];125; if (InV < V + 42) {126; B8:127; V = V + 42;128; Out[V]++;129; } else {130; C8:131; V = InV;132; Out[V]--;133; }134; FINAL:135; Out[V]++;136;137; ScopExit:138; return;139; }140;141target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"142 143define void @f(ptr noalias %In, ptr noalias %Out) {144entry:145 %tmp = load i16, ptr %In, align 2146 %conv = sext i16 %tmp to i32147 %cmp = icmp slt i16 %tmp, 1041148 br i1 %cmp, label %B0, label %C0149 150B0: ; preds = %entry151 %arrayidx4 = getelementptr inbounds i32, ptr %Out, i64 1041152 %tmp3 = load i32, ptr %arrayidx4, align 4153 %inc5 = add nsw i32 %tmp3, 1154 store i32 %inc5, ptr %arrayidx4, align 4155 br label %A1156 157C0: ; preds = %entry158 %idxprom6 = sext i16 %tmp to i64159 %arrayidx7 = getelementptr inbounds i32, ptr %Out, i64 %idxprom6160 %tmp4 = load i32, ptr %arrayidx7, align 4161 %dec = add nsw i32 %tmp4, -1162 store i32 %dec, ptr %arrayidx7, align 4163 br label %A1164 165A1: ; preds = %B0, %C0166 %V.0 = phi i32 [ 1041, %B0 ], [ %conv, %C0 ]167 %arrayidx10 = getelementptr inbounds i16, ptr %In, i64 1168 %tmp5 = load i16, ptr %arrayidx10, align 2169 %conv11 = sext i16 %tmp5 to i32170 %add12 = add nsw i32 %V.0, 42171 %cmp13 = icmp slt i32 %conv11, %add12172 br i1 %cmp13, label %B1, label %C1173 174B1: ; preds = %A1175 %add16 = add nsw i32 %V.0, 42176 %idxprom17 = sext i32 %add16 to i64177 %arrayidx18 = getelementptr inbounds i32, ptr %Out, i64 %idxprom17178 %tmp6 = load i32, ptr %arrayidx18, align 4179 %inc19 = add nsw i32 %tmp6, 1180 store i32 %inc19, ptr %arrayidx18, align 4181 br label %A2182 183C1: ; preds = %A1184 %idxprom21 = sext i16 %tmp5 to i64185 %arrayidx22 = getelementptr inbounds i32, ptr %Out, i64 %idxprom21186 %tmp7 = load i32, ptr %arrayidx22, align 4187 %dec23 = add nsw i32 %tmp7, -1188 store i32 %dec23, ptr %arrayidx22, align 4189 br label %A2190 191A2: ; preds = %B1, %C1192 %arrayidx27 = getelementptr inbounds i16, ptr %In, i64 2193 %tmp8 = load i16, ptr %arrayidx27, align 2194 %conv28 = sext i16 %tmp8 to i32195 %cmp30 = icmp slt i16 %tmp8, 1041196 br i1 %cmp30, label %B2, label %C2197 198B2: ; preds = %A2199 %arrayidx35 = getelementptr inbounds i32, ptr %Out, i64 1041200 %tmp9 = load i32, ptr %arrayidx35, align 4201 %inc36 = add nsw i32 %tmp9, 1202 store i32 %inc36, ptr %arrayidx35, align 4203 br label %A3204 205C2: ; preds = %A2206 %idxprom38 = sext i16 %tmp8 to i64207 %arrayidx39 = getelementptr inbounds i32, ptr %Out, i64 %idxprom38208 %tmp10 = load i32, ptr %arrayidx39, align 4209 %dec40 = add nsw i32 %tmp10, -1210 store i32 %dec40, ptr %arrayidx39, align 4211 br label %A3212 213A3: ; preds = %B2, %C2214 %V.1 = phi i32 [ 1041, %B2 ], [ %conv28, %C2 ]215 %arrayidx44 = getelementptr inbounds i16, ptr %In, i64 3216 %tmp11 = load i16, ptr %arrayidx44, align 2217 %conv45 = sext i16 %tmp11 to i32218 %add46 = add nsw i32 %V.1, 42219 %cmp47 = icmp slt i32 %conv45, %add46220 br i1 %cmp47, label %B3, label %C3221 222B3: ; preds = %A3223 %add50 = add nsw i32 %V.1, 42224 %idxprom51 = sext i32 %add50 to i64225 %arrayidx52 = getelementptr inbounds i32, ptr %Out, i64 %idxprom51226 %tmp12 = load i32, ptr %arrayidx52, align 4227 %inc53 = add nsw i32 %tmp12, 1228 store i32 %inc53, ptr %arrayidx52, align 4229 br label %A4230 231C3: ; preds = %A3232 %idxprom55 = sext i16 %tmp11 to i64233 %arrayidx56 = getelementptr inbounds i32, ptr %Out, i64 %idxprom55234 %tmp13 = load i32, ptr %arrayidx56, align 4235 %dec57 = add nsw i32 %tmp13, -1236 store i32 %dec57, ptr %arrayidx56, align 4237 br label %A4238 239A4: ; preds = %B3, %C3240 %arrayidx61 = getelementptr inbounds i16, ptr %In, i64 4241 %tmp14 = load i16, ptr %arrayidx61, align 2242 %conv62 = sext i16 %tmp14 to i32243 %cmp64 = icmp slt i16 %tmp14, 1041244 br i1 %cmp64, label %B4, label %C4245 246B4: ; preds = %A4247 %arrayidx69 = getelementptr inbounds i32, ptr %Out, i64 1041248 %tmp15 = load i32, ptr %arrayidx69, align 4249 %inc70 = add nsw i32 %tmp15, 1250 store i32 %inc70, ptr %arrayidx69, align 4251 br label %A5252 253C4: ; preds = %A4254 %idxprom72 = sext i16 %tmp14 to i64255 %arrayidx73 = getelementptr inbounds i32, ptr %Out, i64 %idxprom72256 %tmp16 = load i32, ptr %arrayidx73, align 4257 %dec74 = add nsw i32 %tmp16, -1258 store i32 %dec74, ptr %arrayidx73, align 4259 %phitmp = add nsw i32 %conv62, 42260 br label %A5261 262A5: ; preds = %B4, %C4263 %V.2 = phi i32 [ 1083, %B4 ], [ %phitmp, %C4 ]264 %arrayidx78 = getelementptr inbounds i16, ptr %In, i64 5265 %tmp17 = load i16, ptr %arrayidx78, align 2266 %conv79 = sext i16 %tmp17 to i32267 %cmp81 = icmp slt i32 %conv79, %V.2268 br i1 %cmp81, label %B5, label %C5269 270B5: ; preds = %A5271 %idxprom85 = sext i32 %V.2 to i64272 %arrayidx86 = getelementptr inbounds i32, ptr %Out, i64 %idxprom85273 %tmp18 = load i32, ptr %arrayidx86, align 4274 %inc87 = add nsw i32 %tmp18, 1275 store i32 %inc87, ptr %arrayidx86, align 4276 br label %A6277 278C5: ; preds = %A5279 %idxprom89 = sext i16 %tmp17 to i64280 %arrayidx90 = getelementptr inbounds i32, ptr %Out, i64 %idxprom89281 %tmp19 = load i32, ptr %arrayidx90, align 4282 %dec91 = add nsw i32 %tmp19, -1283 store i32 %dec91, ptr %arrayidx90, align 4284 br label %A6285 286A6: ; preds = %B5, %C5287 %arrayidx95 = getelementptr inbounds i16, ptr %In, i64 6288 %tmp20 = load i16, ptr %arrayidx95, align 2289 %conv96 = sext i16 %tmp20 to i32290 %cmp98 = icmp slt i16 %tmp20, 1041291 br i1 %cmp98, label %B6, label %C6292 293B6: ; preds = %A6294 %arrayidx103 = getelementptr inbounds i32, ptr %Out, i64 1041295 %tmp21 = load i32, ptr %arrayidx103, align 4296 %inc104 = add nsw i32 %tmp21, 1297 store i32 %inc104, ptr %arrayidx103, align 4298 br label %A7299 300C6: ; preds = %A6301 %idxprom106 = sext i16 %tmp20 to i64302 %arrayidx107 = getelementptr inbounds i32, ptr %Out, i64 %idxprom106303 %tmp22 = load i32, ptr %arrayidx107, align 4304 %dec108 = add nsw i32 %tmp22, -1305 store i32 %dec108, ptr %arrayidx107, align 4306 %phitmp1 = add nsw i32 %conv96, 42307 br label %A7308 309A7: ; preds = %B6, %C6310 %V.3 = phi i32 [ 1083, %B6 ], [ %phitmp1, %C6 ]311 %arrayidx112 = getelementptr inbounds i16, ptr %In, i64 7312 %tmp23 = load i16, ptr %arrayidx112, align 2313 %conv113 = sext i16 %tmp23 to i32314 %cmp115 = icmp slt i32 %conv113, %V.3315 br i1 %cmp115, label %B7, label %C7316 317B7: ; preds = %A7318 %idxprom119 = sext i32 %V.3 to i64319 %arrayidx120 = getelementptr inbounds i32, ptr %Out, i64 %idxprom119320 %tmp24 = load i32, ptr %arrayidx120, align 4321 %inc121 = add nsw i32 %tmp24, 1322 store i32 %inc121, ptr %arrayidx120, align 4323 br label %A8324 325C7: ; preds = %A7326 %idxprom123 = sext i16 %tmp23 to i64327 %arrayidx124 = getelementptr inbounds i32, ptr %Out, i64 %idxprom123328 %tmp25 = load i32, ptr %arrayidx124, align 4329 %dec125 = add nsw i32 %tmp25, -1330 store i32 %dec125, ptr %arrayidx124, align 4331 br label %A8332 333A8: ; preds = %B7, %C7334 %arrayidx129 = getelementptr inbounds i16, ptr %In, i64 8335 %tmp26 = load i16, ptr %arrayidx129, align 2336 %cmp132 = icmp slt i16 %tmp26, 1041337 br i1 %cmp132, label %B8, label %C8338 339B8: ; preds = %A8340 %arrayidx137 = getelementptr inbounds i32, ptr %Out, i64 1041341 %tmp27 = load i32, ptr %arrayidx137, align 4342 %inc138 = add nsw i32 %tmp27, 1343 store i32 %inc138, ptr %arrayidx137, align 4344 br label %FINAL345 346C8: ; preds = %A8347 %idxprom140 = sext i16 %tmp26 to i64348 %arrayidx141 = getelementptr inbounds i32, ptr %Out, i64 %idxprom140349 %tmp28 = load i32, ptr %arrayidx141, align 4350 %dec142 = add nsw i32 %tmp28, -1351 store i32 %dec142, ptr %arrayidx141, align 4352 %phitmp2 = sext i16 %tmp26 to i64353 br label %FINAL354 355FINAL: ; preds = %C8, %B8356 %V.4 = phi i64 [ 1041, %B8 ], [ %phitmp2, %C8 ]357 %arrayidx145 = getelementptr inbounds i32, ptr %Out, i64 %V.4358 %tmp29 = load i32, ptr %arrayidx145, align 4359 %inc146 = add nsw i32 %tmp29, 1360 store i32 %inc146, ptr %arrayidx145, align 4361 br label %ScopExit362 363ScopExit:364 ret void365}366