xref: /llvm-project/polly/test/DependenceInfo/do_pluto_matmult.ll (revision e1f056f692d869708c1898d9d65a69ac5584a0ed)
1; RUN: opt %loadNPMPolly -aa-pipeline=basic-aa '-passes=print<polly-dependences>' -polly-dependences-analysis-type=value-based -disable-output < %s | FileCheck %s -check-prefix=VALUE
2; RUN: opt %loadNPMPolly -aa-pipeline=basic-aa '-passes=print<polly-dependences>' -polly-dependences-analysis-type=memory-based -disable-output < %s | FileCheck %s -check-prefix=MEMORY
3
4target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
5
6%struct._IO_FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] }
7%struct._IO_marker = type { ptr, ptr, i32 }
8
9@A = common global [36 x [49 x double]] zeroinitializer, align 8 ; <ptr> [#uses=3]
10@B = common global [36 x [49 x double]] zeroinitializer, align 8 ; <ptr> [#uses=3]
11@C = common global [36 x [49 x double]] zeroinitializer, align 8 ; <ptr> [#uses=4]
12
13define void @do_pluto_matmult() nounwind {
14entry:
15  fence seq_cst
16  br label %do.body
17
18do.body:                                          ; preds = %do.cond42, %entry
19  %indvar3 = phi i64 [ %indvar.next4, %do.cond42 ], [ 0, %entry ] ; <i64> [#uses=3]
20  br label %do.body1
21
22do.body1:                                         ; preds = %do.cond36, %do.body
23  %indvar1 = phi i64 [ %indvar.next2, %do.cond36 ], [ 0, %do.body ] ; <i64> [#uses=3]
24  %arrayidx5 = getelementptr [36 x [49 x double]], ptr @C, i64 0, i64 %indvar3, i64 %indvar1 ; <ptr> [#uses=2]
25  br label %do.body2
26
27do.body2:                                         ; preds = %do.cond, %do.body1
28  %indvar = phi i64 [ %indvar.next, %do.cond ], [ 0, %do.body1 ] ; <i64> [#uses=3]
29  %arrayidx13 = getelementptr [36 x [49 x double]], ptr @A, i64 0, i64 %indvar3, i64 %indvar ; <ptr> [#uses=1]
30  %arrayidx22 = getelementptr [36 x [49 x double]], ptr @B, i64 0, i64 %indvar, i64 %indvar1 ; <ptr> [#uses=1]
31  %tmp6 = load double, ptr %arrayidx5                 ; <double> [#uses=1]
32  %mul = fmul double 1.000000e+00, %tmp6          ; <double> [#uses=1]
33  %tmp14 = load double, ptr %arrayidx13               ; <double> [#uses=1]
34  %mul15 = fmul double 1.000000e+00, %tmp14       ; <double> [#uses=1]
35  %tmp23 = load double, ptr %arrayidx22               ; <double> [#uses=1]
36  %mul24 = fmul double %mul15, %tmp23             ; <double> [#uses=1]
37  %add = fadd double %mul, %mul24                 ; <double> [#uses=1]
38  store double %add, ptr %arrayidx5
39  br label %do.cond
40
41do.cond:                                          ; preds = %do.body2
42  %indvar.next = add i64 %indvar, 1               ; <i64> [#uses=2]
43  %exitcond = icmp ne i64 %indvar.next, 36        ; <i1> [#uses=1]
44  br i1 %exitcond, label %do.body2, label %do.end
45
46do.end:                                           ; preds = %do.cond
47  br label %do.cond36
48
49do.cond36:                                        ; preds = %do.end
50  %indvar.next2 = add i64 %indvar1, 1             ; <i64> [#uses=2]
51  %exitcond5 = icmp ne i64 %indvar.next2, 36      ; <i1> [#uses=1]
52  br i1 %exitcond5, label %do.body1, label %do.end39
53
54do.end39:                                         ; preds = %do.cond36
55  br label %do.cond42
56
57do.cond42:                                        ; preds = %do.end39
58  %indvar.next4 = add i64 %indvar3, 1             ; <i64> [#uses=2]
59  %exitcond6 = icmp ne i64 %indvar.next4, 36      ; <i1> [#uses=1]
60  br i1 %exitcond6, label %do.body, label %do.end45
61
62do.end45:                                         ; preds = %do.cond42
63  fence seq_cst
64  ret void
65}
66
67; VALUE:      RAW dependences:
68; VALUE-NEXT:     { Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, 1 + i2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and 0 <= i2 <= 34 }
69; VALUE-NEXT: WAR dependences:
70; VALUE-NEXT: { Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, 1 + i2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and 0 <= i2 <= 34 }
71; VALUE-NEXT: WAW dependences:
72; VALUE-NEXT:     { Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, 1 + i2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and 0 <= i2 <= 34 }
73
74; MEMORY:      RAW dependences:
75; MEMORY-NEXT:     { Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, o2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and i2 >= 0 and i2 < o2 <= 35 }
76; MEMORY-NEXT: WAR dependences:
77; MEMORY-NEXT:     { Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, o2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and i2 >= 0 and i2 < o2 <= 35 }
78; MEMORY-NEXT: WAW dependences:
79; MEMORY-NEXT:     { Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, o2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and i2 >= 0 and i2 < o2 <= 35 }
80
81; FUNC-VALUE:      RAW dependences:
82; FUNC-VALUE-NEXT:     { [Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2_Write3[]] -> [Stmt_do_body2[i0, i1, 1 + i2] -> Stmt_do_body2_Read0[]] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and 0 <= i2 <= 34; Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, 1 + i2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and 0 <= i2 <= 34 }
83; FUNC-VALUE-NEXT: WAR dependences:
84; FUNC-VALUE-NEXT:     { [Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2_Read0[]] -> [Stmt_do_body2[i0, i1, 1 + i2] -> Stmt_do_body2_Write3[]] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and 0 <= i2 <= 34; Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, 1 + i2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and 0 <= i2 <= 34 }
85; FUNC-VALUE-NEXT: WAW dependences:
86; FUNC-VALUE-NEXT:     { [Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2_Write3[]] -> [Stmt_do_body2[i0, i1, 1 + i2] -> Stmt_do_body2_Write3[]] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and 0 <= i2 <= 34; Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, 1 + i2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and 0 <= i2 <= 34 }
87
88; FUNC-MEMORY:      RAW dependences:
89; FUNC-MEMORY-NEXT:     { [Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2_Write3[]] -> [Stmt_do_body2[i0, i1, o2] -> Stmt_do_body2_Read0[]] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and i2 >= 0 and i2 < o2 <= 35; Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, o2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and i2 >= 0 and i2 < o2 <= 35 }
90; FUNC-MEMORY-NEXT: WAR dependences:
91; FUNC-MEMORY-NEXT:     { [Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2_Read0[]] -> [Stmt_do_body2[i0, i1, o2] -> Stmt_do_body2_Write3[]] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and i2 >= 0 and i2 < o2 <= 35; Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, o2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and i2 >= 0 and i2 < o2 <= 35 }
92; FUNC-MEMORY-NEXT: WAW dependences:
93; FUNC-MEMORY-NEXT:     { [Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2_Write3[]] -> [Stmt_do_body2[i0, i1, o2] -> Stmt_do_body2_Write3[]] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and i2 >= 0 and i2 < o2 <= 35; Stmt_do_body2[i0, i1, i2] -> Stmt_do_body2[i0, i1, o2] : 0 <= i0 <= 35 and 0 <= i1 <= 35 and i2 >= 0 and i2 < o2 <= 35 }
94