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: vmovups (%rsi), %xmm1
26 ; AA-NEXT: vmovups %xmm1, (%rdi)
27 ; AA-NEXT: vmovups %xmm0, (%rsi)
30 %tmp.sroa.0 = alloca [16 x i8], align 1
31 %tmp.sroa.0.0..sroa_idx6 = getelementptr inbounds [16 x i8], [16 x i8]* %tmp.sroa.0, i64 0, i64 0
32 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %tmp.sroa.0.0..sroa_idx6)
33 %tmp.sroa.0.0..sroa_idx1 = getelementptr inbounds %struct.S, %struct.S* %a, i64 0, i32 0, i64 0
34 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)
35 %0 = getelementptr inbounds %struct.S, %struct.S* %b, i64 0, i32 0, i64 0
36 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
37 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)
38 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %tmp.sroa.0.0..sroa_idx6)
42 define dso_local void @onealloc_noreadback(i8* nocapture %a, i8* nocapture %b) local_unnamed_addr {
43 ; NOAA-LABEL: onealloc_noreadback:
44 ; NOAA: # %bb.0: # %entry
47 ; AA-LABEL: onealloc_noreadback:
48 ; AA: # %bb.0: # %entry
51 %alloc = alloca [16 x i8], i8 2, align 1
52 %part1 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc, i64 0, i64 0
53 %part2 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc, i64 1, i64 0
54 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part1)
55 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part2)
56 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part1, i8* align 1 %a, i64 16, i1 false)
57 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part2, i8* align 1 %b, i64 16, i1 false)
58 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part1)
59 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part2)
64 define dso_local void @twoallocs_trivial(i8* nocapture %a, i8* nocapture %b) local_unnamed_addr {
65 ; NOAA-LABEL: twoallocs_trivial:
66 ; NOAA: # %bb.0: # %entry
69 ; AA-LABEL: twoallocs_trivial:
70 ; AA: # %bb.0: # %entry
73 %alloc1 = alloca [16 x i8], align 1
74 %alloc2 = alloca [16 x i8], align 1
75 %part1 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc1, i64 0, i64 0
76 %part2 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc2, i64 0, i64 0
77 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part1)
78 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part2)
79 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part1, i8* align 1 %a, i64 16, i1 false)
80 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part2, i8* align 1 %b, i64 16, i1 false)
81 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part1)
82 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part2)
86 define dso_local void @twoallocs(i8* nocapture %a, i8* nocapture %b) local_unnamed_addr {
87 ; NOAA-LABEL: twoallocs:
88 ; NOAA: # %bb.0: # %entry
89 ; NOAA-NEXT: vmovups (%rdi), %xmm0
90 ; NOAA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
91 ; NOAA-NEXT: vmovups %xmm0, (%rsi)
94 ; AA-LABEL: twoallocs:
95 ; AA: # %bb.0: # %entry
96 ; AA-NEXT: vmovups (%rdi), %xmm0
97 ; AA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
98 ; AA-NEXT: vmovups %xmm0, (%rsi)
101 %alloc1 = alloca [16 x i8], align 1
102 %alloc2 = alloca [16 x i8], align 1
103 %part1 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc1, i64 0, i64 0
104 %part2 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc2, i64 0, i64 0
105 %part2_alias = getelementptr inbounds [16 x i8], [16 x i8]* %alloc2, i64 0, i64 0
106 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part1)
107 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part2)
108 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part2, i8* align 1 %a, i64 16, i1 false)
109 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part1)
110 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %b, i8* align 1 %part2_alias, i64 16, i1 false)
111 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part2)
115 define dso_local void @onealloc_readback_1(i8* nocapture %a, i8* nocapture %b) local_unnamed_addr {
116 ; NOAA-LABEL: onealloc_readback_1:
117 ; NOAA: # %bb.0: # %entry
118 ; NOAA-NEXT: vmovups (%rdi), %xmm0
119 ; NOAA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
120 ; NOAA-NEXT: vmovups (%rsi), %xmm0
121 ; NOAA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
122 ; NOAA-NEXT: vmovups %xmm0, (%rdi)
125 ; AA-LABEL: onealloc_readback_1:
126 ; AA: # %bb.0: # %entry
127 ; AA-NEXT: vmovups (%rsi), %xmm0
128 ; AA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
129 ; AA-NEXT: vmovups %xmm0, (%rdi)
132 %alloc = alloca [16 x i8], i8 2, align 1
133 %part2 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc, i64 0, i64 0
134 %part1 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc, i64 1, i64 0
135 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part1)
136 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part2)
137 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part1, i8* align 1 %a, i64 16, i1 false)
138 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part2, i8* align 1 %b, i64 16, i1 false)
139 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part1)
140 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %a, i8* align 1 %part2, i64 16, i1 false)
141 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part2)
145 define dso_local void @onealloc_readback_2(i8* nocapture %a, i8* nocapture %b) local_unnamed_addr {
146 ; NOAA-LABEL: onealloc_readback_2:
147 ; NOAA: # %bb.0: # %entry
148 ; NOAA-NEXT: vmovups (%rdi), %xmm0
149 ; NOAA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
150 ; NOAA-NEXT: vmovups (%rsi), %xmm0
151 ; NOAA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
152 ; NOAA-NEXT: vmovups %xmm0, (%rdi)
155 ; AA-LABEL: onealloc_readback_2:
156 ; AA: # %bb.0: # %entry
157 ; AA-NEXT: vmovups (%rsi), %xmm0
158 ; AA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
159 ; AA-NEXT: vmovups %xmm0, (%rdi)
162 %alloc = alloca [16 x i8], i8 2, align 1
163 %part1 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc, i64 0, i64 0
164 %part2 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc, i64 1, i64 0
165 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part1)
166 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part2)
167 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part1, i8* align 1 %a, i64 16, i1 false)
168 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part2, i8* align 1 %b, i64 16, i1 false)
169 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part1)
170 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %a, i8* align 1 %part2, i64 16, i1 false)
171 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part2)
176 !llvm.module.flags = !{!0}
179 !0 = !{i32 1, !"wchar_size", i32 4}
180 !1 = !{!"clang version 9.0.0 (trunk 352631) (llvm/trunk 352632)"}
181 !2 = !{i64 0, i64 16, !3}
182 !3 = !{!4, !4, i64 0}
183 !4 = !{!"omnipotent char", !5, i64 0}
184 !5 = !{!"Simple C++ TBAA"}