108 lines · plain
1; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb -polly-print-scops '-passes=polly-custom<import-jscop>' -polly-print-import-jscop -polly-import-jscop-postfix=transformed -disable-output < %s | FileCheck %s2; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb '-passes=polly-custom<import-jscop;codegen>' -polly-import-jscop-postfix=transformed -S < %s | FileCheck %s --check-prefix=CODEGEN3;4; #define Ni 10565; #define Nj 10566; #define Nk 10247;8; void create_arrays_heap(double beta, double A[Ni][Nk], double B[Ni][Nj]) {9; int i,j,k;10;11; for (i = 0; i < Ni; i++) {12; for (j = 0; j < Nj; j++) {13; for (k = 0; k < Nk; ++k) {14; B[i][j] = beta * A[i][k];15; }16; }17; }18; }19;20; Check if the info from the JSON file has been analysed without errors.21; CHECK: Arrays {22; CHECK: double MemRef_A[*][1024]; // Element size 823; CHECK: double MemRef_beta; // Element size 824; CHECK: double MemRef_B[*][1056]; // Element size 825; CHECK: double D[270336]; // Element size 826; CHECK: double E[270336][200000]; // Element size 827; CHECK: i64 F[270336]; // Element size 828;29; Check if there are the 3 expected malloc calls with the right parameters at polly.start.30; %D : size(D) = product_all_dimensions*sizeof(type) = 270336*8 = 2162688 cast to double*31; %E : size(E) = 270336*200000*8 = 432537600000 cast to double*32; %F : size(F) = 270336*8 = 2162688 cast to i64*33; CODEGEN: polly.start:34; CODEGEN: %D = tail call ptr @malloc(i64 2162688)35; CODEGEN: %E = tail call ptr @malloc(i64 432537600000)36; CODEGEN: %F = tail call ptr @malloc(i64 2162688)37;38; Check if there are the 3 expected malloc calls with the right parameters at polly.exiting.39; Cast to i8* before freeing because malloc give us a i8 and free is waiting for a i8*40; CODEGEN: polly.exiting:41; CODEGEN: tail call void @free(ptr %D)42; CODEGEN: tail call void @free(ptr %E)43; CODEGEN: tail call void @free(ptr %F)44;45; Check if the new access for array E is present.46; CODEGEN: %polly.access.mul.{{.*}} = mul nsw i64 %polly.indvar, 20000047; CODEGEN: %polly.access.add.{{.*}} = add nsw i64 %polly.access.mul.{{.*}}, %48; CODEGEN: %polly.access.{{.*}} = getelementptr double, ptr %E, i64 %polly.access.add.{{.*}}49;50; ModuleID = 'create_arrays_heap.ll'51;52target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"53target triple = "x86_64-unknown-linux-gnu"54 55; Function Attrs: nounwind uwtable56define void @create_arrays_heap(double %beta, ptr nocapture readonly %A, ptr nocapture %B) local_unnamed_addr {57entry:58 br label %for.cond1.preheader59 60for.cond1.preheader: ; preds = %for.inc16, %entry61 %indvars.iv35 = phi i64 [ 0, %entry ], [ %indvars.iv.next36, %for.inc16 ]62 br label %for.cond4.preheader63 64for.cond4.preheader: ; preds = %for.inc13, %for.cond1.preheader65 %indvars.iv32 = phi i64 [ 0, %for.cond1.preheader ], [ %indvars.iv.next33, %for.inc13 ]66 %arrayidx12 = getelementptr inbounds [1056 x double], ptr %B, i64 %indvars.iv35, i64 %indvars.iv3267 br label %for.body668 69for.body6: ; preds = %for.body6, %for.cond4.preheader70 %indvars.iv = phi i64 [ 0, %for.cond4.preheader ], [ %indvars.iv.next.3, %for.body6 ]71 %arrayidx8 = getelementptr inbounds [1024 x double], ptr %A, i64 %indvars.iv35, i64 %indvars.iv72 %0 = load double, ptr %arrayidx8, align 873 %mul = fmul double %0, %beta74 store double %mul, ptr %arrayidx12, align 875 %indvars.iv.next = or disjoint i64 %indvars.iv, 176 %arrayidx8.1 = getelementptr inbounds [1024 x double], ptr %A, i64 %indvars.iv35, i64 %indvars.iv.next77 %1 = load double, ptr %arrayidx8.1, align 878 %mul.1 = fmul double %1, %beta79 store double %mul.1, ptr %arrayidx12, align 880 %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 281 %arrayidx8.2 = getelementptr inbounds [1024 x double], ptr %A, i64 %indvars.iv35, i64 %indvars.iv.next.182 %2 = load double, ptr %arrayidx8.2, align 883 %mul.2 = fmul double %2, %beta84 store double %mul.2, ptr %arrayidx12, align 885 %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 386 %arrayidx8.3 = getelementptr inbounds [1024 x double], ptr %A, i64 %indvars.iv35, i64 %indvars.iv.next.287 %3 = load double, ptr %arrayidx8.3, align 888 %mul.3 = fmul double %3, %beta89 store double %mul.3, ptr %arrayidx12, align 890 %indvars.iv.next.3 = add nsw i64 %indvars.iv, 491 %exitcond.3 = icmp eq i64 %indvars.iv.next.3, 102492 br i1 %exitcond.3, label %for.inc13, label %for.body693 94for.inc13: ; preds = %for.body695 %indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 196 %exitcond34 = icmp eq i64 %indvars.iv.next33, 105697 br i1 %exitcond34, label %for.inc16, label %for.cond4.preheader98 99for.inc16: ; preds = %for.inc13100 %indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1101 %exitcond37 = icmp eq i64 %indvars.iv.next36, 1056102 br i1 %exitcond37, label %for.end18, label %for.cond1.preheader103 104for.end18: ; preds = %for.inc16105 ret void106}107 108