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.p0(i64, ptr nocapture)
6 declare void @llvm.memcpy.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1)
7 declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
9 %struct.S = type { [16 x i8] }
11 define dso_local void @_Z4SwapP1SS0_(ptr nocapture %a, ptr 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 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %tmp.sroa.0)
32 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %tmp.sroa.0, ptr align 1 %a, i64 16, i1 false)
33 tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %a, ptr align 1 %b, i64 16, i1 false), !tbaa.struct !2
34 call void @llvm.memcpy.p0.p0.i64(ptr align 1 %b, ptr nonnull align 1 %tmp.sroa.0, i64 16, i1 false)
35 call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %tmp.sroa.0)
39 define dso_local void @onealloc_noreadback(ptr nocapture %a, ptr nocapture %b) local_unnamed_addr {
40 ; NOAA-LABEL: onealloc_noreadback:
41 ; NOAA: # %bb.0: # %entry
44 ; AA-LABEL: onealloc_noreadback:
45 ; AA: # %bb.0: # %entry
48 %alloc = alloca [16 x i8], i8 2, align 1
49 %part2 = getelementptr inbounds [16 x i8], ptr %alloc, i64 1, i64 0
50 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %alloc)
51 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %part2)
52 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %alloc, ptr align 1 %a, i64 16, i1 false)
53 tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %part2, ptr align 1 %b, i64 16, i1 false)
54 call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %alloc)
55 call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %part2)
60 define dso_local void @twoallocs_trivial(ptr nocapture %a, ptr nocapture %b) local_unnamed_addr {
61 ; NOAA-LABEL: twoallocs_trivial:
62 ; NOAA: # %bb.0: # %entry
65 ; AA-LABEL: twoallocs_trivial:
66 ; AA: # %bb.0: # %entry
69 %alloc1 = alloca [16 x i8], align 1
70 %alloc2 = alloca [16 x i8], align 1
71 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %alloc1)
72 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %alloc2)
73 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %alloc1, ptr align 1 %a, i64 16, i1 false)
74 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %alloc2, ptr align 1 %b, i64 16, i1 false)
75 call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %alloc1)
76 call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %alloc2)
80 define dso_local void @twoallocs(ptr nocapture %a, ptr nocapture %b) local_unnamed_addr {
81 ; NOAA-LABEL: twoallocs:
82 ; NOAA: # %bb.0: # %entry
83 ; NOAA-NEXT: vmovups (%rdi), %xmm0
84 ; NOAA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
85 ; NOAA-NEXT: vmovups %xmm0, (%rsi)
88 ; AA-LABEL: twoallocs:
89 ; AA: # %bb.0: # %entry
90 ; AA-NEXT: vmovups (%rdi), %xmm0
91 ; AA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
92 ; AA-NEXT: vmovups %xmm0, (%rsi)
95 %alloc1 = alloca [16 x i8], align 1
96 %alloc2 = alloca [16 x i8], align 1
97 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %alloc1)
98 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %alloc2)
99 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %alloc2, ptr align 1 %a, i64 16, i1 false)
100 call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %alloc1)
101 tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %b, ptr align 1 %alloc2, i64 16, i1 false)
102 call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %alloc2)
106 define dso_local void @onealloc_readback_1(ptr nocapture %a, ptr nocapture %b) local_unnamed_addr {
107 ; NOAA-LABEL: onealloc_readback_1:
108 ; NOAA: # %bb.0: # %entry
109 ; NOAA-NEXT: vmovups (%rdi), %xmm0
110 ; NOAA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
111 ; NOAA-NEXT: vmovups (%rsi), %xmm0
112 ; NOAA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
113 ; NOAA-NEXT: vmovups %xmm0, (%rdi)
116 ; AA-LABEL: onealloc_readback_1:
117 ; AA: # %bb.0: # %entry
118 ; AA-NEXT: vmovups (%rsi), %xmm0
119 ; AA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
120 ; AA-NEXT: vmovups %xmm0, (%rdi)
123 %alloc = alloca [16 x i8], i8 2, align 1
124 %part1 = getelementptr inbounds [16 x i8], ptr %alloc, i64 1, i64 0
125 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %part1)
126 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %alloc)
127 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %part1, ptr align 1 %a, i64 16, i1 false)
128 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %alloc, ptr align 1 %b, i64 16, i1 false)
129 call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %part1)
130 tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %a, ptr align 1 %alloc, i64 16, i1 false)
131 call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %alloc)
135 define dso_local void @onealloc_readback_2(ptr nocapture %a, ptr nocapture %b) local_unnamed_addr {
136 ; NOAA-LABEL: onealloc_readback_2:
137 ; NOAA: # %bb.0: # %entry
138 ; NOAA-NEXT: vmovups (%rdi), %xmm0
139 ; NOAA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
140 ; NOAA-NEXT: vmovups (%rsi), %xmm0
141 ; NOAA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
142 ; NOAA-NEXT: vmovups %xmm0, (%rdi)
145 ; AA-LABEL: onealloc_readback_2:
146 ; AA: # %bb.0: # %entry
147 ; AA-NEXT: vmovups (%rsi), %xmm0
148 ; AA-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
149 ; AA-NEXT: vmovups %xmm0, (%rdi)
152 %alloc = alloca [16 x i8], i8 2, align 1
153 %part2 = getelementptr inbounds [16 x i8], ptr %alloc, i64 1, i64 0
154 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %alloc)
155 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %part2)
156 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %alloc, ptr align 1 %a, i64 16, i1 false)
157 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %part2, ptr align 1 %b, i64 16, i1 false)
158 call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %alloc)
159 tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %a, ptr align 1 %part2, i64 16, i1 false)
160 call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %part2)
165 !llvm.module.flags = !{!0}
168 !0 = !{i32 1, !"wchar_size", i32 4}
169 !1 = !{!"clang version 9.0.0 (trunk 352631) (llvm/trunk 352632)"}
170 !2 = !{i64 0, i64 16, !3}
171 !3 = !{!4, !4, i64 0}
172 !4 = !{!"omnipotent char", !5, i64 0}
173 !5 = !{!"Simple C++ TBAA"}