Update Polly tests to handle explicitly typed gep changes in LLVM
[polly-mirror.git] / test / Dependences / reduction_multiple_loops_array_sum_2.ll
blob473c8ddf325f08aaf244a16b0132b941c29dbd9e
1 ; RUN: opt %loadPolly -polly-detect-unprofitable -polly-dependences -analyze -basicaa < %s | FileCheck %s
3 ; CHECK: RAW dependences:
4 ; CHECK:   {  }
5 ; CHECK: WAR dependences:
6 ; CHECK:   {  }
7 ; CHECK: WAW dependences:
8 ; CHECK:   {  }
9 ; CHECK: Reduction dependences:
10 ; CHECK-DAG: Stmt_for_body3[i0, i1] -> Stmt_for_body3[i0, 1 + i1] : i0 <= 99 and i0 >= 0 and i1 <= 98 and i1 >= 0
11 ; CHECK-DAG: Stmt_for_body3[i0, 99] -> Stmt_for_body3[1 + i0, 0] : i0 <= 98 and i0 >= 0
13 ; int f(int * restrict A, int * restrict sum) {
14 ;   int i, j, k;
15 ;   for (i = 0; i < 100; i++) {
16 ;     for (j = 0; j < 100; j++) {
17 ;       sum += A[i+j];
18 ;       for (k = 0; k< 100; k++) {}
19 ;     }
20 ;   }
21 ;   return sum;
22 ; }
23 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
25 define void @f(i32* noalias %A, i32* noalias %sum) {
26 entry:
27   br label %for.cond
29 for.cond:                                         ; preds = %for.inc11, %entry
30   %i.0 = phi i32 [ 0, %entry ], [ %inc12, %for.inc11 ]
31   %exitcond2 = icmp ne i32 %i.0, 100
32   br i1 %exitcond2, label %for.body, label %for.end13
34 for.body:                                         ; preds = %for.cond
35   br label %for.cond1
37 for.cond1:                                        ; preds = %for.inc8, %for.body
38   %j.0 = phi i32 [ 0, %for.body ], [ %inc9, %for.inc8 ]
39   %exitcond1 = icmp ne i32 %j.0, 100
40   br i1 %exitcond1, label %for.body3, label %for.end10
42 for.body3:                                        ; preds = %for.cond1
43   %add = add nsw i32 %i.0, %j.0
44   %arrayidx = getelementptr inbounds i32, i32* %A, i32 %add
45   %tmp3 = load i32* %arrayidx, align 4
46   %tmp4 = load i32* %sum, align 4
47   %add4 = add nsw i32 %tmp4, %tmp3
48   store i32 %add4, i32* %sum, align 4
49   br label %for.cond5
51 for.cond5:                                        ; preds = %for.inc, %for.body3
52   %k.0 = phi i32 [ 0, %for.body3 ], [ %inc, %for.inc ]
53   %exitcond = icmp ne i32 %k.0, 100
54   br i1 %exitcond, label %for.body7, label %for.end
56 for.body7:                                        ; preds = %for.cond5
57   br label %for.inc
59 for.inc:                                          ; preds = %for.body7
60   %inc = add nsw i32 %k.0, 1
61   br label %for.cond5
63 for.end:                                          ; preds = %for.cond5
64   br label %for.inc8
66 for.inc8:                                         ; preds = %for.end
67   %inc9 = add nsw i32 %j.0, 1
68   br label %for.cond1
70 for.end10:                                        ; preds = %for.cond1
71   br label %for.inc11
73 for.inc11:                                        ; preds = %for.end10
74   %inc12 = add nsw i32 %i.0, 1
75   br label %for.cond
77 for.end13:                                        ; preds = %for.cond
78   ret void