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: vmovups %xmm0, (%rsi)
93 ; AA-LABEL: twoallocs:
94 ; AA: # %bb.0: # %entry
95 ; AA-NEXT: vmovups (%rdi), %xmm0
96 ; AA-NEXT: vmovups %xmm0, (%rsi)
99 %alloc1 = alloca [16 x i8], align 1
100 %alloc2 = alloca [16 x i8], align 1
101 %part1 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc1, i64 0, i64 0
102 %part2 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc2, i64 0, i64 0
103 %part2_alias = getelementptr inbounds [16 x i8], [16 x i8]* %alloc2, i64 0, i64 0
104 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part1)
105 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part2)
106 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part2, i8* align 1 %a, i64 16, i1 false)
107 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part1)
108 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %b, i8* align 1 %part2_alias, i64 16, i1 false)
109 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part2)
113 define dso_local void @onealloc_readback_1(i8* nocapture %a, i8* nocapture %b) local_unnamed_addr {
114 ; NOAA-LABEL: onealloc_readback_1:
115 ; NOAA: # %bb.0: # %entry
116 ; NOAA-NEXT: vmovups (%rdi), %xmm0
117 ; NOAA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
118 ; NOAA-NEXT: vmovups (%rsi), %xmm0
119 ; NOAA-NEXT: vmovups %xmm0, (%rdi)
122 ; AA-LABEL: onealloc_readback_1:
123 ; AA: # %bb.0: # %entry
124 ; AA-NEXT: vmovups (%rsi), %xmm0
125 ; AA-NEXT: vmovups %xmm0, (%rdi)
128 %alloc = alloca [16 x i8], i8 2, align 1
129 %part2 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc, i64 0, i64 0
130 %part1 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc, i64 1, i64 0
131 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part1)
132 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part2)
133 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part1, i8* align 1 %a, i64 16, i1 false)
134 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part2, i8* align 1 %b, i64 16, i1 false)
135 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part1)
136 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %a, i8* align 1 %part2, i64 16, i1 false)
137 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part2)
141 define dso_local void @onealloc_readback_2(i8* nocapture %a, i8* nocapture %b) local_unnamed_addr {
142 ; NOAA-LABEL: onealloc_readback_2:
143 ; NOAA: # %bb.0: # %entry
144 ; NOAA-NEXT: vmovups (%rdi), %xmm0
145 ; NOAA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
146 ; NOAA-NEXT: vmovups (%rsi), %xmm0
147 ; NOAA-NEXT: vmovups %xmm0, (%rdi)
150 ; AA-LABEL: onealloc_readback_2:
151 ; AA: # %bb.0: # %entry
152 ; AA-NEXT: vmovups (%rsi), %xmm0
153 ; AA-NEXT: vmovups %xmm0, (%rdi)
156 %alloc = alloca [16 x i8], i8 2, align 1
157 %part1 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc, i64 0, i64 0
158 %part2 = getelementptr inbounds [16 x i8], [16 x i8]* %alloc, i64 1, i64 0
159 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part1)
160 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %part2)
161 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part1, i8* align 1 %a, i64 16, i1 false)
162 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %part2, i8* align 1 %b, i64 16, i1 false)
163 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part1)
164 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %a, i8* align 1 %part2, i64 16, i1 false)
165 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %part2)
170 !llvm.module.flags = !{!0}
173 !0 = !{i32 1, !"wchar_size", i32 4}
174 !1 = !{!"clang version 9.0.0 (trunk 352631) (llvm/trunk 352632)"}
175 !2 = !{i64 0, i64 16, !3}
176 !3 = !{!4, !4, i64 0}
177 !4 = !{!"omnipotent char", !5, i64 0}
178 !5 = !{!"Simple C++ TBAA"}