109 lines · plain
1; RUN: opt %loadNPMPolly -aa-pipeline=basic-aa '-passes=polly-custom<deps>' -polly-print-deps -disable-output < %s | FileCheck %s2;3;4; These are the important RAW dependences, as they need to originate/end in only one iteration:5; Stmt_S1[i0, 1023] -> Stmt_S2[i0, o1]6; Stmt_S1[i0, i1] -> Stmt_S2[i0, 0]7;8; These are the important WAW dependences, as they need to originate/end in only one iteration:9; Stmt_S1[i0, 1023] -> Stmt_S2[i0, o1]10; Stmt_S1[i0, i1] -> Stmt_S2[i0, 0]11;12; CHECK: RAW dependences:13; CHECK-NEXT: { Stmt_S1[i0, 1023] -> Stmt_S2[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023; Stmt_S1[i0, i1] -> Stmt_S2[i0, 0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1022; Stmt_S2[i0, i1] -> Stmt_S3[i0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1023; Stmt_S3[i0] -> Stmt_S0[1 + i0] : 0 <= i0 <= 1022; Stmt_S0[i0] -> Stmt_S1[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023 }14; CHECK-NEXT: WAR dependences:15; CHECK-NEXT: { Stmt_S1[i0, 1023] -> Stmt_S2[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023; Stmt_S1[i0, i1] -> Stmt_S2[i0, 0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1022; Stmt_S2[i0, i1] -> Stmt_S3[i0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1023; Stmt_S3[i0] -> Stmt_S0[1 + i0] : 0 <= i0 <= 1022; Stmt_S0[i0] -> Stmt_S1[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023 }16; CHECK-NEXT: WAW dependences:17; CHECK-NEXT: { Stmt_S1[i0, 1023] -> Stmt_S2[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023; Stmt_S1[i0, i1] -> Stmt_S2[i0, 0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1022; Stmt_S2[i0, i1] -> Stmt_S3[i0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1023; Stmt_S3[i0] -> Stmt_S0[1 + i0] : 0 <= i0 <= 1022; Stmt_S0[i0] -> Stmt_S1[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023 }18; CHECK-NEXT: Reduction dependences:19; CHECK-NEXT: { Stmt_S1[i0, i1] -> Stmt_S1[i0, 1 + i1] : 0 <= i0 <= 1023 and 0 <= i1 <= 1022; Stmt_S2[i0, i1] -> Stmt_S2[i0, 1 + i1] : 0 <= i0 <= 1023 and 0 <= i1 <= 1022 }20;21; void f(int *restrict red) {22; for (int j = 0; j < 1024; j++) {23; S0: *red = 42 + *red * 5;24; for (int i = 0; i < 1024; i++)25; S1: *red *= i;26; for (int i = 0; i < 1024; i++)27; S2: *red += i;28; S3: *red = 42 + *red * 7;29; }30; }31;32target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"33 34define void @f(ptr noalias %red) {35entry:36 br label %for.cond37 38for.cond: ; preds = %for.inc15, %entry39 %j.0 = phi i32 [ 0, %entry ], [ %inc16, %for.inc15 ]40 %exitcond2 = icmp ne i32 %j.0, 102441 br i1 %exitcond2, label %for.body, label %for.end1742 43for.body: ; preds = %for.cond44 br label %S045 46S0: ; preds = %for.body47 %tmp = load i32, ptr %red, align 448 %mul = mul nsw i32 %tmp, 549 %add = add nsw i32 %mul, 4250 store i32 %add, ptr %red, align 451 br label %for.cond152 53for.cond1: ; preds = %for.inc, %S054 %i.0 = phi i32 [ 0, %S0 ], [ %inc, %for.inc ]55 %exitcond = icmp ne i32 %i.0, 102456 br i1 %exitcond, label %for.body3, label %for.end57 58for.body3: ; preds = %for.cond159 br label %S160 61S1: ; preds = %for.body362 %tmp3 = load i32, ptr %red, align 463 %mul4 = mul nsw i32 %tmp3, %i.064 store i32 %mul4, ptr %red, align 465 br label %for.inc66 67for.inc: ; preds = %S168 %inc = add nsw i32 %i.0, 169 br label %for.cond170 71for.end: ; preds = %for.cond172 br label %for.cond673 74for.cond6: ; preds = %for.inc10, %for.end75 %i5.0 = phi i32 [ 0, %for.end ], [ %inc11, %for.inc10 ]76 %exitcond1 = icmp ne i32 %i5.0, 102477 br i1 %exitcond1, label %for.body8, label %for.end1278 79for.body8: ; preds = %for.cond680 br label %S281 82S2: ; preds = %for.body883 %tmp4 = load i32, ptr %red, align 484 %add9 = add nsw i32 %tmp4, %i5.085 store i32 %add9, ptr %red, align 486 br label %for.inc1087 88for.inc10: ; preds = %S289 %inc11 = add nsw i32 %i5.0, 190 br label %for.cond691 92for.end12: ; preds = %for.cond693 br label %S394 95S3: ; preds = %for.end1296 %tmp5 = load i32, ptr %red, align 497 %mul13 = mul nsw i32 %tmp5, 798 %add14 = add nsw i32 %mul13, 4299 store i32 %add14, ptr %red, align 4100 br label %for.inc15101 102for.inc15: ; preds = %S3103 %inc16 = add nsw i32 %j.0, 1104 br label %for.cond105 106for.end17: ; preds = %for.cond107 ret void108}109