67 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<mse>' -polly-print-mse -disable-output < %s | FileCheck %s2;3; Verify that the accesses are correctly expanded for MemoryKind::Array4;5; Original source code :6;7; #define Ni 20008; #define Nj 30009;10; double mse(double A[Ni], double B[Nj]) {11; int i;12; double tmp = 6;13; for (i = 0; i < Ni; i++) {14; for (int j = 0; j<Nj; j++) {15; B[j] = j;16; }17; A[i] = B[i];18; }19; return tmp;20; }21;22; Check if the expanded SAI are created23;24; CHECK: double MemRef_B_Stmt_for_body3_expanded[2000][3000]; // Element size 825;26; Check if the memory accesses are modified27;28; CHECK: new: { Stmt_for_body3[i0, i1] -> MemRef_B_Stmt_for_body3_expanded[i0, i1] };29; CHECK: new: { Stmt_for_end[i0] -> MemRef_B_Stmt_for_body3_expanded[i0, i0] };30;31target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"32target triple = "x86_64-unknown-linux-gnu"33 34define double @mse(ptr %A, ptr %B) {35entry:36 br label %entry.split37 38entry.split: ; preds = %entry39 br label %for.body40 41for.body: ; preds = %entry.split, %for.end42 %indvars.iv3 = phi i64 [ 0, %entry.split ], [ %indvars.iv.next4, %for.end ]43 br label %for.body344 45for.body3: ; preds = %for.body, %for.body346 %indvars.iv = phi i64 [ 0, %for.body ], [ %indvars.iv.next, %for.body3 ]47 %0 = trunc i64 %indvars.iv to i3248 %conv = sitofp i32 %0 to double49 %arrayidx = getelementptr inbounds double, ptr %B, i64 %indvars.iv50 store double %conv, ptr %arrayidx, align 851 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 152 %exitcond = icmp ne i64 %indvars.iv.next, 300053 br i1 %exitcond, label %for.body3, label %for.end54 55for.end: ; preds = %for.body356 %arrayidx5 = getelementptr inbounds double, ptr %B, i64 %indvars.iv357 %1 = load i64, ptr %arrayidx5, align 858 %arrayidx7 = getelementptr inbounds double, ptr %A, i64 %indvars.iv359 store i64 %1, ptr %arrayidx7, align 860 %indvars.iv.next4 = add nuw nsw i64 %indvars.iv3, 161 %exitcond5 = icmp ne i64 %indvars.iv.next4, 200062 br i1 %exitcond5, label %for.body, label %for.end1063 64for.end10: ; preds = %for.end65 ret double 6.000000e+0066}67