1 ; RUN: opt %loadPolly -polly-dependences -analyze -basicaa < %s | FileCheck %s
3 ; CHECK: Reduction dependences:
4 ; CHECK-NEXT: { Stmt_for_inc[i0, i1] -> Stmt_for_inc[i0, 1 + i1] : 0 <= i0 <= 99 and 0 <= i1 <= 98 }
6 ; int f(int * __restrict__ A) {
8 ; for (k = 0; k < 37; k = g(k)) {
9 ; for (i = 0; i < 100; i++) {
11 ; for (j = 0; j < 100; j++) {
18 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
22 define i32 @f(i32* noalias %A) {
24 %sum.04.reg2mem = alloca i32
25 %sum.12.reg2mem = alloca i32
28 entry.split: ; preds = %entry
29 store i32 0, i32* %sum.04.reg2mem
30 br label %for.body_outer_split
32 for.body_outer_split: ; preds = %entry.split, %for.inc5
33 %indvars.ivK = phi i64 [ 0, %entry.split ], [ %incK, %for.bos2 ]
34 br label %for.body_outer
36 for.body_outer: ; preds = %for.body_outer_split
37 %incK = call i64 @g(i64 %indvars.ivK)
38 %exitcondK = icmp eq i64 %incK, 100
39 br i1 %exitcondK, label %for.end7, label %for.body
41 for.body: ; preds = %for.inc5, %for.body_outer
42 %indvars.iv23 = phi i64 [ 0, %for.body_outer ], [ %3, %for.inc5 ]
43 %sum.04.reload = load i32, i32* %sum.04.reg2mem
44 %mul = shl nsw i32 %sum.04.reload, 1
45 store i32 %mul, i32* %sum.12.reg2mem
48 for.inc: ; preds = %for.inc, %for.body
49 %indvars.iv1 = phi i64 [ 0, %for.body ], [ %1, %for.inc ]
50 %sum.12.reload = load i32, i32* %sum.12.reg2mem
51 %0 = add i64 %indvars.iv23, %indvars.iv1
52 %arrayidx = getelementptr i32, i32* %A, i64 %0
53 %tmp5 = load i32, i32* %arrayidx, align 4
54 %add4 = add nsw i32 %tmp5, %sum.12.reload
55 %1 = add nuw nsw i64 %indvars.iv1, 1
56 %exitcond1 = icmp eq i64 %1, 100
57 store i32 %add4, i32* %sum.12.reg2mem
58 br i1 %exitcond1, label %for.inc5, label %for.inc
60 for.inc5: ; preds = %for.inc
61 %2 = load i32, i32* %sum.12.reg2mem
62 %3 = add nuw nsw i64 %indvars.iv23, 1
63 %exitcond2 = icmp eq i64 %3, 100
64 store i32 %2, i32* %sum.04.reg2mem
65 br i1 %exitcond2, label %for.bos2, label %for.body
68 br label %for.body_outer_split
70 for.end7: ; preds = %for.inc5
71 %4 = load i32, i32* %sum.04.reg2mem