Fix two warnings in polly, -Wmismatched-tags and -Wreorder
[polly-mirror.git] / test / DependenceInfo / reduction_multiple_reductions_2.ll
blob98c3ee6549c0bfdd2493ea6ddc10525129f165e6
1 ; RUN: opt %loadPolly -basicaa -polly-dependences -analyze < %s | FileCheck %s
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]
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]
12 ; CHECK:      RAW dependences:
13 ; CHECK-NEXT:     { Stmt_S0[i0] -> Stmt_S1[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023; 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_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 }
14 ; CHECK-NEXT: WAR dependences:
15 ; CHECK-NEXT:     { Stmt_S0[i0] -> Stmt_S1[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023; 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_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 }
16 ; CHECK-NEXT: WAW dependences:
17 ; CHECK-NEXT:     { Stmt_S0[i0] -> Stmt_S1[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023; 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_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 }
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 }
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 ;    }
32 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
34 define void @f(i32* noalias %red)  {
35 entry:
36   br label %for.cond
38 for.cond:                                         ; preds = %for.inc15, %entry
39   %j.0 = phi i32 [ 0, %entry ], [ %inc16, %for.inc15 ]
40   %exitcond2 = icmp ne i32 %j.0, 1024
41   br i1 %exitcond2, label %for.body, label %for.end17
43 for.body:                                         ; preds = %for.cond
44   br label %S0
46 S0:                                               ; preds = %for.body
47   %tmp = load i32, i32* %red, align 4
48   %mul = mul nsw i32 %tmp, 5
49   %add = add nsw i32 %mul, 42
50   store i32 %add, i32* %red, align 4
51   br label %for.cond1
53 for.cond1:                                        ; preds = %for.inc, %S0
54   %i.0 = phi i32 [ 0, %S0 ], [ %inc, %for.inc ]
55   %exitcond = icmp ne i32 %i.0, 1024
56   br i1 %exitcond, label %for.body3, label %for.end
58 for.body3:                                        ; preds = %for.cond1
59   br label %S1
61 S1:                                               ; preds = %for.body3
62   %tmp3 = load i32, i32* %red, align 4
63   %mul4 = mul nsw i32 %tmp3, %i.0
64   store i32 %mul4, i32* %red, align 4
65   br label %for.inc
67 for.inc:                                          ; preds = %S1
68   %inc = add nsw i32 %i.0, 1
69   br label %for.cond1
71 for.end:                                          ; preds = %for.cond1
72   br label %for.cond6
74 for.cond6:                                        ; preds = %for.inc10, %for.end
75   %i5.0 = phi i32 [ 0, %for.end ], [ %inc11, %for.inc10 ]
76   %exitcond1 = icmp ne i32 %i5.0, 1024
77   br i1 %exitcond1, label %for.body8, label %for.end12
79 for.body8:                                        ; preds = %for.cond6
80   br label %S2
82 S2:                                               ; preds = %for.body8
83   %tmp4 = load i32, i32* %red, align 4
84   %add9 = add nsw i32 %tmp4, %i5.0
85   store i32 %add9, i32* %red, align 4
86   br label %for.inc10
88 for.inc10:                                        ; preds = %S2
89   %inc11 = add nsw i32 %i5.0, 1
90   br label %for.cond6
92 for.end12:                                        ; preds = %for.cond6
93   br label %S3
95 S3:                                               ; preds = %for.end12
96   %tmp5 = load i32, i32* %red, align 4
97   %mul13 = mul nsw i32 %tmp5, 7
98   %add14 = add nsw i32 %mul13, 42
99   store i32 %add14, i32* %red, align 4
100   br label %for.inc15
102 for.inc15:                                        ; preds = %S3
103   %inc16 = add nsw i32 %j.0, 1
104   br label %for.cond
106 for.end17:                                        ; preds = %for.cond
107   ret void