brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.8 KiB · 213cc26 Raw
98 lines · plain
1; RUN: opt %loadNPMPolly -polly-parallel '-passes=polly-custom<ast>' -polly-print-ast -disable-output < %s | FileCheck %s -check-prefix=AST2; RUN: opt %loadNPMPolly -polly-parallel '-passes=polly<no-default-opts>' -S < %s | FileCheck %s -check-prefix=IR3;4; float A[100];5;6; void loop_references_outer_ids(long n) {7;   for (long i = 0; i < 100; i++)8;     for (long j = 0; j < 100; j++)9;       for (long k = 0; k < n + i; k++)10;         A[j] += i + j + k;11; }12 13; In this test case we verify that the j-loop is generated as OpenMP parallel14; loop and that the values of 'i' and 'n', needed in the loop bounds of the15; k-loop, are correctly passed to the subfunction.16 17; AST: #pragma minimal dependence distance: 118; AST: for (int c0 = max(0, -n + 1); c0 <= 99; c0 += 1)19; AST:   #pragma omp parallel for20; AST:   for (int c1 = 0; c1 <= 99; c1 += 1)21; AST:     #pragma minimal dependence distance: 122; AST:     for (int c2 = 0; c2 < n + c0; c2 += 1)23; AST:       Stmt_for_body6(c0, c1, c2);24 25; IR:      %polly.par.userContext = alloca { i64, i64 }26; IR: %[[R1:[0-9a-z.]+]] = getelementptr inbounds nuw { i64, i64 }, ptr %polly.par.userContext, i32 0, i32 027; IR-NEXT: store i64 %n, ptr %[[R1]]28; IR-NEXT: %[[R2:[0-9a-z.]+]] = getelementptr inbounds nuw { i64, i64 }, ptr %polly.par.userContext, i32 0, i32 129; IR-NEXT: store i64 %polly.indvar, ptr %[[R2]]30 31; IR-LABEL: @loop_references_outer_ids_polly_subfn(ptr %polly.par.userContext)32; IR:  %[[R3:[0-9a-z.]+]] = getelementptr inbounds nuw { i64, i64 }, ptr %polly.par.userContext, i32 0, i32 033; IR-NEXT:  %[[R4:[0-9a-z.]+]] = load i64, ptr %[[R3]]34; IR-NEXT:  %[[R5:[0-9a-z.]+]] = getelementptr inbounds nuw { i64, i64 }, ptr %polly.par.userContext, i32 0, i32 135; IR-NEXT:  %[[R6:[0-9a-z.]+]] = load i64, ptr %[[R5]]36 37target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"38 39@A = common global [100 x float] zeroinitializer, align 1640 41define void @loop_references_outer_ids(i64 %n) {42entry:43  br label %for.cond44 45for.cond:                                         ; preds = %for.inc03, %entry46  %i.0 = phi i64 [ 0, %entry ], [ %inc04, %for.inc03 ]47  %exitcond1 = icmp ne i64 %i.0, 10048  br i1 %exitcond1, label %for.body, label %for.end1549 50for.body:                                         ; preds = %for.cond51  br label %for.cond152 53for.cond1:                                        ; preds = %for.inc00, %for.body54  %j.0 = phi i64 [ 0, %for.body ], [ %inc01, %for.inc00 ]55  %exitcond = icmp ne i64 %j.0, 10056  br i1 %exitcond, label %for.body3, label %for.end1257 58for.body3:                                        ; preds = %for.cond159  br label %for.cond460 61for.cond4:                                        ; preds = %for.inc, %for.body362  %k.0 = phi i64 [ 0, %for.body3 ], [ %inc, %for.inc ]63  %add = add nsw i64 %i.0, %n64  %cmp5 = icmp slt i64 %k.0, %add65  br i1 %cmp5, label %for.body6, label %for.end66 67for.body6:                                        ; preds = %for.cond468  %add7 = add nsw i64 %i.0, %j.069  %add8 = add nsw i64 %add7, %k.070  %conv = sitofp i64 %add8 to float71  %arrayidx = getelementptr inbounds [100 x float], ptr @A, i64 0, i64 %j.072  %tmp = load float, ptr %arrayidx, align 473  %add9 = fadd float %tmp, %conv74  store float %add9, ptr %arrayidx, align 475  br label %for.inc76 77for.inc:                                          ; preds = %for.body678  %inc = add nsw i64 %k.0, 179  br label %for.cond480 81for.end:                                          ; preds = %for.cond482  br label %for.inc0083 84for.inc00:                                        ; preds = %for.end85  %inc01 = add nsw i64 %j.0, 186  br label %for.cond187 88for.end12:                                        ; preds = %for.cond189  br label %for.inc0390 91for.inc03:                                        ; preds = %for.end1292  %inc04 = add nsw i64 %i.0, 193  br label %for.cond94 95for.end15:                                        ; preds = %for.cond96  ret void97}98