1 ; RUN: llc < %s -O2 -mtriple=arm64-apple-darwin | FileCheck %s
4 %struct.CGRect = type { %struct.CGPoint, %struct.CGSize }
5 %struct.CGPoint = type { double, double }
6 %struct.CGSize = type { double, double }
8 @"OBJC_IVAR_$_UIScreen._bounds" = external hidden global i64, section "__DATA, __objc_ivar", align 8
10 define hidden %struct.CGRect @nofold(ptr nocapture %self, ptr nocapture %_cmd) nounwind readonly optsize ssp {
12 ; CHECK-LABEL: nofold:
13 ; CHECK: add x[[REG:[0-9]+]], x0, x{{[0-9]+}}
14 ; CHECK: ldp d0, d1, [x[[REG]]]
15 ; CHECK: ldp d2, d3, [x[[REG]], #16]
17 %ivar = load i64, ptr @"OBJC_IVAR_$_UIScreen._bounds", align 8, !invariant.load !4
18 %add.ptr = getelementptr inbounds i8, ptr %self, i64 %ivar
19 %tmp11 = load double, ptr %add.ptr, align 8
20 %add.ptr.sum = add i64 %ivar, 8
21 %add.ptr10.1 = getelementptr inbounds i8, ptr %self, i64 %add.ptr.sum
22 %tmp12 = load double, ptr %add.ptr10.1, align 8
23 %add.ptr.sum17 = add i64 %ivar, 16
24 %add.ptr4.1 = getelementptr inbounds i8, ptr %self, i64 %add.ptr.sum17
25 %tmp = load double, ptr %add.ptr4.1, align 8
26 %add.ptr4.1.sum = add i64 %ivar, 24
27 %add.ptr4.1.1 = getelementptr inbounds i8, ptr %self, i64 %add.ptr4.1.sum
28 %tmp5 = load double, ptr %add.ptr4.1.1, align 8
29 %insert14 = insertvalue %struct.CGPoint undef, double %tmp11, 0
30 %insert16 = insertvalue %struct.CGPoint %insert14, double %tmp12, 1
31 %insert = insertvalue %struct.CGRect undef, %struct.CGPoint %insert16, 0
32 %insert7 = insertvalue %struct.CGSize undef, double %tmp, 0
33 %insert9 = insertvalue %struct.CGSize %insert7, double %tmp5, 1
34 %insert3 = insertvalue %struct.CGRect %insert, %struct.CGSize %insert9, 1
35 ret %struct.CGRect %insert3
38 define hidden %struct.CGRect @fold(ptr nocapture %self, ptr nocapture %_cmd) nounwind readonly optsize ssp {
41 ; CHECK: ldr d0, [x0, x{{[0-9]+}}]
42 ; CHECK-NOT: add x0, x0, x1
44 %ivar = load i64, ptr @"OBJC_IVAR_$_UIScreen._bounds", align 8, !invariant.load !4
45 %add.ptr = getelementptr inbounds i8, ptr %self, i64 %ivar
46 %tmp11 = load double, ptr %add.ptr, align 8
47 %add.ptr10.1 = getelementptr inbounds i8, ptr %self, i64 %ivar
48 %tmp12 = load double, ptr %add.ptr10.1, align 8
49 %add.ptr4.1 = getelementptr inbounds i8, ptr %self, i64 %ivar
50 %tmp = load double, ptr %add.ptr4.1, align 8
51 %add.ptr4.1.1 = getelementptr inbounds i8, ptr %self, i64 %ivar
52 %tmp5 = load double, ptr %add.ptr4.1.1, align 8
53 %insert14 = insertvalue %struct.CGPoint undef, double %tmp11, 0
54 %insert16 = insertvalue %struct.CGPoint %insert14, double %tmp12, 1
55 %insert = insertvalue %struct.CGRect undef, %struct.CGPoint %insert16, 0
56 %insert7 = insertvalue %struct.CGSize undef, double %tmp, 0
57 %insert9 = insertvalue %struct.CGSize %insert7, double %tmp5, 1
58 %insert3 = insertvalue %struct.CGRect %insert, %struct.CGSize %insert9, 1
59 ret %struct.CGRect %insert3
63 !llvm.module.flags = !{!0, !1, !2, !3}
65 !0 = !{i32 1, !"Objective-C Version", i32 2}
66 !1 = !{i32 1, !"Objective-C Image Info Version", i32 0}
67 !2 = !{i32 1, !"Objective-C Image Info Section", !"__DATA, __objc_imageinfo, regular, no_dead_strip"}
68 !3 = !{i32 4, !"Objective-C Garbage Collection", i32 0}