1 ; RUN: opt %loadPolly -polly-mse -polly-print-scops -disable-output < %s | FileCheck %s
2 ; RUN: opt %loadNPMPolly "-passes=scop(print<polly-mse>)" -disable-output < %s | FileCheck %s
4 ; Verify that the accesses are correctly expanded for MemoryKind::Array
6 ; Original source code :
11 ; double mse(double A[Ni], double B[Nj]) {
14 ; for (i = 0; i < Ni; i++) {
15 ; for (int j = 0; j<Nj; j++) {
23 ; Check if the expanded SAI are created
25 ; CHECK: double MemRef_B_Stmt_for_body3_expanded[2000][3000]; // Element size 8
27 ; Check if the memory accesses are modified
29 ; CHECK: new: { Stmt_for_body3[i0, i1] -> MemRef_B_Stmt_for_body3_expanded[i0, i1] };
30 ; CHECK: new: { Stmt_for_end[i0] -> MemRef_B_Stmt_for_body3_expanded[i0, i0] };
32 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
33 target triple = "x86_64-unknown-linux-gnu"
35 define double @mse(ptr %A, ptr %B) {
39 entry.split: ; preds = %entry
42 for.body: ; preds = %entry.split, %for.end
43 %indvars.iv3 = phi i64 [ 0, %entry.split ], [ %indvars.iv.next4, %for.end ]
46 for.body3: ; preds = %for.body, %for.body3
47 %indvars.iv = phi i64 [ 0, %for.body ], [ %indvars.iv.next, %for.body3 ]
48 %0 = trunc i64 %indvars.iv to i32
49 %conv = sitofp i32 %0 to double
50 %arrayidx = getelementptr inbounds double, ptr %B, i64 %indvars.iv
51 store double %conv, ptr %arrayidx, align 8
52 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
53 %exitcond = icmp ne i64 %indvars.iv.next, 3000
54 br i1 %exitcond, label %for.body3, label %for.end
56 for.end: ; preds = %for.body3
57 %arrayidx5 = getelementptr inbounds double, ptr %B, i64 %indvars.iv3
58 %1 = load i64, ptr %arrayidx5, align 8
59 %arrayidx7 = getelementptr inbounds double, ptr %A, i64 %indvars.iv3
60 store i64 %1, ptr %arrayidx7, align 8
61 %indvars.iv.next4 = add nuw nsw i64 %indvars.iv3, 1
62 %exitcond5 = icmp ne i64 %indvars.iv.next4, 2000
63 br i1 %exitcond5, label %for.body, label %for.end10
65 for.end10: ; preds = %for.end
66 ret double 6.000000e+00