110 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<scops>' -polly-print-scops -polly-invariant-load-hoisting=true -disable-output < %s 2>&1 | FileCheck %s2;3; CHECK: Invariant Accesses: {4; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]5; CHECK-NEXT: [bounds2, bounds1, bounds0] -> { Stmt_for_cond[i0] -> MemRef_bounds[2] };6; CHECK-NEXT: Execution Context: [bounds2, bounds1, bounds0] -> { : }7; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]8; CHECK-NEXT: [bounds2, bounds1, bounds0] -> { Stmt_for_cond_1[i0, i1] -> MemRef_bounds[1] };9; CHECK-NEXT: Execution Context: [bounds2, bounds1, bounds0] -> { : }10; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]11; CHECK-NEXT: [bounds2, bounds1, bounds0] -> { Stmt_for_cond_4[i0, i1, i2] -> MemRef_bounds[0] };12; CHECK-NEXT: Execution Context: [bounds2, bounds1, bounds0] -> { : }13; CHECK-NEXT: }14;15; CHECK: p0: %bounds216; CHECK-NEXT: p1: %bounds117; CHECK-NEXT: p2: %bounds018;19; CHECK: Statements {20; CHECK-NEXT: Stmt_for_body_621; CHECK-NEXT: Domain :=22; CHECK-NEXT: [bounds2, bounds1, bounds0] -> { Stmt_for_body_6[i0, i1, i2] : 0 <= i0 < bounds2 and 0 <= i1 < bounds1 and 0 <= i2 < bounds0 };23; CHECK-NEXT: Schedule :=24; CHECK-NEXT: [bounds2, bounds1, bounds0] -> { Stmt_for_body_6[i0, i1, i2] -> [i0, i1, i2] };25; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]26; CHECK-NEXT: [bounds2, bounds1, bounds0] -> { Stmt_for_body_6[i0, i1, i2] -> MemRef_data[i0, i1, i2] };27; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]28; CHECK-NEXT: [bounds2, bounds1, bounds0] -> { Stmt_for_body_6[i0, i1, i2] -> MemRef_data[i0, i1, i2] };29; CHECK-NEXT: }30;31; int bounds[3];32; double data[1024][1024][1024];33;34; void foo() {35; int i, j, k;36; for (k = 0; k < bounds[2]; k++)37; for (j = 0; j < bounds[1]; j++)38; for (i = 0; i < bounds[0]; i++)39; data[k][j][i] += i + j + k;40; }41;42target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"43 44@bounds = common global [3 x i32] zeroinitializer, align 445@data = common global [1024 x [1024 x [1024 x double]]] zeroinitializer, align 1646 47define void @foo() {48entry:49 br label %for.cond50 51for.cond: ; preds = %for.inc.16, %entry52 %indvars.iv5 = phi i64 [ %indvars.iv.next6, %for.inc.16 ], [ 0, %entry ]53 %bounds2 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @bounds, i64 0, i64 2), align 454 %tmp7 = sext i32 %bounds2 to i6455 %cmp = icmp slt i64 %indvars.iv5, %tmp756 br i1 %cmp, label %for.body, label %for.end.1857 58for.body: ; preds = %for.cond59 br label %for.cond.160 61for.cond.1: ; preds = %for.inc.13, %for.body62 %indvars.iv3 = phi i64 [ %indvars.iv.next4, %for.inc.13 ], [ 0, %for.body ]63 %bounds1 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @bounds, i64 0, i64 1), align 464 %tmp9 = sext i32 %bounds1 to i6465 %cmp2 = icmp slt i64 %indvars.iv3, %tmp966 br i1 %cmp2, label %for.body.3, label %for.end.1567 68for.body.3: ; preds = %for.cond.169 br label %for.cond.470 71for.cond.4: ; preds = %for.inc, %for.body.372 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %for.body.3 ]73 %bounds0 = load i32, ptr @bounds, align 474 %tmp11 = sext i32 %bounds0 to i6475 %cmp5 = icmp slt i64 %indvars.iv, %tmp1176 br i1 %cmp5, label %for.body.6, label %for.end77 78for.body.6: ; preds = %for.cond.479 %tmp12 = add nsw i64 %indvars.iv, %indvars.iv380 %tmp13 = add nsw i64 %tmp12, %indvars.iv581 %tmp14 = trunc i64 %tmp13 to i3282 %conv = sitofp i32 %tmp14 to double83 %arrayidx11 = getelementptr inbounds [1024 x [1024 x [1024 x double]]], ptr @data, i64 0, i64 %indvars.iv5, i64 %indvars.iv3, i64 %indvars.iv84 %tmp15 = load double, ptr %arrayidx11, align 885 %add12 = fadd double %tmp15, %conv86 store double %add12, ptr %arrayidx11, align 887 br label %for.inc88 89for.inc: ; preds = %for.body.690 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 191 br label %for.cond.492 93for.end: ; preds = %for.cond.494 br label %for.inc.1395 96for.inc.13: ; preds = %for.end97 %indvars.iv.next4 = add nuw nsw i64 %indvars.iv3, 198 br label %for.cond.199 100for.end.15: ; preds = %for.cond.1101 br label %for.inc.16102 103for.inc.16: ; preds = %for.end.15104 %indvars.iv.next6 = add nuw nsw i64 %indvars.iv5, 1105 br label %for.cond106 107for.end.18: ; preds = %for.cond108 ret void109}110