brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.0 KiB · 994d49e Raw
82 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<scops>' -polly-print-scops -disable-output < %s 2>&1 | FileCheck %s2; RUN: opt %loadNPMPolly '-passes=polly-custom<scops>' -polly-print-scops -disable-output < %s 2>&1 | FileCheck %s3 4;    void foo(float A[][20][30], long n, long m, long p) {5;      for (long i = 0; i < n; i++)6;        for (long j = 0; j < m; j++)7;          for (long k = 0; k < p; k++)8;            A[i][j][k] = i + j + k;9;    }10 11; For the above code we want to assume that all memory accesses are within the12; bounds of the array A. In C (and LLVM-IR) this is not required, such that out13; of bounds accesses are valid. However, as such accesses are uncommon, cause14; complicated dependence pattern and as a result make dependence analysis more15; costly and may prevent or hinder useful program transformations, we assume16; absence of out-of-bound accesses. To do so we derive the set of parameter17; values for which our assumption holds.18 19; CHECK: Assumed Context20; CHECK-NEXT: [n, m, p] -> {  :21; CHECK-DAG:                    p <= 3022; CHECK-DAG:                     and23; CHECK-DAG:                    m <= 2024; CHECK:                   }25 26target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"27 28define void @foo(ptr %A, i64 %n, i64 %m, i64 %p) {29entry:30  br label %for.cond31 32for.cond:                                         ; preds = %for.inc13, %entry33  %i.0 = phi i64 [ 0, %entry ], [ %inc14, %for.inc13 ]34  %cmp = icmp slt i64 %i.0, %n35  br i1 %cmp, label %for.body, label %for.end1536 37for.body:                                         ; preds = %for.cond38  br label %for.cond139 40for.cond1:                                        ; preds = %for.inc10, %for.body41  %j.0 = phi i64 [ 0, %for.body ], [ %inc11, %for.inc10 ]42  %cmp2 = icmp slt i64 %j.0, %m43  br i1 %cmp2, label %for.body3, label %for.end1244 45for.body3:                                        ; preds = %for.cond146  br label %for.cond447 48for.cond4:                                        ; preds = %for.inc, %for.body349  %k.0 = phi i64 [ 0, %for.body3 ], [ %inc, %for.inc ]50  %cmp5 = icmp slt i64 %k.0, %p51  br i1 %cmp5, label %for.body6, label %for.end52 53for.body6:                                        ; preds = %for.cond454  %add = add nsw i64 %i.0, %j.055  %add7 = add nsw i64 %add, %k.056  %conv = sitofp i64 %add7 to float57  %arrayidx9 = getelementptr inbounds [20 x [30 x float]], ptr %A, i64 %i.0, i64 %j.0, i64 %k.058  store float %conv, ptr %arrayidx9, align 459  br label %for.inc60 61for.inc:                                          ; preds = %for.body662  %inc = add nsw i64 %k.0, 163  br label %for.cond464 65for.end:                                          ; preds = %for.cond466  br label %for.inc1067 68for.inc10:                                        ; preds = %for.end69  %inc11 = add nsw i64 %j.0, 170  br label %for.cond171 72for.end12:                                        ; preds = %for.cond173  br label %for.inc1374 75for.inc13:                                        ; preds = %for.end1276  %inc14 = add nsw i64 %i.0, 177  br label %for.cond78 79for.end15:                                        ; preds = %for.cond80  ret void81}82