52 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<prepare;scops>' -polly-print-scops -polly-invariant-load-hoisting=true -disable-output < %s 2>&1 | FileCheck %s2;3; void foo(int n, float A[static const restrict n],4; float B[static const restrict n], int j) {5; for (int i = 0; i < n; i++)6; A[i] = B[j];7; }8;9target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"10 11define void @foo(i32 %n, ptr noalias nonnull %A, ptr noalias nonnull %B, i32 %j) {12entry:13 %tmp = sext i32 %n to i6414 %cmp1 = icmp slt i64 0, %tmp15 br i1 %cmp1, label %for.body.lr.ph, label %for.end16 17for.body.lr.ph: ; preds = %entry18 %idxprom = sext i32 %j to i6419 %arrayidx = getelementptr inbounds float, ptr %B, i64 %idxprom20 %tmp2 = load i32, ptr %arrayidx, align 421 br label %for.body22 23for.body: ; preds = %for.body.lr.ph, %for.inc24 %indvars.iv2 = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc ]25 %arrayidx2 = getelementptr inbounds float, ptr %A, i64 %indvars.iv226 store i32 %tmp2, ptr %arrayidx2, align 427 br label %for.inc28 29for.inc: ; preds = %for.body30 %indvars.iv.next = add nuw nsw i64 %indvars.iv2, 131 %exitcond = icmp ne i64 %indvars.iv.next, %tmp32 br i1 %exitcond, label %for.body, label %for.cond.for.end_crit_edge33 34for.cond.for.end_crit_edge: ; preds = %for.inc35 br label %for.end36 37for.end: ; preds = %for.cond.for.end_crit_edge, %entry38 ret void39}40 41; CHECK: Invariant Accesses: {42; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]43; CHECK-NEXT: [n, j] -> { Stmt_{{[a-zA-Z_]*}}[{{[i0]*}}] -> MemRef_B[j] };44; CHECK-NEXT: Execution Context: [n, j] -> { : n > 0 }45; CHECK-NEXT: }46;47; CHECK: Statements {48; CHECK: Stmt_for_body49; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]50; CHECK-NEXT: [n, j] -> { Stmt_for_body[i0] -> MemRef_A[i0] };51; CHECK: }52