1; RUN: opt %loadNPMPolly '-passes=print<polly-dependences>' -disable-output < %s | FileCheck %s 2; 3; CHECK: RAW dependences: 4; CHECK-NEXT: { Stmt_S1[i0, 0] -> Stmt_S2[i0, 0] : 0 <= i0 <= 98; Stmt_S2[i0, 0] -> Stmt_S1[1 + i0, 0] : 0 <= i0 <= 97 } 5; CHECK-NEXT: WAR dependences: 6; CHECK-NEXT: { Stmt_S1[i0, 0] -> Stmt_S2[i0, 0] : 0 <= i0 <= 98; Stmt_S2[i0, 0] -> Stmt_S1[1 + i0, 0] : 0 <= i0 <= 97 } 7; CHECK-NEXT: WAW dependences: 8; CHECK-NEXT: { Stmt_S1[i0, 0] -> Stmt_S2[i0, 0] : 0 <= i0 <= 98; Stmt_S2[i0, 0] -> Stmt_S1[1 + i0, 0] : 0 <= i0 <= 97 } 9; CHECK-NEXT: Reduction dependences: 10; CHECK-NEXT: { Stmt_S2[i0, i1] -> Stmt_S2[1 + i0, i1] : 0 <= i0 <= 97 and 0 < i1 <= 99 } 11; 12; void f(int *sum) { 13; for (int i = 0; i < 99; i++) { 14; for (int j = 0; j < 1; j++) 15; S1: sum[j] += 42; 16; for (int j = 0; j < 100; j++) 17; S2: sum[j] += i * j; 18; } 19; } 20; 21target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64" 22 23define void @f(ptr %sum) { 24entry: 25 br label %for.cond 26 27for.cond: ; preds = %for.inc12, %entry 28 %i.0 = phi i32 [ 0, %entry ], [ %inc13, %for.inc12 ] 29 %exitcond2 = icmp ne i32 %i.0, 99 30 br i1 %exitcond2, label %for.body, label %for.end14 31 32for.body: ; preds = %for.cond 33 br label %for.cond1 34 35for.cond1: ; preds = %for.inc, %for.body 36 %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ] 37 %exitcond = icmp ne i32 %j.0, 1 38 br i1 %exitcond, label %for.body3, label %for.end 39 40for.body3: ; preds = %for.cond1 41 br label %S1 42 43S1: ; preds = %for.body3 44 %arrayidx = getelementptr inbounds i32, ptr %sum, i32 %j.0 45 %tmp = load i32, ptr %arrayidx, align 4 46 %add = add nsw i32 %tmp, 42 47 store i32 %add, ptr %arrayidx, align 4 48 br label %for.inc 49 50for.inc: ; preds = %S1 51 %inc = add nsw i32 %j.0, 1 52 br label %for.cond1 53 54for.end: ; preds = %for.cond1 55 br label %for.cond4 56 57for.cond4: ; preds = %for.inc9, %for.end 58 %j.1 = phi i32 [ 0, %for.end ], [ %inc10, %for.inc9 ] 59 %exitcond1 = icmp ne i32 %j.1, 100 60 br i1 %exitcond1, label %for.body6, label %for.end11 61 62for.body6: ; preds = %for.cond4 63 br label %S2 64 65S2: ; preds = %for.body6 66 %mul = mul nsw i32 %i.0, %j.1 67 %arrayidx7 = getelementptr inbounds i32, ptr %sum, i32 %j.1 68 %tmp3 = load i32, ptr %arrayidx7, align 4 69 %add8 = add nsw i32 %tmp3, %mul 70 store i32 %add8, ptr %arrayidx7, align 4 71 br label %for.inc9 72 73for.inc9: ; preds = %S2 74 %inc10 = add nsw i32 %j.1, 1 75 br label %for.cond4 76 77for.end11: ; preds = %for.cond4 78 br label %for.inc12 79 80for.inc12: ; preds = %for.end11 81 %inc13 = add nsw i32 %i.0, 1 82 br label %for.cond 83 84for.end14: ; preds = %for.cond 85 ret void 86} 87