brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · a7aa162 Raw
75 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<mse>' -polly-print-mse -disable-output < %s | FileCheck %s2; RUN: opt %loadNPMPolly '-passes=polly-custom<mse>' -polly-print-mse -pass-remarks-analysis=polly-mse -disable-output < %s 2>&1 | FileCheck %s --check-prefix=MSE3;4; Verify that Polly detects problems and does not expand the array5;6; Original source code :7;8; #define Ni 20009; #define Nj 200010;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 expanded29;30; CHECK-NOT: double MemRef_B2_expanded[2000][3000]; // Element size 831;32; Check that the  memory accesses are not modified33;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_expanded36;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(ptr %A, ptr %B) {41entry:42  br label %entry.split43 44entry.split:                                      ; preds = %entry45  br label %for.body46 47for.body:                                         ; preds = %entry.split, %for.end48  %indvars.iv3 = phi i64 [ 0, %entry.split ], [ %indvars.iv.next4, %for.end ]49  %arrayidx = getelementptr inbounds double, ptr %B, i64 %indvars.iv350  store double 2.000000e+00, ptr %arrayidx, align 851  br label %for.body352 53for.body3:                                        ; preds = %for.body, %for.body354  %indvars.iv = phi i64 [ 0, %for.body ], [ %indvars.iv.next, %for.body3 ]55  %0 = trunc i64 %indvars.iv to i3256  %conv = sitofp i32 %0 to double57  %arrayidx5 = getelementptr inbounds double, ptr %B, i64 %indvars.iv58  store double %conv, ptr %arrayidx5, align 859  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 160  %exitcond = icmp ne i64 %indvars.iv.next, 200061  br i1 %exitcond, label %for.body3, label %for.end62 63for.end:                                          ; preds = %for.body364  %arrayidx7 = getelementptr inbounds double, ptr %B, i64 %indvars.iv365  %1 = load i64, ptr %arrayidx7, align 866  %arrayidx9 = getelementptr inbounds double, ptr %A, i64 %indvars.iv367  store i64 %1, ptr %arrayidx9, align 868  %indvars.iv.next4 = add nuw nsw i64 %indvars.iv3, 169  %exitcond5 = icmp ne i64 %indvars.iv.next4, 200070  br i1 %exitcond5, label %for.body, label %for.end1271 72for.end12:                                        ; preds = %for.end73  ret double 6.000000e+0074}75