1 ; RUN: opt %loadPolly -disable-output -polly-print-scops < %s | FileCheck %s
2 ; RUN: opt %loadPolly -disable-output -polly-print-function-scops < %s | FileCheck %s
4 ; Check that the constant part of the N * M * 4 expression is not part of the
5 ; parameter but explicit in the access function. This can avoid existentially
6 ; quantified variables, e.g., when computing the stride.
9 ; CHECK: [N, p_1] -> { Stmt_for_body[i0] -> MemRef_A[4p_1 + i0] };
11 ; void f(int *A, int N, int M) {
12 ; for (int i = 0; i < N; i++)
13 ; A[i + N * M * 4] = i;
16 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
18 define void @f(i32* %A, i32 %N, i32 %M) {
20 %tmp = sext i32 %N to i64
23 for.cond: ; preds = %for.inc, %entry
24 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
25 %cmp = icmp slt i64 %indvars.iv, %tmp
26 br i1 %cmp, label %for.body, label %for.end
28 for.body: ; preds = %for.cond
29 %mul = mul nsw i32 %N, %M
30 %mul2 = mul nsw i32 %mul, 4
31 %tmp2 = sext i32 %mul2 to i64
32 %tmp3 = add nsw i64 %indvars.iv, %tmp2
33 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %tmp3
34 %tmp4 = trunc i64 %indvars.iv to i32
35 store i32 %tmp4, i32* %arrayidx, align 4
38 for.inc: ; preds = %for.body
39 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
42 for.end: ; preds = %for.cond