1 ; RUN: opt %loadPolly -polly-dependences -analyze < %s | FileCheck %s
3 ; CHECK: RAW dependences:
4 ; CHECK-NEXT: [N] -> { Stmt_S0[] -> Stmt_S1[o0] : N >= 11 and 0 <= o0 <= 1023; Stmt_S1[i0] -> Stmt_S2[] : N >= 11 and 0 <= i0 <= 1023 }
5 ; CHECK-NEXT: WAR dependences:
6 ; CHECK-NEXT: [N] -> { Stmt_S1[i0] -> Stmt_S2[] : N >= 11 and 0 <= i0 <= 1023 }
7 ; CHECK-NEXT: WAW dependences:
8 ; CHECK-NEXT: [N] -> { Stmt_S0[] -> Stmt_S1[o0] : N >= 11 and 0 <= o0 <= 1023; Stmt_S1[i0] -> Stmt_S2[] : N >= 11 and 0 <= i0 <= 1023 }
9 ; CHECK-NEXT: Reduction dependences:
10 ; CHECK-NEXT: [N] -> { Stmt_S1[i0] -> Stmt_S1[1 + i0] : N >= 11 and 0 <= i0 <= 1022 }
12 ; void f(int *sum, int N) {
15 ; for (int i = 0; i < 1024; i++)
17 ; S2: *sum = *sum * 3;
20 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
22 define void @f(i32* %sum, i32 %N) {
27 %excond = icmp sgt i32 %N, 10
28 br i1 %excond, label %S0, label %f.end
31 store i32 0, i32* %sum, align 4
34 for.cond: ; preds = %for.inc, %S0
35 %i.0 = phi i32 [ 0, %S0 ], [ %inc, %for.inc ]
36 %exitcond = icmp ne i32 %i.0, 1024
37 br i1 %exitcond, label %S1, label %S2
39 S1: ; preds = %for.cond
40 %tmp = load i32, i32* %sum, align 4
41 %add = add nsw i32 %tmp, %i.0
42 store i32 %add, i32* %sum, align 4
45 for.inc: ; preds = %S1
46 %inc = add nsw i32 %i.0, 1
49 S2: ; preds = %for.cond
50 %tmp1 = load i32, i32* %sum, align 4
51 %mul = mul nsw i32 %tmp1, 3
52 store i32 %mul, i32* %sum, align 4