1; RUN: opt %loadPolly -polly-stmt-granularity=bb -polly-scops -analyze \
2; RUN:                -polly-detect-full-functions < %s | FileCheck %s
3
4target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5
6; CHECK:         Statements {
7; CHECK-NEXT:    	Stmt_entry_split
8; CHECK-NEXT:            Domain :=
9; CHECK-NEXT:                [N, __global_id_0, __global_id_1] -> { Stmt_entry_split[] };
10; CHECK-NEXT:            Schedule :=
11; CHECK-NEXT:                [N, __global_id_0, __global_id_1] -> { Stmt_entry_split[] -> [0, 0] };
12; CHECK-NEXT:            MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 1]
13; CHECK-NEXT:                [N, __global_id_0, __global_id_1] -> { Stmt_entry_split[] -> MemRef_acc_0_lcssa__phi[] };
14; CHECK-NEXT:    	Stmt_for_inc_lr_ph
15; CHECK-NEXT:            Domain :=
16; CHECK-NEXT:                [N, __global_id_0, __global_id_1] -> { Stmt_for_inc_lr_ph[] : N > 0 };
17; CHECK-NEXT:            Schedule :=
18; CHECK-NEXT:                [N, __global_id_0, __global_id_1] -> { Stmt_for_inc_lr_ph[] -> [1, 0] };
19; CHECK-NEXT:            MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 1]
20; CHECK-NEXT:                [N, __global_id_0, __global_id_1] -> { Stmt_for_inc_lr_ph[] -> MemRef_acc_03__phi[] };
21; CHECK-NEXT:    	Stmt_for_inc
22; CHECK-NEXT:            Domain :=
23; CHECK-NEXT:                [N, __global_id_0, __global_id_1] -> { Stmt_for_inc[i0] : 0 <= i0 < N };
24; CHECK-NEXT:            Schedule :=
25; CHECK-NEXT:                [N, __global_id_0, __global_id_1] -> { Stmt_for_inc[i0] -> [2, i0] };
26; CHECK-NEXT:            MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 1]
27; CHECK-NEXT:                [N, __global_id_0, __global_id_1] -> { Stmt_for_inc[i0] -> MemRef_acc_03__phi[] };
28; CHECK-NEXT:            ReadAccess :=	[Reduction Type: NONE] [Scalar: 1]
29; CHECK-NEXT:                [N, __global_id_0, __global_id_1] -> { Stmt_for_inc[i0] -> MemRef_acc_03__phi[] };
30; CHECK-NEXT:            ReadAccess :=	[Reduction Type: NONE] [Scalar: 0]
31; CHECK-NEXT:                [N, __global_id_0, __global_id_1] -> { Stmt_for_inc[i0] -> MemRef_A[__global_id_0, i0] };
32; CHECK-NEXT:            ReadAccess :=	[Reduction Type: NONE] [Scalar: 0]
33; CHECK-NEXT:                [N, __global_id_0, __global_id_1] -> { Stmt_for_inc[i0] -> MemRef_B[i0, __global_id_1] };
34; CHECK-NEXT:            MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 1]
35; CHECK-NEXT:                [N, __global_id_0, __global_id_1] -> { Stmt_for_inc[i0] -> MemRef__lcssa__phi[] };
36; CHECK-NEXT:    	Stmt_for_cond_for_end_crit_edge
37; CHECK-NEXT:            Domain :=
38; CHECK-NEXT:                [N, __global_id_0, __global_id_1] -> { Stmt_for_cond_for_end_crit_edge[] : N > 0 };
39; CHECK-NEXT:            Schedule :=
40; CHECK-NEXT:                [N, __global_id_0, __global_id_1] -> { Stmt_for_cond_for_end_crit_edge[] -> [3, 0] };
41; CHECK-NEXT:            ReadAccess :=	[Reduction Type: NONE] [Scalar: 1]
42; CHECK-NEXT:                [N, __global_id_0, __global_id_1] -> { Stmt_for_cond_for_end_crit_edge[] -> MemRef__lcssa__phi[] };
43; CHECK-NEXT:            MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 1]
44; CHECK-NEXT:                [N, __global_id_0, __global_id_1] -> { Stmt_for_cond_for_end_crit_edge[] -> MemRef_acc_0_lcssa__phi[] };
45; CHECK-NEXT:    	Stmt_for_end
46; CHECK-NEXT:            Domain :=
47; CHECK-NEXT:                [N, __global_id_0, __global_id_1] -> { Stmt_for_end[] };
48; CHECK-NEXT:            Schedule :=
49; CHECK-NEXT:                [N, __global_id_0, __global_id_1] -> { Stmt_for_end[] -> [4, 0] };
50; CHECK-NEXT:            ReadAccess :=	[Reduction Type: NONE] [Scalar: 1]
51; CHECK-NEXT:                [N, __global_id_0, __global_id_1] -> { Stmt_for_end[] -> MemRef_acc_0_lcssa__phi[] };
52; CHECK-NEXT:            MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 0]
53; CHECK-NEXT:                [N, __global_id_0, __global_id_1] -> { Stmt_for_end[] -> MemRef_C[__global_id_0, __global_id_1] };
54; CHECK-NEXT:    }
55
56
57; Function Attrs: noinline nounwind uwtable
58define void @mat_mul(float* %C, float* %A, float* %B, i64 %N) #0 !kernel_arg_addr_space !2 !kernel_arg_access_qual !3 !kernel_arg_type !4 !kernel_arg_base_type !4 !kernel_arg_type_qual !5 {
59entry:
60  br label %entry.split
61
62entry.split:                                      ; preds = %entry
63  %call = tail call i64 @_Z13get_global_idj(i32 0) #3
64  %call1 = tail call i64 @_Z13get_global_idj(i32 1) #3
65  %cmp1 = icmp sgt i64 %N, 0
66  %mul = mul nsw i64 %call, %N
67  br i1 %cmp1, label %for.inc.lr.ph, label %for.end
68
69for.inc.lr.ph:                                    ; preds = %entry.split
70  br label %for.inc
71
72for.inc:                                          ; preds = %for.inc.lr.ph, %for.inc
73  %acc.03 = phi float [ 0.000000e+00, %for.inc.lr.ph ], [ %tmp6, %for.inc ]
74  %m.02 = phi i64 [ 0, %for.inc.lr.ph ], [ %inc, %for.inc ]
75  %add = add nsw i64 %m.02, %mul
76  %arrayidx = getelementptr inbounds float, float* %A, i64 %add
77  %tmp = load float, float* %arrayidx, align 4
78  %mul2 = mul nsw i64 %m.02, %N
79  %add3 = add nsw i64 %mul2, %call1
80  %arrayidx4 = getelementptr inbounds float, float* %B, i64 %add3
81  %tmp5 = load float, float* %arrayidx4, align 4
82  %tmp6 = tail call float @llvm.fmuladd.f32(float %tmp, float %tmp5, float %acc.03)
83  %inc = add nuw nsw i64 %m.02, 1
84  %exitcond = icmp ne i64 %inc, %N
85  br i1 %exitcond, label %for.inc, label %for.cond.for.end_crit_edge
86
87for.cond.for.end_crit_edge:                       ; preds = %for.inc
88  %.lcssa = phi float [ %tmp6, %for.inc ]
89  br label %for.end
90
91for.end:                                          ; preds = %for.cond.for.end_crit_edge, %entry.split
92  %acc.0.lcssa = phi float [ %.lcssa, %for.cond.for.end_crit_edge ], [ 0.000000e+00, %entry.split ]
93  %add7 = add nsw i64 %mul, %call1
94  %arrayidx8 = getelementptr inbounds float, float* %C, i64 %add7
95  store float %acc.0.lcssa, float* %arrayidx8, align 4
96  ret void
97}
98
99; Function Attrs: nounwind readnone
100declare i64 @_Z13get_global_idj(i32) #1
101
102; Function Attrs: nounwind readnone speculatable
103declare float @llvm.fmuladd.f32(float, float, float) #2
104
105attributes #0 = { noinline nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
106attributes #1 = { nounwind readnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
107attributes #2 = { nounwind readnone speculatable }
108attributes #3 = { nounwind readnone }
109
110!llvm.module.flags = !{!0}
111!llvm.ident = !{!1}
112
113!0 = !{i32 1, !"wchar_size", i32 4}
114!1 = !{!"clang version 5.0.0 (trunk 303846) (llvm/trunk 303834)"}
115!2 = !{i32 1, i32 1, i32 1, i32 0}
116!3 = !{!"none", !"none", !"none", !"none"}
117!4 = !{!"float*", !"float*", !"float*", !"long"}
118!5 = !{!"", !"", !"", !""}
119