69 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<scops>' -polly-print-scops -disable-output -polly-invariant-load-hoisting=true < %s 2>&1 | FileCheck %s2;3; CHECK: Invariant Accesses: {4; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]5; CHECK-NEXT: MemRef_bounds[0]6; CHECK-NEXT: Execution Context: [bounds0, bounds1] -> { : }7; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]8; CHECK-NEXT: MemRef_bounds[1]9; CHECK-NEXT: Execution Context: [bounds0, bounds1] -> { : }10; CHECK: }11 12; double A[1000][1000];13; long bounds[2];14;15; void foo() {16;17; for (long i = 0; i <= bounds[0]; i++)18; for (long j = 0; j <= bounds[1]; j++)19; A[i][j] += i + j;20; }21;22target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"23 24@bounds = common global [2 x i64] zeroinitializer, align 1625@A = common global [1000 x [1000 x double]] zeroinitializer, align 1626 27define void @foo() {28entry:29 br label %for.cond30 31for.cond: ; preds = %for.inc.6, %entry32 %i.0 = phi i64 [ 0, %entry ], [ %inc7, %for.inc.6 ]33 %bounds0 = load i64, ptr @bounds, align 1634 %cmp = icmp sgt i64 %i.0, %bounds035 br i1 %cmp, label %for.end.8, label %for.body36 37for.body: ; preds = %for.cond38 br label %for.cond.139 40for.cond.1: ; preds = %for.inc, %for.body41 %j.0 = phi i64 [ 0, %for.body ], [ %inc, %for.inc ]42 %bounds1 = load i64, ptr getelementptr inbounds ([2 x i64], ptr @bounds, i64 0, i64 1), align 843 %cmp2 = icmp sgt i64 %j.0, %bounds144 br i1 %cmp2, label %for.end, label %for.body.345 46for.body.3: ; preds = %for.cond.147 %add = add nsw i64 %i.0, %j.048 %conv = sitofp i64 %add to double49 %arrayidx4 = getelementptr inbounds [1000 x [1000 x double]], ptr @A, i64 0, i64 %i.0, i64 %j.050 %tmp2 = load double, ptr %arrayidx4, align 851 %add5 = fadd double %tmp2, %conv52 store double %add5, ptr %arrayidx4, align 853 br label %for.inc54 55for.inc: ; preds = %for.body.356 %inc = add nuw nsw i64 %j.0, 157 br label %for.cond.158 59for.end: ; preds = %for.cond.160 br label %for.inc.661 62for.inc.6: ; preds = %for.end63 %inc7 = add nuw nsw i64 %i.0, 164 br label %for.cond65 66for.end.8: ; preds = %for.cond67 ret void68}69