brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.4 KiB · dde847b Raw
121 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<scops>' -polly-print-scops -disable-output < %s 2>&1 | FileCheck %s2;3;    struct com {4;      double Real;5;      double Img;6;    };7;8;    void foo(long n, struct com A[][n]) {9;      for (long i = 0; i < 100; i++)10;        for (long j = 0; j < 1000; j++)11;          A[i][j].Real += A[i][j].Img;12;    }13;14;    int main() {15;      struct com A[100][1000];16;      foo(1000, A);17;    }18 19; CHECK:      Arrays {20; CHECK-NEXT:     double MemRef_A[*][(2 * %n)]; // Element size 821; CHECK-NEXT: }22 23; CHECK: 	Stmt_for_body324; CHECK-NEXT:         Domain :=25; CHECK-NEXT:             [n] -> { Stmt_for_body3[i0, i1] : 0 <= i0 <= 99 and 0 <= i1 <= 999 };26; CHECK-NEXT:         Schedule :=27; CHECK-NEXT:             [n] -> { Stmt_for_body3[i0, i1] -> [i0, i1] };28; CHECK-NEXT:         ReadAccess :=	[Reduction Type: NONE] [Scalar: 0]29; CHECK-NEXT:             [n] -> { Stmt_for_body3[i0, i1] -> MemRef_A[i0, 1 + 2i1] };30; CHECK-NEXT:         ReadAccess :=	[Reduction Type: NONE] [Scalar: 0]31; CHECK-NEXT:             [n] -> { Stmt_for_body3[i0, i1] -> MemRef_A[i0, 2i1] };32; CHECK-NEXT:         MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 0]33; CHECK-NEXT:             [n] -> { Stmt_for_body3[i0, i1] -> MemRef_A[i0, 2i1] };34 35source_filename = "/tmp/test.c"36target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"37 38%struct.com = type { double, double }39%struct.com2 = type { [20000000000 x double] }40 41define void @foo(i64 %n, ptr %A) {42entry:43  br label %for.cond44 45for.cond:                                         ; preds = %for.inc7, %entry46  %i.0 = phi i64 [ 0, %entry ], [ %inc8, %for.inc7 ]47  %exitcond1 = icmp ne i64 %i.0, 10048  br i1 %exitcond1, label %for.body, label %for.end949 50for.body:                                         ; preds = %for.cond51  br label %for.cond152 53for.cond1:                                        ; preds = %for.inc, %for.body54  %j.0 = phi i64 [ 0, %for.body ], [ %inc, %for.inc ]55  %exitcond = icmp ne i64 %j.0, 100056  br i1 %exitcond, label %for.body3, label %for.end57 58for.body3:                                        ; preds = %for.cond159  %tmp = mul nsw i64 %i.0, %n60  %arrayidx = getelementptr inbounds %struct.com, ptr %A, i64 %tmp61  %arrayidx4 = getelementptr inbounds %struct.com, ptr %arrayidx, i64 %j.062  %Img = getelementptr inbounds %struct.com, ptr %arrayidx4, i64 0, i32 163  %tmp2 = load double, ptr %Img, align 864  %tmp3 = mul nsw i64 %i.0, %n65  %arrayidx5 = getelementptr inbounds %struct.com, ptr %A, i64 %tmp366  %arrayidx6 = getelementptr inbounds %struct.com, ptr %arrayidx5, i64 %j.067  %tmp4 = load double, ptr %arrayidx6, align 868  %add = fadd double %tmp4, %tmp269  store double %add, ptr %arrayidx6, align 870  br label %for.inc71 72for.inc:                                          ; preds = %for.body373  %inc = add nuw nsw i64 %j.0, 174  br label %for.cond175 76for.end:                                          ; preds = %for.cond177  br label %for.inc778 79for.inc7:                                         ; preds = %for.end80  %inc8 = add nuw nsw i64 %i.0, 181  br label %for.cond82 83for.end9:                                         ; preds = %for.cond84  ret void85}86 87; CHECK:      Arrays {88; CHECK-NEXT:     double MemRef_O[*][%n]; // Element size 889; CHECK-NEXT: }90 91define void @foo_overflow(i64 %n, ptr nocapture %O) local_unnamed_addr #0 {92entry:93  br label %for.body94 95for.cond.cleanup:                                 ; preds = %for.cond.cleanup396  ret void97 98for.body:                                         ; preds = %for.cond.cleanup3, %entry99  %i.024 = phi i64 [ 0, %entry ], [ %inc12, %for.cond.cleanup3 ]100  %0 = mul nsw i64 %i.024, %n101  %arrayidx = getelementptr inbounds %struct.com2, ptr %O, i64 %0102  br label %for.body4103 104for.cond.cleanup3:                                ; preds = %for.body4105  %inc12 = add nuw nsw i64 %i.024, 1106  %exitcond25 = icmp eq i64 %inc12, 100107  br i1 %exitcond25, label %for.cond.cleanup, label %for.body108 109for.body4:                                        ; preds = %for.body4, %for.body110  %j.023 = phi i64 [ 0, %for.body ], [ %inc, %for.body4 ]111  %arrayidx5 = getelementptr inbounds %struct.com2, ptr %arrayidx, i64 %j.023112  %arrayidx6 = getelementptr inbounds [20000000000 x double], ptr %arrayidx5, i64 0, i64 1113  %1 = load double, ptr %arrayidx6, align 8114  %2 = load double, ptr %arrayidx5, align 8115  %add = fadd double %1, %2116  store double %add, ptr %arrayidx5, align 8117  %inc = add nuw nsw i64 %j.023, 1118  %exitcond = icmp eq i64 %inc, 1000119  br i1 %exitcond, label %for.cond.cleanup3, label %for.body4120}121