99 lines · plain
1; RUN: opt -aa-pipeline=basic-aa %loadNPMPolly -polly-stmt-granularity=bb '-passes=polly-custom<scops>' -polly-print-scops -disable-output < %s 2>&1 | FileCheck %s2;3; CHECK: ReadAccess := [Reduction Type: NONE4; CHECK: { Stmt_for_body[i0] -> MemRef_A[1 + i0] };5; CHECK: ReadAccess := [Reduction Type: NONE6; CHECK: { Stmt_for_body[i0] -> MemRef_A[i0] };7; CHECK: MustWriteAccess := [Reduction Type: NONE8; CHECK: { Stmt_for_body[i0] -> MemRef_first[0] };9; CHECK: ReadAccess := [Reduction Type: +10; CHECK: { Stmt_for_body[i0] -> MemRef_sum[0] };11; CHECK: MustWriteAccess := [Reduction Type: +12; CHECK: { Stmt_for_body[i0] -> MemRef_sum[0] };13; CHECK: ReadAccess := [Reduction Type: NONE14; CHECK: { Stmt_for_body[i0] -> MemRef_A[-1 + i0] };15; CHECK: ReadAccess := [Reduction Type: NONE16; CHECK: { Stmt_for_body[i0] -> MemRef_A[i0] };17; CHECK: MustWriteAccess := [Reduction Type: NONE18; CHECK: { Stmt_for_body[i0] -> MemRef_middle[0] };19; CHECK: ReadAccess := [Reduction Type: *20; CHECK: { Stmt_for_body[i0] -> MemRef_prod[0] };21; CHECK: MustWriteAccess := [Reduction Type: *22; CHECK: { Stmt_for_body[i0] -> MemRef_prod[0] };23; CHECK: ReadAccess := [Reduction Type: NONE24; CHECK: { Stmt_for_body[i0] -> MemRef_A[-1 + i0] };25; CHECK: ReadAccess := [Reduction Type: NONE26; CHECK: { Stmt_for_body[i0] -> MemRef_A[1 + i0] };27; CHECK: MustWriteAccess := [Reduction Type: NONE28; CHECK: { Stmt_for_body[i0] -> MemRef_last[0] };29;30; int first, sum, middle, prod, last;31;32; void f(int * restrict A) {33; int i;34; for (int i = 0; i < 100; i++) {35; first = A[i+1] + A[i];36; sum += i * 3;37; middle = A[i-1] + A[i];38; prod *= (i + 3);39; last = A[i-1] + A[i+1];40; }41; }42target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"43 44@first = common global i32 0, align 445@sum = common global i32 0, align 446@middle = common global i32 0, align 447@prod = common global i32 0, align 448@last = common global i32 0, align 449 50define void @f(ptr noalias %A) {51entry:52 br label %for.cond53 54for.cond: ; preds = %for.inc, %entry55 %i1.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]56 %exitcond = icmp ne i32 %i1.0, 10057 br i1 %exitcond, label %for.body, label %for.end58 59for.body: ; preds = %for.cond60 %add = add nsw i32 %i1.0, 161 %arrayidx = getelementptr inbounds i32, ptr %A, i32 %add62 %tmp = load i32, ptr %arrayidx, align 463 %arrayidx2 = getelementptr inbounds i32, ptr %A, i32 %i1.064 %tmp1 = load i32, ptr %arrayidx2, align 465 %add3 = add nsw i32 %tmp, %tmp166 store i32 %add3, ptr @first, align 467 %mul = mul nsw i32 %i1.0, 368 %tmp2 = load i32, ptr @sum, align 469 %add4 = add nsw i32 %tmp2, %mul70 store i32 %add4, ptr @sum, align 471 %sub = add nsw i32 %i1.0, -172 %arrayidx5 = getelementptr inbounds i32, ptr %A, i32 %sub73 %tmp3 = load i32, ptr %arrayidx5, align 474 %arrayidx6 = getelementptr inbounds i32, ptr %A, i32 %i1.075 %tmp4 = load i32, ptr %arrayidx6, align 476 %add7 = add nsw i32 %tmp3, %tmp477 store i32 %add7, ptr @middle, align 478 %add8 = add nsw i32 %i1.0, 379 %tmp5 = load i32, ptr @prod, align 480 %mul9 = mul nsw i32 %tmp5, %add881 store i32 %mul9, ptr @prod, align 482 %sub10 = add nsw i32 %i1.0, -183 %arrayidx11 = getelementptr inbounds i32, ptr %A, i32 %sub1084 %tmp6 = load i32, ptr %arrayidx11, align 485 %add12 = add nsw i32 %i1.0, 186 %arrayidx13 = getelementptr inbounds i32, ptr %A, i32 %add1287 %tmp7 = load i32, ptr %arrayidx13, align 488 %add14 = add nsw i32 %tmp6, %tmp789 store i32 %add14, ptr @last, align 490 br label %for.inc91 92for.inc: ; preds = %for.body93 %inc = add nsw i32 %i1.0, 194 br label %for.cond95 96for.end: ; preds = %for.cond97 ret void98}99