1; RUN: opt %loadPolly -polly-mse -analyze < %s | FileCheck %s 2; RUN: opt %loadPolly -polly-mse -pass-remarks-analysis="polly-mse" -analyze < %s 2>&1 | FileCheck %s --check-prefix=MSE 3; 4; Verify that Polly detects problems and does not expand the array 5; 6; Original source code : 7; 8; #define Ni 2000 9; #define Nj 2000 10; 11; double mse(double A[Ni], double B[Nj]) { 12; int i; 13; double tmp = 6; 14; for (i = 0; i < Ni; i++) { 15; B[i] = 2; 16; for (int j = 0; j<Nj; j++) { 17; B[j] = j; 18; } 19; A[i] = B[i]; 20; } 21; return tmp; 22; } 23; 24; Check that the pass detects that there are more than 1 write access per array. 25; 26; MSE: MemRef_B has more than 1 write access. 27; 28; Check that the SAI is not expanded 29; 30; CHECK-NOT: double MemRef_B2_expanded[2000][3000]; // Element size 8 31; 32; Check that the memory accesses are not modified 33; 34; CHECK-NOT: new: { Stmt_for_body3[i0, i1] -> MemRef_B_Stmt_for_body3_expanded[i0, i1] }; 35; CHECK-NOT: new: { Stmt_for_end[i0] -> MemRef_B_Stmt_for_body3_expanded 36; 37target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 38target triple = "x86_64-unknown-linux-gnu" 39 40define double @mse(double* %A, double* %B) { 41entry: 42 br label %entry.split 43 44entry.split: ; preds = %entry 45 br label %for.body 46 47for.body: ; preds = %entry.split, %for.end 48 %indvars.iv3 = phi i64 [ 0, %entry.split ], [ %indvars.iv.next4, %for.end ] 49 %arrayidx = getelementptr inbounds double, double* %B, i64 %indvars.iv3 50 store double 2.000000e+00, double* %arrayidx, align 8 51 br label %for.body3 52 53for.body3: ; preds = %for.body, %for.body3 54 %indvars.iv = phi i64 [ 0, %for.body ], [ %indvars.iv.next, %for.body3 ] 55 %0 = trunc i64 %indvars.iv to i32 56 %conv = sitofp i32 %0 to double 57 %arrayidx5 = getelementptr inbounds double, double* %B, i64 %indvars.iv 58 store double %conv, double* %arrayidx5, align 8 59 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 60 %exitcond = icmp ne i64 %indvars.iv.next, 2000 61 br i1 %exitcond, label %for.body3, label %for.end 62 63for.end: ; preds = %for.body3 64 %arrayidx7 = getelementptr inbounds double, double* %B, i64 %indvars.iv3 65 %1 = bitcast double* %arrayidx7 to i64* 66 %2 = load i64, i64* %1, align 8 67 %arrayidx9 = getelementptr inbounds double, double* %A, i64 %indvars.iv3 68 %3 = bitcast double* %arrayidx9 to i64* 69 store i64 %2, i64* %3, 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 73 74for.end12: ; preds = %for.end 75 ret double 6.000000e+00 76} 77