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
3 ; RUN: opt %loadPolly -polly-mse -polly-print-scops -pass-remarks-analysis="polly-mse" -disable-output < %s 2>&1 | FileCheck %s --check-prefix=MSE
4 ; RUN: opt %loadNPMPolly "-passes=scop(print<polly-mse>)" -pass-remarks-analysis="polly-mse" -disable-output < %s 2>&1 | FileCheck %s --check-prefix=MSE
6 ; Verify that Polly detects problems and does not expand the array
8 ; Original source code :
13 ; double mse(double A[Ni], double B[Nj]) {
16 ; for (i = 0; i < Ni; i++) {
18 ; for (int j = 0; j<Nj; j++) {
26 ; Check that the pass detects that there are more than 1 write access per array.
28 ; MSE: MemRef_B has more than 1 write access.
30 ; Check that the SAI is not expanded
32 ; CHECK-NOT: double MemRef_B2_expanded[2000][3000]; // Element size 8
34 ; Check that the memory accesses are not modified
36 ; CHECK-NOT: new: { Stmt_for_body3[i0, i1] -> MemRef_B_Stmt_for_body3_expanded[i0, i1] };
37 ; CHECK-NOT: new: { Stmt_for_end[i0] -> MemRef_B_Stmt_for_body3_expanded
39 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
40 target triple = "x86_64-unknown-linux-gnu"
42 define double @mse(ptr %A, ptr %B) {
46 entry.split: ; preds = %entry
49 for.body: ; preds = %entry.split, %for.end
50 %indvars.iv3 = phi i64 [ 0, %entry.split ], [ %indvars.iv.next4, %for.end ]
51 %arrayidx = getelementptr inbounds double, ptr %B, i64 %indvars.iv3
52 store double 2.000000e+00, ptr %arrayidx, align 8
55 for.body3: ; preds = %for.body, %for.body3
56 %indvars.iv = phi i64 [ 0, %for.body ], [ %indvars.iv.next, %for.body3 ]
57 %0 = trunc i64 %indvars.iv to i32
58 %conv = sitofp i32 %0 to double
59 %arrayidx5 = getelementptr inbounds double, ptr %B, i64 %indvars.iv
60 store double %conv, ptr %arrayidx5, align 8
61 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
62 %exitcond = icmp ne i64 %indvars.iv.next, 2000
63 br i1 %exitcond, label %for.body3, label %for.end
65 for.end: ; preds = %for.body3
66 %arrayidx7 = getelementptr inbounds double, ptr %B, i64 %indvars.iv3
67 %1 = load i64, ptr %arrayidx7, align 8
68 %arrayidx9 = getelementptr inbounds double, ptr %A, i64 %indvars.iv3
69 store i64 %1, ptr %arrayidx9, align 8
70 %indvars.iv.next4 = add nuw nsw i64 %indvars.iv3, 1
71 %exitcond5 = icmp ne i64 %indvars.iv.next4, 2000
72 br i1 %exitcond5, label %for.body, label %for.end12
74 for.end12: ; preds = %for.end
75 ret double 6.000000e+00