45 lines · plain
1; RUN: opt %loadNPMPolly -disable-output '-passes=polly-custom<scops>' -polly-print-scops < %s 2>&1 | FileCheck %s2; RUN: opt %loadNPMPolly -disable-output '-passes=polly-custom<scops>' -polly-print-scops < %s 2>&1 | FileCheck %s3;4; Check that the constant part of the N * M * 4 expression is not part of the5; parameter but explicit in the access function. This can avoid existentially6; quantified variables, e.g., when computing the stride.7;8; CHECK: p1: (%N * %M)9; CHECK: [N, p_1] -> { Stmt_for_body[i0] -> MemRef_A[4p_1 + i0] };10;11; void f(int *A, int N, int M) {12; for (int i = 0; i < N; i++)13; A[i + N * M * 4] = i;14; }15;16target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"17 18define void @f(i32* %A, i32 %N, i32 %M) {19entry:20 %tmp = sext i32 %N to i6421 br label %for.cond22 23for.cond: ; preds = %for.inc, %entry24 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]25 %cmp = icmp slt i64 %indvars.iv, %tmp26 br i1 %cmp, label %for.body, label %for.end27 28for.body: ; preds = %for.cond29 %mul = mul nsw i32 %N, %M30 %mul2 = mul nsw i32 %mul, 431 %tmp2 = sext i32 %mul2 to i6432 %tmp3 = add nsw i64 %indvars.iv, %tmp233 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %tmp334 %tmp4 = trunc i64 %indvars.iv to i3235 store i32 %tmp4, i32* %arrayidx, align 436 br label %for.inc37 38for.inc: ; preds = %for.body39 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 140 br label %for.cond41 42for.end: ; preds = %for.cond43 ret void44}45