1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -basic-aa -dse -S | FileCheck %s
3 ; RUN: opt < %s -aa-pipeline=basic-aa -passes=dse -S | FileCheck %s
5 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
7 %struct.Village = type { [4 x %struct.Village*], %struct.Village*, %struct.List, %struct.Hosp, i32, i64 }
8 %struct.List = type { %struct.List*, %struct.Patient*, %struct.List* }
9 %struct.Patient = type { i32, i32, i32, %struct.Village* }
10 %struct.Hosp = type { i32, i32, i32, %struct.List, %struct.List, %struct.List, %struct.List }
12 declare %struct.Village* @alloc(%struct.Village*)
14 define i8* @alloc_tree() {
15 ; CHECK-LABEL: @alloc_tree(
17 ; CHECK-NEXT: [[FVAL:%.*]] = alloca [4 x %struct.Village*], align 16
18 ; CHECK-NEXT: [[TMP0:%.*]] = bitcast [4 x %struct.Village*]* [[FVAL]] to i8*
19 ; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 32, i8* nonnull [[TMP0]])
20 ; CHECK-NEXT: [[CALL:%.*]] = tail call dereferenceable_or_null(192) i8* @malloc(i64 192)
21 ; CHECK-NEXT: [[TMP1:%.*]] = bitcast i8* [[CALL]] to %struct.Village*
22 ; CHECK-NEXT: [[CALL3:%.*]] = tail call %struct.Village* @alloc(%struct.Village* [[TMP1]])
23 ; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [4 x %struct.Village*], [4 x %struct.Village*]* [[FVAL]], i64 0, i64 3
24 ; CHECK-NEXT: store %struct.Village* [[CALL3]], %struct.Village** [[ARRAYIDX]], align 8
25 ; CHECK-NEXT: [[CALL3_1:%.*]] = tail call %struct.Village* @alloc(%struct.Village* [[TMP1]])
26 ; CHECK-NEXT: [[ARRAYIDX_1:%.*]] = getelementptr inbounds [4 x %struct.Village*], [4 x %struct.Village*]* [[FVAL]], i64 0, i64 2
27 ; CHECK-NEXT: store %struct.Village* [[CALL3_1]], %struct.Village** [[ARRAYIDX_1]], align 16
28 ; CHECK-NEXT: [[CALL3_2:%.*]] = tail call %struct.Village* @alloc(%struct.Village* [[TMP1]])
29 ; CHECK-NEXT: [[ARRAYIDX_2:%.*]] = getelementptr inbounds [4 x %struct.Village*], [4 x %struct.Village*]* [[FVAL]], i64 0, i64 1
30 ; CHECK-NEXT: store %struct.Village* [[CALL3_2]], %struct.Village** [[ARRAYIDX_2]], align 8
31 ; CHECK-NEXT: [[CALL3_3:%.*]] = tail call %struct.Village* @alloc(%struct.Village* [[TMP1]])
32 ; CHECK-NEXT: [[ARRAYIDX_3:%.*]] = getelementptr inbounds [4 x %struct.Village*], [4 x %struct.Village*]* [[FVAL]], i64 0, i64 0
33 ; CHECK-NEXT: store %struct.Village* [[CALL3_3]], %struct.Village** [[ARRAYIDX_3]], align 16
34 ; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 8 dereferenceable(32) [[CALL]], i8* nonnull align 16 dereferenceable(32) [[TMP0]], i64 32, i1 false)
35 ; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 32, i8* nonnull [[TMP0]])
36 ; CHECK-NEXT: ret i8* [[CALL]]
39 %fval = alloca [4 x %struct.Village*], align 16
40 %0 = bitcast [4 x %struct.Village*]* %fval to i8*
41 call void @llvm.lifetime.start.p0i8(i64 32, i8* nonnull %0) #7
42 %call = tail call dereferenceable_or_null(192) i8* @malloc(i64 192) #8
43 %1 = bitcast i8* %call to %struct.Village*
44 %call3 = tail call %struct.Village* @alloc(%struct.Village* %1)
45 %arrayidx = getelementptr inbounds [4 x %struct.Village*], [4 x %struct.Village*]* %fval, i64 0, i64 3
46 store %struct.Village* %call3, %struct.Village** %arrayidx, align 8
47 %call3.1 = tail call %struct.Village* @alloc(%struct.Village* %1)
48 %arrayidx.1 = getelementptr inbounds [4 x %struct.Village*], [4 x %struct.Village*]* %fval, i64 0, i64 2
49 store %struct.Village* %call3.1, %struct.Village** %arrayidx.1, align 16
50 %call3.2 = tail call %struct.Village* @alloc(%struct.Village* %1)
51 %arrayidx.2 = getelementptr inbounds [4 x %struct.Village*], [4 x %struct.Village*]* %fval, i64 0, i64 1
52 store %struct.Village* %call3.2, %struct.Village** %arrayidx.2, align 8
53 %call3.3 = tail call %struct.Village* @alloc(%struct.Village* %1)
54 %arrayidx.3 = getelementptr inbounds [4 x %struct.Village*], [4 x %struct.Village*]* %fval, i64 0, i64 0
55 store %struct.Village* %call3.3, %struct.Village** %arrayidx.3, align 16
56 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 8 dereferenceable(32) %call, i8* nonnull align 16 dereferenceable(32) %0, i64 32, i1 false)
57 call void @llvm.lifetime.end.p0i8(i64 32, i8* nonnull %0) #7
61 declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture)
62 declare noalias i8* @malloc(i64)
63 declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture)
64 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg)