1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -S -sroa %s | FileCheck %s
3
4; SROA should keep `!tbaa.struct` metadata
5
6%vector = type { float, float }
7declare void @llvm.memcpy.p0i8.p0i8.i64(i8* writeonly, i8* readonly, i64, i1 immarg)
8declare <2 x float> @foo(%vector* %0)
9
10define void @bar(%vector* %y2) {
11; CHECK-LABEL: @bar(
12; CHECK-NEXT:    [[X14:%.*]] = call <2 x float> @foo(%vector* [[Y2:%.*]])
13; CHECK-NEXT:    [[X7_SROA_0_0_X18_SROA_CAST:%.*]] = bitcast %vector* [[Y2]] to <2 x float>*
14; CHECK-NEXT:    store <2 x float> [[X14]], <2 x float>* [[X7_SROA_0_0_X18_SROA_CAST]], align 4, !tbaa.struct !0
15; CHECK-NEXT:    ret void
16;
17  %x7 = alloca %vector
18  %x14 = call <2 x float> @foo(%vector* %y2)
19  %x15 = bitcast %vector* %x7 to <2 x float>*
20  store <2 x float> %x14, <2 x float>* %x15
21  %x19 = bitcast %vector* %x7 to i8*
22  %x18 = bitcast %vector* %y2 to i8*
23  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %x18, i8* align 4 %x19, i64 8, i1 false), !tbaa.struct !10
24  ret void
25}
26
27!4 = !{!"omnipotent char", !5, i64 0}
28!5 = !{!"Simple C++ TBAA"}
29!7 = !{!"vector", !8, i64 0, !8, i64 4}
30!8 = !{!"float", !4, i64 0}
31!10 = !{i64 0, i64 4, !11, i64 4, i64 4, !11}
32!11 = !{!8, !8, i64 0}
33