1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=slp-vectorizer -S -slp-schedule-budget=3 -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s -check-prefix VECTOR_DBG
3 ; RUN: opt < %s -strip-debug -passes=slp-vectorizer -S -slp-schedule-budget=3 -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s -check-prefix VECTOR_NODBG
5 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
6 target triple = "x86_64-apple-macosx10.9.0"
8 ; Verify that we get vectorization with -slp-schedule-budget=3. We should
9 ; get vectorization even if there happens to be some dbg.value calls since they
10 ; should be ignored, to not let debug information affect the code we get.
12 declare void @unknown()
14 define void @test(ptr %a, ptr %b, ptr %c, ptr %d) {
15 ; VECTOR_DBG-LABEL: @test(
16 ; VECTOR_DBG-NEXT: entry:
17 ; VECTOR_DBG-NEXT: [[TMP0:%.*]] = load <4 x float>, ptr [[A:%.*]], align 4
18 ; VECTOR_DBG-NEXT: call void @unknown()
19 ; VECTOR_DBG-NEXT: call void @unknown()
20 ; VECTOR_DBG-NEXT: call void @unknown()
21 ; VECTOR_DBG-NEXT: call void @unknown()
22 ; VECTOR_DBG-NEXT: call void @unknown()
23 ; VECTOR_DBG-NEXT: call void @unknown()
24 ; VECTOR_DBG-NEXT: call void @unknown()
25 ; VECTOR_DBG-NEXT: call void @unknown()
26 ; VECTOR_DBG-NEXT: call void @unknown()
27 ; VECTOR_DBG-NEXT: call void @unknown()
28 ; VECTOR_DBG-NEXT: call void @unknown()
29 ; VECTOR_DBG-NEXT: call void @unknown()
30 ; VECTOR_DBG-NEXT: call void @unknown()
31 ; VECTOR_DBG-NEXT: call void @unknown()
32 ; VECTOR_DBG-NEXT: call void @unknown()
33 ; VECTOR_DBG-NEXT: call void @unknown()
34 ; VECTOR_DBG-NEXT: call void @unknown()
35 ; VECTOR_DBG-NEXT: call void @unknown()
36 ; VECTOR_DBG-NEXT: call void @unknown()
37 ; VECTOR_DBG-NEXT: call void @unknown()
38 ; VECTOR_DBG-NEXT: call void @unknown()
39 ; VECTOR_DBG-NEXT: call void @unknown()
40 ; VECTOR_DBG-NEXT: call void @unknown()
41 ; VECTOR_DBG-NEXT: call void @unknown()
42 ; VECTOR_DBG-NEXT: call void @unknown()
43 ; VECTOR_DBG-NEXT: call void @unknown()
44 ; VECTOR_DBG-NEXT: call void @unknown()
45 ; VECTOR_DBG-NEXT: call void @unknown()
46 ; VECTOR_DBG-NEXT: #dbg_value(i16 1, [[META3:![0-9]+]], !DIExpression(), [[META5:![0-9]+]])
47 ; VECTOR_DBG-NEXT: #dbg_value(i16 1, [[META3]], !DIExpression(), [[META5]])
48 ; VECTOR_DBG-NEXT: #dbg_value(i16 1, [[META3]], !DIExpression(), [[META5]])
49 ; VECTOR_DBG-NEXT: #dbg_value(i16 1, [[META3]], !DIExpression(), [[META5]])
50 ; VECTOR_DBG-NEXT: #dbg_value(i16 1, [[META3]], !DIExpression(), [[META5]])
51 ; VECTOR_DBG-NEXT: #dbg_value(i16 1, [[META3]], !DIExpression(), [[META5]])
52 ; VECTOR_DBG-NEXT: #dbg_value(i16 1, [[META3]], !DIExpression(), [[META5]])
53 ; VECTOR_DBG-NEXT: #dbg_value(i16 1, [[META3]], !DIExpression(), [[META5]])
54 ; VECTOR_DBG-NEXT: store <4 x float> [[TMP0]], ptr [[B:%.*]], align 4
55 ; VECTOR_DBG-NEXT: [[TMP1:%.*]] = load <4 x float>, ptr [[C:%.*]], align 4
56 ; VECTOR_DBG-NEXT: store <4 x float> [[TMP1]], ptr [[D:%.*]], align 4
57 ; VECTOR_DBG-NEXT: ret void
59 ; VECTOR_NODBG-LABEL: @test(
60 ; VECTOR_NODBG-NEXT: entry:
61 ; VECTOR_NODBG-NEXT: [[TMP0:%.*]] = load <4 x float>, ptr [[A:%.*]], align 4
62 ; VECTOR_NODBG-NEXT: call void @unknown()
63 ; VECTOR_NODBG-NEXT: call void @unknown()
64 ; VECTOR_NODBG-NEXT: call void @unknown()
65 ; VECTOR_NODBG-NEXT: call void @unknown()
66 ; VECTOR_NODBG-NEXT: call void @unknown()
67 ; VECTOR_NODBG-NEXT: call void @unknown()
68 ; VECTOR_NODBG-NEXT: call void @unknown()
69 ; VECTOR_NODBG-NEXT: call void @unknown()
70 ; VECTOR_NODBG-NEXT: call void @unknown()
71 ; VECTOR_NODBG-NEXT: call void @unknown()
72 ; VECTOR_NODBG-NEXT: call void @unknown()
73 ; VECTOR_NODBG-NEXT: call void @unknown()
74 ; VECTOR_NODBG-NEXT: call void @unknown()
75 ; VECTOR_NODBG-NEXT: call void @unknown()
76 ; VECTOR_NODBG-NEXT: call void @unknown()
77 ; VECTOR_NODBG-NEXT: call void @unknown()
78 ; VECTOR_NODBG-NEXT: call void @unknown()
79 ; VECTOR_NODBG-NEXT: call void @unknown()
80 ; VECTOR_NODBG-NEXT: call void @unknown()
81 ; VECTOR_NODBG-NEXT: call void @unknown()
82 ; VECTOR_NODBG-NEXT: call void @unknown()
83 ; VECTOR_NODBG-NEXT: call void @unknown()
84 ; VECTOR_NODBG-NEXT: call void @unknown()
85 ; VECTOR_NODBG-NEXT: call void @unknown()
86 ; VECTOR_NODBG-NEXT: call void @unknown()
87 ; VECTOR_NODBG-NEXT: call void @unknown()
88 ; VECTOR_NODBG-NEXT: call void @unknown()
89 ; VECTOR_NODBG-NEXT: call void @unknown()
90 ; VECTOR_NODBG-NEXT: store <4 x float> [[TMP0]], ptr [[B:%.*]], align 4
91 ; VECTOR_NODBG-NEXT: [[TMP1:%.*]] = load <4 x float>, ptr [[C:%.*]], align 4
92 ; VECTOR_NODBG-NEXT: store <4 x float> [[TMP1]], ptr [[D:%.*]], align 4
93 ; VECTOR_NODBG-NEXT: ret void
96 %l0 = load float, ptr %a
97 %a1 = getelementptr inbounds float, ptr %a, i64 1
98 %l1 = load float, ptr %a1
99 %a2 = getelementptr inbounds float, ptr %a, i64 2
100 %l2 = load float, ptr %a2
101 %a3 = getelementptr inbounds float, ptr %a, i64 3
102 %l3 = load float, ptr %a3
104 ; some unrelated instructions inbetween to enlarge the scheduling region
134 ; The dbg.values should not affect vectorization.
135 call void @llvm.dbg.value(metadata i16 1, metadata !3, metadata !DIExpression()), !dbg !5
136 call void @llvm.dbg.value(metadata i16 1, metadata !3, metadata !DIExpression()), !dbg !5
137 call void @llvm.dbg.value(metadata i16 1, metadata !3, metadata !DIExpression()), !dbg !5
138 call void @llvm.dbg.value(metadata i16 1, metadata !3, metadata !DIExpression()), !dbg !5
140 store float %l0, ptr %b
142 ; The dbg.values should not affect vectorization.
143 call void @llvm.dbg.value(metadata i16 1, metadata !3, metadata !DIExpression()), !dbg !5
144 call void @llvm.dbg.value(metadata i16 1, metadata !3, metadata !DIExpression()), !dbg !5
145 call void @llvm.dbg.value(metadata i16 1, metadata !3, metadata !DIExpression()), !dbg !5
146 call void @llvm.dbg.value(metadata i16 1, metadata !3, metadata !DIExpression()), !dbg !5
147 %b1 = getelementptr inbounds float, ptr %b, i64 1
148 store float %l1, ptr %b1
149 %b2 = getelementptr inbounds float, ptr %b, i64 2
150 store float %l2, ptr %b2
151 %b3 = getelementptr inbounds float, ptr %b, i64 3
152 store float %l3, ptr %b3
154 %l4 = load float, ptr %c
155 %c1 = getelementptr inbounds float, ptr %c, i64 1
156 %l5 = load float, ptr %c1
157 %c2 = getelementptr inbounds float, ptr %c, i64 2
158 %l6 = load float, ptr %c2
159 %c3 = getelementptr inbounds float, ptr %c, i64 3
160 %l7 = load float, ptr %c3
162 store float %l4, ptr %d
163 %d1 = getelementptr inbounds float, ptr %d, i64 1
164 store float %l5, ptr %d1
165 %d2 = getelementptr inbounds float, ptr %d, i64 2
166 store float %l6, ptr %d2
167 %d3 = getelementptr inbounds float, ptr %d, i64 3
168 store float %l7, ptr %d3
173 declare void @llvm.dbg.value(metadata, metadata, metadata)
176 !llvm.module.flags = !{!2}
178 !0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1)
179 !1 = !DIFile(filename: "foo.c", directory: "/")
180 !2 = !{i32 2, !"Debug Info Version", i32 3}
181 !3 = !DILocalVariable(scope: !4)
182 !4 = distinct !DISubprogram(unit: !0)
183 !5 = !DILocation(scope: !4)