70 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<deps>' -polly-print-deps -aa-pipeline=basic-aa -disable-output < %s | FileCheck %s2;3; CHECK: Reduction dependences:4; CHECK-NEXT: [N] -> { Stmt_for_body3[i0, i1] -> Stmt_for_body3[i0, 1 + i1] : 0 <= i0 <= 1023 and i1 >= 0 and 1024 - N + i0 <= i1 <= 1022 }5;6; void f(int N, int * restrict sums, int * restrict escape) {7; for (int i = 0; i < 1024; i++) {8; for (int j = 0; j < 1024; j++) {9; sums[i] += 5;10; if (N - i + j < 1024)11; escape[N - i + j] = sums[i];12; }13; }14; }15target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"16 17define void @f(i32 %N, ptr noalias %sums, ptr noalias %escape) {18entry:19 br label %for.cond20 21for.cond: ; preds = %for.inc10, %entry22 %i.0 = phi i32 [ 0, %entry ], [ %inc11, %for.inc10 ]23 %exitcond1 = icmp ne i32 %i.0, 102424 br i1 %exitcond1, label %for.body, label %for.end1225 26for.body: ; preds = %for.cond27 br label %for.cond128 29for.cond1: ; preds = %for.inc, %for.body30 %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]31 %exitcond = icmp ne i32 %j.0, 102432 br i1 %exitcond, label %for.body3, label %for.end33 34for.body3: ; preds = %for.cond135 %arrayidx = getelementptr inbounds i32, ptr %sums, i32 %i.036 %tmp = load i32, ptr %arrayidx, align 437 %add = add nsw i32 %tmp, 538 store i32 %add, ptr %arrayidx, align 439 %sub = sub nsw i32 %N, %i.040 %add4 = add nsw i32 %sub, %j.041 %cmp5 = icmp slt i32 %add4, 102442 br i1 %cmp5, label %if.then, label %if.end43 44if.then: ; preds = %for.body345 %arrayidx6 = getelementptr inbounds i32, ptr %sums, i32 %i.046 %tmp2 = load i32, ptr %arrayidx6, align 447 %sub7 = sub nsw i32 %N, %i.048 %add8 = add nsw i32 %sub7, %j.049 %arrayidx9 = getelementptr inbounds i32, ptr %escape, i32 %add850 store i32 %tmp2, ptr %arrayidx9, align 451 br label %if.end52 53if.end: ; preds = %if.then, %for.body354 br label %for.inc55 56for.inc: ; preds = %if.end57 %inc = add nsw i32 %j.0, 158 br label %for.cond159 60for.end: ; preds = %for.cond161 br label %for.inc1062 63for.inc10: ; preds = %for.end64 %inc11 = add nsw i32 %i.0, 165 br label %for.cond66 67for.end12: ; preds = %for.cond68 ret void69}70