1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=haswell | FileCheck %s -check-prefix=NOAA
3 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=haswell -combiner-global-alias-analysis=1 | FileCheck %s -check-prefix=AA
5 declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
6 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1)
7 declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
9 %struct.S = type { [16 x i8] }
11 define dso_local void @_Z4SwapP1SS0_(%struct.S* nocapture %a, %struct.S* nocapture %b) local_unnamed_addr {
12 ; NOAA-LABEL: _Z4SwapP1SS0_:
13 ; NOAA: # %bb.0: # %entry
14 ; NOAA-NEXT: vmovups (%rdi), %xmm0
15 ; NOAA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
16 ; NOAA-NEXT: vmovups (%rsi), %xmm0
17 ; NOAA-NEXT: vmovups %xmm0, (%rdi)
18 ; NOAA-NEXT: vmovaps -{{[0-9]+}}(%rsp), %xmm0
19 ; NOAA-NEXT: vmovups %xmm0, (%rsi)
22 ; AA-LABEL: _Z4SwapP1SS0_:
23 ; AA: # %bb.0: # %entry
24 ; AA-NEXT: vmovups (%rdi), %xmm0
25 ; AA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
26 ; AA-NEXT: vmovups (%rsi), %xmm1
27 ; AA-NEXT: vmovups %xmm1, (%rdi)
28 ; AA-NEXT: vmovups %xmm0, (%rsi)
31 %tmp.sroa.0 = alloca [16 x i8], align 1
32 %tmp.sroa.0.0..sroa_idx6 = getelementptr inbounds [16 x i8], [16 x i8]* %tmp.sroa.0, i64 0, i64 0
33 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %tmp.sroa.0.0..sroa_idx6)
34 %tmp.sroa.0.0..sroa_idx1 = getelementptr inbounds %struct.S, %struct.S* %a, i64 0, i32 0, i64 0
35 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %tmp.sroa.0.0..sroa_idx6, i8* align 1 %tmp.sroa.0.0..sroa_idx1, i64 16, i1 false)
36 %0 = getelementptr inbounds %struct.S, %struct.S* %b, i64 0, i32 0, i64 0
37 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %tmp.sroa.0.0..sroa_idx1, i8* align 1 %0, i64 16, i1 false), !tbaa.struct !2
38 call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* nonnull align 1 %tmp.sroa.0.0..sroa_idx6, i64 16, i1 false)
39 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %tmp.sroa.0.0..sroa_idx6)
43 define dso_local void @onealloc_noreadback(i8* nocapture %a, i8* nocapture %b) local_unnamed_addr {
44 ; NOAA-LABEL: onealloc_noreadback:
45 ; NOAA: # %bb.0: # %entry
46 ; NOAA-NEXT: vmovups (%rdi), %xmm0
47 ; NOAA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
48 ; NOAA-NEXT: vmovups (%rsi), %xmm0
49 ; NOAA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
52 ; AA-LABEL: onealloc_noreadback:
53 ; AA: # %bb.0: # %entry
54 ; AA-NEXT: vmovups (%rdi), %xmm0
55 ; AA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
56 ; AA-NEXT: vmovups (%rsi), %xmm0
57 ; AA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
60 %alloc = alloca [16 x i8], i8 2, align 1
61 %part1 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc, i64 0, i64 0
62 %part2 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc, i64 1, i64 0
63 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part1)
64 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part2)
65 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part1, i8* align 1 %a, i64 16, i1 false)
66 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part2, i8* align 1 %b, i64 16, i1 false)
67 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part1)
68 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part2)
73 define dso_local void @twoallocs_trivial(i8* nocapture %a, i8* nocapture %b) local_unnamed_addr {
74 ; NOAA-LABEL: twoallocs_trivial:
75 ; NOAA: # %bb.0: # %entry
76 ; NOAA-NEXT: vmovups (%rdi), %xmm0
77 ; NOAA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
78 ; NOAA-NEXT: vmovups (%rsi), %xmm0
79 ; NOAA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
82 ; AA-LABEL: twoallocs_trivial:
83 ; AA: # %bb.0: # %entry
84 ; AA-NEXT: vmovups (%rdi), %xmm0
85 ; AA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
86 ; AA-NEXT: vmovups (%rsi), %xmm0
87 ; AA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
90 %alloc1 = alloca [16 x i8], align 1
91 %alloc2 = alloca [16 x i8], align 1
92 %part1 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc1, i64 0, i64 0
93 %part2 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc2, i64 0, i64 0
94 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part1)
95 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part2)
96 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part1, i8* align 1 %a, i64 16, i1 false)
97 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part2, i8* align 1 %b, i64 16, i1 false)
98 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part1)
99 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part2)
103 define dso_local void @twoallocs(i8* nocapture %a, i8* nocapture %b) local_unnamed_addr {
104 ; NOAA-LABEL: twoallocs:
105 ; NOAA: # %bb.0: # %entry
106 ; NOAA-NEXT: vmovups (%rdi), %xmm0
107 ; NOAA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
108 ; NOAA-NEXT: vmovaps -{{[0-9]+}}(%rsp), %xmm0
109 ; NOAA-NEXT: vmovups %xmm0, (%rsi)
112 ; AA-LABEL: twoallocs:
113 ; AA: # %bb.0: # %entry
114 ; AA-NEXT: vmovups (%rdi), %xmm0
115 ; AA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
116 ; AA-NEXT: vmovaps -{{[0-9]+}}(%rsp), %xmm0
117 ; AA-NEXT: vmovups %xmm0, (%rsi)
120 %alloc1 = alloca [16 x i8], align 1
121 %alloc2 = alloca [16 x i8], align 1
122 %part1 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc1, i64 0, i64 0
123 %part2 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc2, i64 0, i64 0
124 %part2_alias = getelementptr inbounds [16 x i8], [16 x i8]* %alloc2, i64 0, i64 0
125 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part1)
126 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part2)
127 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part2, i8* align 1 %a, i64 16, i1 false)
128 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part1)
129 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %b, i8* align 1 %part2_alias, i64 16, i1 false)
130 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part2)
134 define dso_local void @onealloc_readback_1(i8* nocapture %a, i8* nocapture %b) local_unnamed_addr {
135 ; NOAA-LABEL: onealloc_readback_1:
136 ; NOAA: # %bb.0: # %entry
137 ; NOAA-NEXT: vmovups (%rdi), %xmm0
138 ; NOAA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
139 ; NOAA-NEXT: vmovups (%rsi), %xmm0
140 ; NOAA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
141 ; NOAA-NEXT: vmovaps -{{[0-9]+}}(%rsp), %xmm0
142 ; NOAA-NEXT: vmovups %xmm0, (%rdi)
145 ; AA-LABEL: onealloc_readback_1:
146 ; AA: # %bb.0: # %entry
147 ; AA-NEXT: vmovups (%rdi), %xmm0
148 ; AA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
149 ; AA-NEXT: vmovups (%rsi), %xmm0
150 ; AA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
151 ; AA-NEXT: vmovaps -{{[0-9]+}}(%rsp), %xmm0
152 ; AA-NEXT: vmovups %xmm0, (%rdi)
155 %alloc = alloca [16 x i8], i8 2, align 1
156 %part2 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc, i64 0, i64 0
157 %part1 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc, i64 1, i64 0
158 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part1)
159 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part2)
160 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part1, i8* align 1 %a, i64 16, i1 false)
161 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part2, i8* align 1 %b, i64 16, i1 false)
162 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part1)
163 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %a, i8* align 1 %part2, i64 16, i1 false)
164 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part2)
168 define dso_local void @onealloc_readback_2(i8* nocapture %a, i8* nocapture %b) local_unnamed_addr {
169 ; NOAA-LABEL: onealloc_readback_2:
170 ; NOAA: # %bb.0: # %entry
171 ; NOAA-NEXT: vmovups (%rdi), %xmm0
172 ; NOAA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
173 ; NOAA-NEXT: vmovups (%rsi), %xmm0
174 ; NOAA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
175 ; NOAA-NEXT: vmovaps -{{[0-9]+}}(%rsp), %xmm0
176 ; NOAA-NEXT: vmovups %xmm0, (%rdi)
179 ; AA-LABEL: onealloc_readback_2:
180 ; AA: # %bb.0: # %entry
181 ; AA-NEXT: vmovups (%rdi), %xmm0
182 ; AA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
183 ; AA-NEXT: vmovups (%rsi), %xmm0
184 ; AA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
185 ; AA-NEXT: vmovaps -{{[0-9]+}}(%rsp), %xmm0
186 ; AA-NEXT: vmovups %xmm0, (%rdi)
189 %alloc = alloca [16 x i8], i8 2, align 1
190 %part1 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc, i64 0, i64 0
191 %part2 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc, i64 1, i64 0
192 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part1)
193 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part2)
194 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part1, i8* align 1 %a, i64 16, i1 false)
195 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part2, i8* align 1 %b, i64 16, i1 false)
196 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part1)
197 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %a, i8* align 1 %part2, i64 16, i1 false)
198 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part2)
203 !llvm.module.flags = !{!0}
206 !0 = !{i32 1, !"wchar_size", i32 4}
207 !1 = !{!"clang version 9.0.0 (trunk 352631) (llvm/trunk 352632)"}
208 !2 = !{i64 0, i64 16, !3}
209 !3 = !{!4, !4, i64 0}
210 !4 = !{!"omnipotent char", !5, i64 0}
211 !5 = !{!"Simple C++ TBAA"}