1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
2 ; RUN: opt -S -passes='sroa<preserve-cfg>' %s | FileCheck %s --check-prefixes=CHECK,CHECK-PRESERVE-CFG
3 ; RUN: opt -S -passes='sroa<modify-cfg>' %s | FileCheck %s --check-prefixes=CHECK,CHECK-MODIFY-CFG
5 ; SROA should keep `!tbaa.struct` metadata
7 %vector = type { float, float }
8 declare void @llvm.memcpy.p0.p0.i64(ptr writeonly, ptr readonly, i64, i1 immarg)
9 declare <2 x float> @foo(ptr %0)
11 define void @bar(ptr %y2) {
13 ; CHECK-NEXT: [[X14:%.*]] = call <2 x float> @foo(ptr [[Y2:%.*]])
14 ; CHECK-NEXT: store <2 x float> [[X14]], ptr [[Y2]], align 4, !tbaa.struct [[TBAA_STRUCT0:![0-9]+]]
15 ; CHECK-NEXT: ret void
18 %x14 = call <2 x float> @foo(ptr %y2)
19 store <2 x float> %x14, ptr %x7
20 call void @llvm.memcpy.p0.p0.i64(ptr align 4 %y2, ptr align 4 %x7, i64 8, i1 false), !tbaa.struct !10
24 !4 = !{!"omnipotent char", !5, i64 0}
25 !5 = !{!"Simple C++ TBAA"}
26 !7 = !{!"vector", !8, i64 0, !8, i64 4}
27 !8 = !{!"float", !4, i64 0}
28 !10 = !{i64 0, i64 4, !11, i64 4, i64 4, !11}
29 !11 = !{!8, !8, i64 0}
31 ; CHECK: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
33 ; CHECK: [[TBAA_STRUCT0]] = !{i64 0, i64 4, !1, i64 4, i64 4, !1}
34 ; CHECK: [[META1:![0-9]+]] = !{!2, !2, i64 0}
35 ; CHECK: [[META2:![0-9]+]] = !{!"float", !3, i64 0}
36 ; CHECK: [[META3:![0-9]+]] = !{!"omnipotent char", !4, i64 0}
37 ; CHECK: [[META4:![0-9]+]] = !{!"Simple C++ TBAA"}
39 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
40 ; CHECK-MODIFY-CFG: {{.*}}
41 ; CHECK-PRESERVE-CFG: {{.*}}