• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -instcombine -S | FileCheck %s
3target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64"
4@C.0.1248 = internal constant [128 x float] [ float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float 0.000000e+00, float -1.000000e+00, float -1.000000e+00, float 0.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float -1.000000e+00, float -1.000000e+00, float 1.000000e+00, float 0.000000e+00, float -1.000000e+00, float 0.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float 0.000000e+00, float -1.000000e+00, float 1.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float -1.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 1.000000e+00, float -1.000000e+00, float 1.000000e+00, float -1.000000e+00, float 0.000000e+00, float -1.000000e+00, float 1.000000e+00, float 0.000000e+00, float -1.000000e+00, float -1.000000e+00, float 1.000000e+00, float 0.000000e+00, float 1.000000e+00, float -1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 0.000000e+00, float 0.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float 0.000000e+00, float -1.000000e+00, float -1.000000e+00, float 1.000000e+00, float 0.000000e+00, float -1.000000e+00, float 1.000000e+00, float -1.000000e+00, float 0.000000e+00, float -1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float -1.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float -1.000000e+00, float 0.000000e+00, float -1.000000e+00, float 1.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 1.000000e+00, float -1.000000e+00, float 1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 0.000000e+00, float -1.000000e+00, float -1.000000e+00, float 1.000000e+00, float 0.000000e+00, float -1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 0.000000e+00, float 1.000000e+00, float -1.000000e+00, float 1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 1.000000e+00, float 0.000000e+00, float -1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00, float -1.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float -1.000000e+00, float 1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 1.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00 ], align 32		; <[128 x float]*> [#uses=1]
5
6define float @test1(i32 %hash, float %x, float %y, float %z, float %w) {
7; CHECK-LABEL: @test1(
8; CHECK-NEXT:  entry:
9; CHECK-NEXT:    [[TMP3:%.*]] = shl i32 [[HASH:%.*]], 2
10; CHECK-NEXT:    [[TMP5:%.*]] = and i32 [[TMP3]], 124
11; CHECK-NEXT:    [[TMP0:%.*]] = zext i32 [[TMP5]] to i64
12; CHECK-NEXT:    [[TMP753:%.*]] = getelementptr [128 x float], [128 x float]* @C.0.1248, i64 0, i64 [[TMP0]]
13; CHECK-NEXT:    [[TMP9:%.*]] = load float, float* [[TMP753]], align 16
14; CHECK-NEXT:    [[TMP11:%.*]] = fmul float [[TMP9]], [[X:%.*]]
15; CHECK-NEXT:    [[TMP13:%.*]] = fadd float [[TMP11]], 0.000000e+00
16; CHECK-NEXT:    [[TMP17_SUM52:%.*]] = or i32 [[TMP5]], 1
17; CHECK-NEXT:    [[TMP1:%.*]] = zext i32 [[TMP17_SUM52]] to i64
18; CHECK-NEXT:    [[TMP1851:%.*]] = getelementptr [128 x float], [128 x float]* @C.0.1248, i64 0, i64 [[TMP1]]
19; CHECK-NEXT:    [[TMP19:%.*]] = load float, float* [[TMP1851]], align 4
20; CHECK-NEXT:    [[TMP21:%.*]] = fmul float [[TMP19]], [[Y:%.*]]
21; CHECK-NEXT:    [[TMP23:%.*]] = fadd float [[TMP21]], [[TMP13]]
22; CHECK-NEXT:    [[TMP27_SUM50:%.*]] = or i32 [[TMP5]], 2
23; CHECK-NEXT:    [[TMP2:%.*]] = zext i32 [[TMP27_SUM50]] to i64
24; CHECK-NEXT:    [[TMP2849:%.*]] = getelementptr [128 x float], [128 x float]* @C.0.1248, i64 0, i64 [[TMP2]]
25; CHECK-NEXT:    [[TMP29:%.*]] = load float, float* [[TMP2849]], align 8
26; CHECK-NEXT:    [[TMP31:%.*]] = fmul float [[TMP29]], [[Z:%.*]]
27; CHECK-NEXT:    [[TMP33:%.*]] = fadd float [[TMP31]], [[TMP23]]
28; CHECK-NEXT:    [[TMP37_SUM48:%.*]] = or i32 [[TMP5]], 3
29; CHECK-NEXT:    [[TMP3:%.*]] = zext i32 [[TMP37_SUM48]] to i64
30; CHECK-NEXT:    [[TMP3847:%.*]] = getelementptr [128 x float], [128 x float]* @C.0.1248, i64 0, i64 [[TMP3]]
31; CHECK-NEXT:    [[TMP39:%.*]] = load float, float* [[TMP3847]], align 4
32; CHECK-NEXT:    [[TMP41:%.*]] = fmul float [[TMP39]], [[W:%.*]]
33; CHECK-NEXT:    [[TMP43:%.*]] = fadd float [[TMP41]], [[TMP33]]
34; CHECK-NEXT:    ret float [[TMP43]]
35;
36entry:
37  %lookupTable = alloca [128 x float], align 16		; <[128 x float]*> [#uses=5]
38  %lookupTable1 = bitcast [128 x float]* %lookupTable to i8*		; <i8*> [#uses=1]
39  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 %lookupTable1, i8* align 16 bitcast ([128 x float]* @C.0.1248 to i8*), i64 512, i1 false)
40
41
42  %tmp3 = shl i32 %hash, 2		; <i32> [#uses=1]
43  %tmp5 = and i32 %tmp3, 124		; <i32> [#uses=4]
44  %tmp753 = getelementptr [128 x float], [128 x float]* %lookupTable, i32 0, i32 %tmp5		; <float*> [#uses=1]
45  %tmp9 = load float, float* %tmp753		; <float> [#uses=1]
46  %tmp11 = fmul float %tmp9, %x		; <float> [#uses=1]
47  %tmp13 = fadd float %tmp11, 0.000000e+00		; <float> [#uses=1]
48  %tmp17.sum52 = or i32 %tmp5, 1		; <i32> [#uses=1]
49  %tmp1851 = getelementptr [128 x float], [128 x float]* %lookupTable, i32 0, i32 %tmp17.sum52		; <float*> [#uses=1]
50  %tmp19 = load float, float* %tmp1851		; <float> [#uses=1]
51  %tmp21 = fmul float %tmp19, %y		; <float> [#uses=1]
52  %tmp23 = fadd float %tmp21, %tmp13		; <float> [#uses=1]
53  %tmp27.sum50 = or i32 %tmp5, 2		; <i32> [#uses=1]
54  %tmp2849 = getelementptr [128 x float], [128 x float]* %lookupTable, i32 0, i32 %tmp27.sum50		; <float*> [#uses=1]
55  %tmp29 = load float, float* %tmp2849		; <float> [#uses=1]
56  %tmp31 = fmul float %tmp29, %z		; <float> [#uses=1]
57  %tmp33 = fadd float %tmp31, %tmp23		; <float> [#uses=1]
58  %tmp37.sum48 = or i32 %tmp5, 3		; <i32> [#uses=1]
59  %tmp3847 = getelementptr [128 x float], [128 x float]* %lookupTable, i32 0, i32 %tmp37.sum48		; <float*> [#uses=1]
60  %tmp39 = load float, float* %tmp3847		; <float> [#uses=1]
61  %tmp41 = fmul float %tmp39, %w		; <float> [#uses=1]
62  %tmp43 = fadd float %tmp41, %tmp33		; <float> [#uses=1]
63  ret float %tmp43
64}
65
66declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1) nounwind
67declare void @llvm.memcpy.p1i8.p0i8.i64(i8 addrspace(1)* nocapture, i8* nocapture, i64, i1) nounwind
68declare void @llvm.memcpy.p0i8.p1i8.i64(i8* nocapture, i8 addrspace(1)* nocapture, i64, i1) nounwind
69declare void @llvm.memcpy.p1i8.p1i8.i64(i8 addrspace(1)* nocapture, i8 addrspace(1)* nocapture, i64, i1) nounwind
70
71%T = type { i8, [123 x i8] }
72%U = type { i32, i32, i32, i32, i32 }
73
74@G = constant %T {i8 1, [123 x i8] zeroinitializer }
75@H = constant [2 x %U] zeroinitializer, align 16
76
77define void @test2() {
78; CHECK-LABEL: @test2(
79; CHECK-NEXT:    [[B1:%.*]] = alloca [124 x i8], align 8
80; CHECK-NEXT:    [[B1_SUB:%.*]] = getelementptr inbounds [124 x i8], [124 x i8]* [[B1]], i64 0, i64 0
81; CHECK-NEXT:    call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 8 dereferenceable(124) [[B1_SUB]], i8* nonnull align 16 dereferenceable(124) getelementptr inbounds (%T, %T* @G, i64 0, i32 0), i64 124, i1 false)
82; CHECK-NEXT:    call void @bar(i8* nonnull [[B1_SUB]])
83; CHECK-NEXT:    ret void
84;
85  %A = alloca %T
86  %B = alloca %T
87  %a = bitcast %T* %A to i8*
88  %b = bitcast %T* %B to i8*
89
90
91; %A alloca is deleted
92
93; use @G instead of %A
94  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a, i8* align 4 bitcast (%T* @G to i8*), i64 124, i1 false)
95  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %b, i8* align 4 %a, i64 124, i1 false)
96  call void @bar(i8* %b)
97  ret void
98}
99
100define void @test2_no_null_opt() #0 {
101; CHECK-LABEL: @test2_no_null_opt(
102; CHECK-NEXT:    [[B1:%.*]] = alloca [124 x i8], align 8
103; CHECK-NEXT:    [[B1_SUB:%.*]] = getelementptr inbounds [124 x i8], [124 x i8]* [[B1]], i64 0, i64 0
104; CHECK-NEXT:    call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 dereferenceable(124) [[B1_SUB]], i8* align 16 dereferenceable(124) getelementptr inbounds (%T, %T* @G, i64 0, i32 0), i64 124, i1 false)
105; CHECK-NEXT:    call void @bar(i8* [[B1_SUB]])
106; CHECK-NEXT:    ret void
107;
108  %A = alloca %T
109  %B = alloca %T
110  %a = bitcast %T* %A to i8*
111  %b = bitcast %T* %B to i8*
112
113
114; %A alloca is deleted
115
116; use @G instead of %A
117  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a, i8* align 4 bitcast (%T* @G to i8*), i64 124, i1 false)
118  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %b, i8* align 4 %a, i64 124, i1 false)
119  call void @bar(i8* %b)
120  ret void
121}
122
123define void @test2_addrspacecast() {
124; CHECK-LABEL: @test2_addrspacecast(
125; CHECK-NEXT:    [[B1:%.*]] = alloca [124 x i8], align 8
126; CHECK-NEXT:    [[B1_SUB:%.*]] = getelementptr inbounds [124 x i8], [124 x i8]* [[B1]], i64 0, i64 0
127; CHECK-NEXT:    [[B:%.*]] = addrspacecast i8* [[B1_SUB]] to i8 addrspace(1)*
128; CHECK-NEXT:    call void @llvm.memcpy.p1i8.p1i8.i64(i8 addrspace(1)* align 4 dereferenceable(124) [[B]], i8 addrspace(1)* align 4 dereferenceable(124) addrspacecast (i8* getelementptr inbounds (%T, %T* @G, i64 0, i32 0) to i8 addrspace(1)*), i64 124, i1 false)
129; CHECK-NEXT:    call void @bar_as1(i8 addrspace(1)* [[B]])
130; CHECK-NEXT:    ret void
131;
132  %A = alloca %T
133  %B = alloca %T
134  %a = addrspacecast %T* %A to i8 addrspace(1)*
135  %b = addrspacecast %T* %B to i8 addrspace(1)*
136
137
138; %A alloca is deleted
139; This doesn't exactly match what test2 does, because folding the type
140; cast into the alloca doesn't work for the addrspacecast yet.
141
142; use @G instead of %A
143  call void @llvm.memcpy.p1i8.p0i8.i64(i8 addrspace(1)* align 4 %a, i8* align 4 bitcast (%T* @G to i8*), i64 124, i1 false)
144  call void @llvm.memcpy.p1i8.p1i8.i64(i8 addrspace(1)* align 4 %b, i8 addrspace(1)* align 4 %a, i64 124, i1 false)
145  call void @bar_as1(i8 addrspace(1)* %b)
146  ret void
147}
148
149declare void @bar(i8*)
150declare void @bar_as1(i8 addrspace(1)*)
151
152
153;; Should be able to eliminate the alloca.
154define void @test3() {
155; CHECK-LABEL: @test3(
156; CHECK-NEXT:    call void @bar(i8* getelementptr inbounds (%T, %T* @G, i64 0, i32 0)) [[ATTR2:#.*]]
157; CHECK-NEXT:    ret void
158;
159  %A = alloca %T
160  %a = bitcast %T* %A to i8*
161  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a, i8* align 4 bitcast (%T* @G to i8*), i64 124, i1 false)
162  call void @bar(i8* %a) readonly
163  ret void
164}
165
166define void @test3_addrspacecast() {
167; CHECK-LABEL: @test3_addrspacecast(
168; CHECK-NEXT:    call void @bar(i8* getelementptr inbounds (%T, %T* @G, i64 0, i32 0)) [[ATTR2]]
169; CHECK-NEXT:    ret void
170;
171  %A = alloca %T
172  %a = bitcast %T* %A to i8*
173  call void @llvm.memcpy.p0i8.p1i8.i64(i8* align 4 %a, i8 addrspace(1)* align 4 addrspacecast (%T* @G to i8 addrspace(1)*), i64 124, i1 false)
174  call void @bar(i8* %a) readonly
175  ret void
176}
177
178
179define void @test4() {
180; CHECK-LABEL: @test4(
181; CHECK-NEXT:    call void @baz(i8* byval(i8) getelementptr inbounds (%T, %T* @G, i64 0, i32 0))
182; CHECK-NEXT:    ret void
183;
184  %A = alloca %T
185  %a = bitcast %T* %A to i8*
186  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a, i8* align 4 bitcast (%T* @G to i8*), i64 124, i1 false)
187  call void @baz(i8* byval(i8) %a)
188  ret void
189}
190
191declare void @llvm.lifetime.start.p0i8(i64, i8*)
192define void @test5() {
193; CHECK-LABEL: @test5(
194; CHECK-NEXT:    call void @baz(i8* byval(i8) getelementptr inbounds (%T, %T* @G, i64 0, i32 0))
195; CHECK-NEXT:    ret void
196;
197  %A = alloca %T
198  %a = bitcast %T* %A to i8*
199  call void @llvm.lifetime.start.p0i8(i64 -1, i8* %a)
200  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a, i8* align 4 bitcast (%T* @G to i8*), i64 124, i1 false)
201  call void @baz(i8* byval(i8) %a)
202  ret void
203}
204
205
206declare void @baz(i8* byval(i8))
207
208
209define void @test6() {
210; CHECK-LABEL: @test6(
211; CHECK-NEXT:    call void @bar(i8* bitcast ([2 x %U]* @H to i8*)) [[ATTR2]]
212; CHECK-NEXT:    ret void
213;
214  %A = alloca %U, align 16
215  %a = bitcast %U* %A to i8*
216  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 %a, i8* align 16 bitcast ([2 x %U]* @H to i8*), i64 20, i1 false)
217  call void @bar(i8* %a) readonly
218  ret void
219}
220
221define void @test7() {
222; CHECK-LABEL: @test7(
223; CHECK-NEXT:    call void @bar(i8* bitcast ([2 x %U]* @H to i8*)) [[ATTR2]]
224; CHECK-NEXT:    ret void
225;
226  %A = alloca %U, align 16
227  %a = bitcast %U* %A to i8*
228  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a, i8* align 4 bitcast (%U* getelementptr ([2 x %U], [2 x %U]* @H, i64 0, i32 0) to i8*), i64 20, i1 false)
229  call void @bar(i8* %a) readonly
230  ret void
231}
232
233define void @test8() {
234; CHECK-LABEL: @test8(
235; CHECK-NEXT:    [[AL:%.*]] = alloca [[U:%.*]], align 16
236; CHECK-NEXT:    [[A:%.*]] = bitcast %U* [[AL]] to i8*
237; CHECK-NEXT:    call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 16 dereferenceable(20) [[A]], i8* nonnull align 4 dereferenceable(20) bitcast (%U* getelementptr inbounds ([2 x %U], [2 x %U]* @H, i64 0, i64 1) to i8*), i64 20, i1 false)
238; CHECK-NEXT:    call void @bar(i8* nonnull [[A]]) [[ATTR2]]
239; CHECK-NEXT:    ret void
240;
241  %al = alloca %U, align 16
242  %a = bitcast %U* %al to i8*
243  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a, i8* align 4 bitcast (%U* getelementptr ([2 x %U], [2 x %U]* @H, i64 0, i32 1) to i8*), i64 20, i1 false)
244  call void @bar(i8* %a) readonly
245  ret void
246}
247
248
249define void @test8_addrspacecast() {
250; CHECK-LABEL: @test8_addrspacecast(
251; CHECK-NEXT:    [[AL:%.*]] = alloca [[U:%.*]], align 16
252; CHECK-NEXT:    [[A:%.*]] = bitcast %U* [[AL]] to i8*
253; CHECK-NEXT:    call void @llvm.memcpy.p0i8.p1i8.i64(i8* nonnull align 16 dereferenceable(20) [[A]], i8 addrspace(1)* align 4 dereferenceable(20) addrspacecast (i8* bitcast (%U* getelementptr inbounds ([2 x %U], [2 x %U]* @H, i64 0, i64 1) to i8*) to i8 addrspace(1)*), i64 20, i1 false)
254; CHECK-NEXT:    call void @bar(i8* nonnull [[A]]) [[ATTR2]]
255; CHECK-NEXT:    ret void
256;
257  %Al = alloca %U, align 16
258  %a = bitcast %U* %Al to i8*
259  call void @llvm.memcpy.p0i8.p1i8.i64(i8* align 4 %a, i8 addrspace(1)* align 4 addrspacecast (%U* getelementptr ([2 x %U], [2 x %U]* @H, i64 0, i32 1) to i8 addrspace(1)*), i64 20, i1 false)
260  call void @bar(i8* %a) readonly
261  ret void
262}
263
264define void @test9() {
265; CHECK-LABEL: @test9(
266; CHECK-NEXT:    call void @bar(i8* bitcast (%U* getelementptr inbounds ([2 x %U], [2 x %U]* @H, i64 0, i64 1) to i8*)) [[ATTR2]]
267; CHECK-NEXT:    ret void
268;
269  %A = alloca %U, align 4
270  %a = bitcast %U* %A to i8*
271  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a, i8* align 4 bitcast (%U* getelementptr ([2 x %U], [2 x %U]* @H, i64 0, i32 1) to i8*), i64 20, i1 false)
272  call void @bar(i8* %a) readonly
273  ret void
274}
275
276define void @test9_addrspacecast() {
277; CHECK-LABEL: @test9_addrspacecast(
278; CHECK-NEXT:    call void @bar(i8* bitcast (%U* getelementptr inbounds ([2 x %U], [2 x %U]* @H, i64 0, i64 1) to i8*)) [[ATTR2]]
279; CHECK-NEXT:    ret void
280;
281  %A = alloca %U, align 4
282  %a = bitcast %U* %A to i8*
283  call void @llvm.memcpy.p0i8.p1i8.i64(i8* align 4 %a, i8 addrspace(1)* align 4 addrspacecast (%U* getelementptr ([2 x %U], [2 x %U]* @H, i64 0, i32 1) to i8 addrspace(1)*), i64 20, i1 false)
284  call void @bar(i8* %a) readonly
285  ret void
286}
287
288@bbb = local_unnamed_addr global [1000000 x i8] zeroinitializer, align 16
289@_ZL3KKK = internal unnamed_addr constant [3 x i8] c"\01\01\02", align 1
290
291; Should not replace alloca with global because of size mismatch.
292define void @test9_small_global() {
293; CHECK-LABEL: @test9_small_global(
294; CHECK-NEXT:  entry:
295; CHECK-NEXT:    [[CC:%.*]] = alloca [1000000 x i8], align 16
296; CHECK-NEXT:    [[ARRAYDECAY:%.*]] = getelementptr inbounds [1000000 x i8], [1000000 x i8]* [[CC]], i64 0, i64 0
297; CHECK-NEXT:    call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 16 dereferenceable(3) [[ARRAYDECAY]], i8* nonnull align 16 dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @_ZL3KKK, i64 0, i64 0), i64 3, i1 false)
298; CHECK-NEXT:    call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 16 dereferenceable(1000000) getelementptr inbounds ([1000000 x i8], [1000000 x i8]* @bbb, i64 0, i64 0), i8* nonnull align 16 dereferenceable(1000000) [[ARRAYDECAY]], i64 1000000, i1 false)
299; CHECK-NEXT:    ret void
300;
301entry:
302  %cc = alloca [1000000 x i8], align 16
303  %cc.0..sroa_idx = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %cc, i64 0, i64 0
304  %arraydecay = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %cc, i32 0, i32 0
305  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %arraydecay, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @_ZL3KKK, i32 0, i32 0), i64 3, i1 false)
306  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 getelementptr inbounds ([1000000 x i8], [1000000 x i8]* @bbb, i32 0, i32 0), i8* align 16 %arraydecay, i64 1000000, i1 false)
307  ret void
308}
309
310; Should replace alloca with global as they have exactly the same size.
311define void @test10_same_global() {
312; CHECK-LABEL: @test10_same_global(
313; CHECK-NEXT:  entry:
314; CHECK-NEXT:    call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 16 dereferenceable(3) getelementptr inbounds ([1000000 x i8], [1000000 x i8]* @bbb, i64 0, i64 0), i8* nonnull align 16 dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @_ZL3KKK, i64 0, i64 0), i64 3, i1 false)
315; CHECK-NEXT:    ret void
316;
317entry:
318  %cc = alloca [3 x i8], align 1
319  %cc.0..sroa_idx = getelementptr inbounds [3 x i8], [3 x i8]* %cc, i64 0, i64 0
320  %arraydecay = getelementptr inbounds [3 x i8], [3 x i8]* %cc, i32 0, i32 0
321  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %arraydecay, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @_ZL3KKK, i32 0, i32 0), i64 3, i1 false)
322  call void @llvm.memcpy.p0i8.p0i8.i64(i8* getelementptr inbounds ([1000000 x i8], [1000000 x i8]* @bbb, i32 0, i32 0), i8* %arraydecay, i64 3, i1 false)
323  ret void
324}
325
326attributes #0 = { null_pointer_is_valid }
327