xref: /llvm-project/llvm/test/CodeGen/AArch64/call-rv-marker.ll (revision 201572e34b2cb0861a60e00fd7dc2965e6af1587)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
2; RUN: llc -o - %s | FileCheck --check-prefix=SELDAG --check-prefix=CHECK %s
3; RUN: llc -global-isel -o - %s | FileCheck --check-prefix=GISEL --check-prefix=CHECK %s
4
5target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
6target triple = "arm64-apple-ios"
7
8declare ptr @foo0(i32)
9declare ptr @foo1()
10
11declare void @llvm.objc.release(ptr)
12declare void @objc_object(ptr)
13
14declare void @foo2(ptr)
15
16declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture)
17
18declare ptr @_ZN1SD1Ev(ptr nonnull dereferenceable(1))
19
20declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)
21
22
23%struct.S = type { i8 }
24
25@g = dso_local global ptr null, align 8
26@fptr = dso_local global ptr null, align 8
27
28define dso_local ptr @rv_marker_1_retain() {
29; SELDAG-LABEL: rv_marker_1_retain:
30; SELDAG:       ; %bb.0: ; %entry
31; SELDAG-NEXT:    stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
32; SELDAG-NEXT:    .cfi_def_cfa_offset 16
33; SELDAG-NEXT:    .cfi_offset w30, -8
34; SELDAG-NEXT:    .cfi_offset w29, -16
35; SELDAG-NEXT:    bl _foo1
36; SELDAG-NEXT:    mov x29, x29
37; SELDAG-NEXT:    bl _objc_retainAutoreleasedReturnValue
38; SELDAG-NEXT:    ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
39; SELDAG-NEXT:    ret
40;
41; GISEL-LABEL: rv_marker_1_retain:
42; GISEL:       ; %bb.0: ; %entry
43; GISEL-NEXT:    stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
44; GISEL-NEXT:    .cfi_def_cfa_offset 16
45; GISEL-NEXT:    .cfi_offset w30, -8
46; GISEL-NEXT:    .cfi_offset w29, -16
47; GISEL-NEXT:    bl _foo1
48; GISEL-NEXT:    mov x29, x29
49; GISEL-NEXT:    bl _objc_retainAutoreleasedReturnValue
50; GISEL-NEXT:    ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
51; GISEL-NEXT:    ret
52entry:
53  %call = call ptr @foo1() [ "clang.arc.attachedcall"(ptr @objc_retainAutoreleasedReturnValue) ]
54  ret ptr %call
55}
56
57define dso_local ptr @rv_marker_1_unsafeClaim() {
58; SELDAG-LABEL: rv_marker_1_unsafeClaim:
59; SELDAG:       ; %bb.0: ; %entry
60; SELDAG-NEXT:    stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
61; SELDAG-NEXT:    .cfi_def_cfa_offset 16
62; SELDAG-NEXT:    .cfi_offset w30, -8
63; SELDAG-NEXT:    .cfi_offset w29, -16
64; SELDAG-NEXT:    bl _foo1
65; SELDAG-NEXT:    mov x29, x29
66; SELDAG-NEXT:    bl _objc_unsafeClaimAutoreleasedReturnValue
67; SELDAG-NEXT:    ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
68; SELDAG-NEXT:    ret
69;
70; GISEL-LABEL: rv_marker_1_unsafeClaim:
71; GISEL:       ; %bb.0: ; %entry
72; GISEL-NEXT:    stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
73; GISEL-NEXT:    .cfi_def_cfa_offset 16
74; GISEL-NEXT:    .cfi_offset w30, -8
75; GISEL-NEXT:    .cfi_offset w29, -16
76; GISEL-NEXT:    bl _foo1
77; GISEL-NEXT:    mov x29, x29
78; GISEL-NEXT:    bl _objc_unsafeClaimAutoreleasedReturnValue
79; GISEL-NEXT:    ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
80; GISEL-NEXT:    ret
81entry:
82  %call = call ptr @foo1() [ "clang.arc.attachedcall"(ptr @objc_unsafeClaimAutoreleasedReturnValue) ]
83  ret ptr %call
84}
85
86define dso_local void @rv_marker_2_select(i32 %c) {
87; SELDAG-LABEL: rv_marker_2_select:
88; SELDAG:       ; %bb.0: ; %entry
89; SELDAG-NEXT:    stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
90; SELDAG-NEXT:    .cfi_def_cfa_offset 16
91; SELDAG-NEXT:    .cfi_offset w30, -8
92; SELDAG-NEXT:    .cfi_offset w29, -16
93; SELDAG-NEXT:    mov w8, #1 ; =0x1
94; SELDAG-NEXT:    cmp w0, #0
95; SELDAG-NEXT:    cinc w0, w8, eq
96; SELDAG-NEXT:    bl _foo0
97; SELDAG-NEXT:    mov x29, x29
98; SELDAG-NEXT:    bl _objc_retainAutoreleasedReturnValue
99; SELDAG-NEXT:    ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
100; SELDAG-NEXT:    b _foo2
101;
102; GISEL-LABEL: rv_marker_2_select:
103; GISEL:       ; %bb.0: ; %entry
104; GISEL-NEXT:    stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
105; GISEL-NEXT:    .cfi_def_cfa_offset 16
106; GISEL-NEXT:    .cfi_offset w30, -8
107; GISEL-NEXT:    .cfi_offset w29, -16
108; GISEL-NEXT:    mov w8, #1 ; =0x1
109; GISEL-NEXT:    cmp w0, #0
110; GISEL-NEXT:    cinc w0, w8, eq
111; GISEL-NEXT:    bl _foo0
112; GISEL-NEXT:    mov x29, x29
113; GISEL-NEXT:    bl _objc_retainAutoreleasedReturnValue
114; GISEL-NEXT:    ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
115; GISEL-NEXT:    b _foo2
116entry:
117  %tobool.not = icmp eq i32 %c, 0
118  %.sink = select i1 %tobool.not, i32 2, i32 1
119  %call1 = call ptr @foo0(i32 %.sink) [ "clang.arc.attachedcall"(ptr @objc_retainAutoreleasedReturnValue) ]
120  tail call void @foo2(ptr %call1)
121  ret void
122}
123
124define dso_local void @rv_marker_3() personality ptr @__gxx_personality_v0 {
125; SELDAG-LABEL: rv_marker_3:
126; SELDAG:       Lfunc_begin0:
127; SELDAG-NEXT:    .cfi_startproc
128; SELDAG-NEXT:    .cfi_personality 155, ___gxx_personality_v0
129; SELDAG-NEXT:    .cfi_lsda 16, Lexception0
130; SELDAG-NEXT:  ; %bb.0: ; %entry
131; SELDAG-NEXT:    stp x20, x19, [sp, #-32]! ; 16-byte Folded Spill
132; SELDAG-NEXT:    stp x29, x30, [sp, #16] ; 16-byte Folded Spill
133; SELDAG-NEXT:    .cfi_def_cfa_offset 32
134; SELDAG-NEXT:    .cfi_offset w30, -8
135; SELDAG-NEXT:    .cfi_offset w29, -16
136; SELDAG-NEXT:    .cfi_offset w19, -24
137; SELDAG-NEXT:    .cfi_offset w20, -32
138; SELDAG-NEXT:    bl _foo1
139; SELDAG-NEXT:    mov x29, x29
140; SELDAG-NEXT:    bl _objc_retainAutoreleasedReturnValue
141; SELDAG-NEXT:    mov x19, x0
142; SELDAG-NEXT:  Ltmp0:
143; SELDAG-NEXT:    bl _objc_object
144; SELDAG-NEXT:  Ltmp1:
145; SELDAG-NEXT:  ; %bb.1: ; %invoke.cont
146; SELDAG-NEXT:    ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
147; SELDAG-NEXT:    mov x0, x19
148; SELDAG-NEXT:    ldp x20, x19, [sp], #32 ; 16-byte Folded Reload
149; SELDAG-NEXT:    b _objc_release
150; SELDAG-NEXT:  LBB3_2: ; %lpad
151; SELDAG-NEXT:  Ltmp2:
152; SELDAG-NEXT:    mov x20, x0
153; SELDAG-NEXT:    mov x0, x19
154; SELDAG-NEXT:    bl _objc_release
155; SELDAG-NEXT:    mov x0, x20
156; SELDAG-NEXT:    bl __Unwind_Resume
157; SELDAG-NEXT:  Lfunc_end0:
158; SELDAG-NEXT:    .cfi_endproc
159; SELDAG-NEXT:    .section __TEXT,__gcc_except_tab
160; SELDAG-NEXT:    .p2align 2, 0x0
161; SELDAG-NEXT:  GCC_except_table3:
162; SELDAG-NEXT:  Lexception0:
163; SELDAG-NEXT:    .byte 255 ; @LPStart Encoding = omit
164; SELDAG-NEXT:    .byte 255 ; @TType Encoding = omit
165; SELDAG-NEXT:    .byte 1 ; Call site Encoding = uleb128
166; SELDAG-NEXT:    .uleb128 Lcst_end0-Lcst_begin0
167; SELDAG-NEXT:  Lcst_begin0:
168; SELDAG-NEXT:    .uleb128 Lfunc_begin0-Lfunc_begin0 ; >> Call Site 1 <<
169; SELDAG-NEXT:    .uleb128 Ltmp0-Lfunc_begin0 ; Call between Lfunc_begin0 and Ltmp0
170; SELDAG-NEXT:    .byte 0 ; has no landing pad
171; SELDAG-NEXT:    .byte 0 ; On action: cleanup
172; SELDAG-NEXT:    .uleb128 Ltmp0-Lfunc_begin0 ; >> Call Site 2 <<
173; SELDAG-NEXT:    .uleb128 Ltmp1-Ltmp0 ; Call between Ltmp0 and Ltmp1
174; SELDAG-NEXT:    .uleb128 Ltmp2-Lfunc_begin0 ; jumps to Ltmp2
175; SELDAG-NEXT:    .byte 0 ; On action: cleanup
176; SELDAG-NEXT:    .uleb128 Ltmp1-Lfunc_begin0 ; >> Call Site 3 <<
177; SELDAG-NEXT:    .uleb128 Lfunc_end0-Ltmp1 ; Call between Ltmp1 and Lfunc_end0
178; SELDAG-NEXT:    .byte 0 ; has no landing pad
179; SELDAG-NEXT:    .byte 0 ; On action: cleanup
180; SELDAG-NEXT:  Lcst_end0:
181; SELDAG-NEXT:    .p2align 2, 0x0
182;
183; GISEL-LABEL: rv_marker_3:
184; GISEL:       Lfunc_begin0:
185; GISEL-NEXT:    .cfi_startproc
186; GISEL-NEXT:    .cfi_personality 155, ___gxx_personality_v0
187; GISEL-NEXT:    .cfi_lsda 16, Lexception0
188; GISEL-NEXT:  ; %bb.0: ; %entry
189; GISEL-NEXT:    stp x20, x19, [sp, #-32]! ; 16-byte Folded Spill
190; GISEL-NEXT:    stp x29, x30, [sp, #16] ; 16-byte Folded Spill
191; GISEL-NEXT:    .cfi_def_cfa_offset 32
192; GISEL-NEXT:    .cfi_offset w30, -8
193; GISEL-NEXT:    .cfi_offset w29, -16
194; GISEL-NEXT:    .cfi_offset w19, -24
195; GISEL-NEXT:    .cfi_offset w20, -32
196; GISEL-NEXT:    bl _foo1
197; GISEL-NEXT:    mov x29, x29
198; GISEL-NEXT:    bl _objc_retainAutoreleasedReturnValue
199; GISEL-NEXT:    mov x19, x0
200; GISEL-NEXT:  Ltmp0:
201; GISEL-NEXT:    bl _objc_object
202; GISEL-NEXT:  Ltmp1:
203; GISEL-NEXT:  ; %bb.1: ; %invoke.cont
204; GISEL-NEXT:  Lloh0:
205; GISEL-NEXT:    adrp x1, _objc_release@GOTPAGE
206; GISEL-NEXT:    mov x0, x19
207; GISEL-NEXT:  Lloh1:
208; GISEL-NEXT:    ldr x1, [x1, _objc_release@GOTPAGEOFF]
209; GISEL-NEXT:    ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
210; GISEL-NEXT:    ldp x20, x19, [sp], #32 ; 16-byte Folded Reload
211; GISEL-NEXT:    br x1
212; GISEL-NEXT:  LBB3_2: ; %lpad
213; GISEL-NEXT:  Ltmp2:
214; GISEL-NEXT:  Lloh2:
215; GISEL-NEXT:    adrp x8, _objc_release@GOTPAGE
216; GISEL-NEXT:    mov x20, x0
217; GISEL-NEXT:    mov x0, x19
218; GISEL-NEXT:  Lloh3:
219; GISEL-NEXT:    ldr x8, [x8, _objc_release@GOTPAGEOFF]
220; GISEL-NEXT:    blr x8
221; GISEL-NEXT:    mov x0, x20
222; GISEL-NEXT:    bl __Unwind_Resume
223; GISEL-NEXT:    .loh AdrpLdrGot Lloh0, Lloh1
224; GISEL-NEXT:    .loh AdrpLdrGot Lloh2, Lloh3
225; GISEL-NEXT:  Lfunc_end0:
226; GISEL-NEXT:    .cfi_endproc
227; GISEL-NEXT:    .section __TEXT,__gcc_except_tab
228; GISEL-NEXT:    .p2align 2, 0x0
229; GISEL-NEXT:  GCC_except_table3:
230; GISEL-NEXT:  Lexception0:
231; GISEL-NEXT:    .byte 255 ; @LPStart Encoding = omit
232; GISEL-NEXT:    .byte 255 ; @TType Encoding = omit
233; GISEL-NEXT:    .byte 1 ; Call site Encoding = uleb128
234; GISEL-NEXT:    .uleb128 Lcst_end0-Lcst_begin0
235; GISEL-NEXT:  Lcst_begin0:
236; GISEL-NEXT:    .uleb128 Lfunc_begin0-Lfunc_begin0 ; >> Call Site 1 <<
237; GISEL-NEXT:    .uleb128 Ltmp0-Lfunc_begin0 ; Call between Lfunc_begin0 and Ltmp0
238; GISEL-NEXT:    .byte 0 ; has no landing pad
239; GISEL-NEXT:    .byte 0 ; On action: cleanup
240; GISEL-NEXT:    .uleb128 Ltmp0-Lfunc_begin0 ; >> Call Site 2 <<
241; GISEL-NEXT:    .uleb128 Ltmp1-Ltmp0 ; Call between Ltmp0 and Ltmp1
242; GISEL-NEXT:    .uleb128 Ltmp2-Lfunc_begin0 ; jumps to Ltmp2
243; GISEL-NEXT:    .byte 0 ; On action: cleanup
244; GISEL-NEXT:    .uleb128 Ltmp1-Lfunc_begin0 ; >> Call Site 3 <<
245; GISEL-NEXT:    .uleb128 Lfunc_end0-Ltmp1 ; Call between Ltmp1 and Lfunc_end0
246; GISEL-NEXT:    .byte 0 ; has no landing pad
247; GISEL-NEXT:    .byte 0 ; On action: cleanup
248; GISEL-NEXT:  Lcst_end0:
249; GISEL-NEXT:    .p2align 2, 0x0
250entry:
251  %call = call ptr @foo1() [ "clang.arc.attachedcall"(ptr @objc_retainAutoreleasedReturnValue) ]
252  invoke void @objc_object(ptr %call) #5
253          to label %invoke.cont unwind label %lpad
254
255invoke.cont:                                      ; preds = %entry
256  tail call void @llvm.objc.release(ptr %call)
257  ret void
258
259lpad:                                             ; preds = %entry
260  %0 = landingpad { ptr, i32 }
261          cleanup
262  tail call void @llvm.objc.release(ptr %call)
263  resume { ptr, i32 } %0
264}
265
266define dso_local void @rv_marker_4() personality ptr @__gxx_personality_v0 {
267; SELDAG-LABEL: rv_marker_4:
268; SELDAG:       Lfunc_begin1:
269; SELDAG-NEXT:    .cfi_startproc
270; SELDAG-NEXT:    .cfi_personality 155, ___gxx_personality_v0
271; SELDAG-NEXT:    .cfi_lsda 16, Lexception1
272; SELDAG-NEXT:  ; %bb.0: ; %entry
273; SELDAG-NEXT:    sub sp, sp, #48
274; SELDAG-NEXT:    stp x20, x19, [sp, #16] ; 16-byte Folded Spill
275; SELDAG-NEXT:    stp x29, x30, [sp, #32] ; 16-byte Folded Spill
276; SELDAG-NEXT:    .cfi_def_cfa_offset 48
277; SELDAG-NEXT:    .cfi_offset w30, -8
278; SELDAG-NEXT:    .cfi_offset w29, -16
279; SELDAG-NEXT:    .cfi_offset w19, -24
280; SELDAG-NEXT:    .cfi_offset w20, -32
281; SELDAG-NEXT:  Ltmp3:
282; SELDAG-NEXT:    bl _foo1
283; SELDAG-NEXT:    mov x29, x29
284; SELDAG-NEXT:    bl _objc_retainAutoreleasedReturnValue
285; SELDAG-NEXT:  Ltmp4:
286; SELDAG-NEXT:  ; %bb.1: ; %invoke.cont
287; SELDAG-NEXT:  Ltmp6:
288; SELDAG-NEXT:    mov x19, x0
289; SELDAG-NEXT:    bl _objc_object
290; SELDAG-NEXT:  Ltmp7:
291; SELDAG-NEXT:  ; %bb.2: ; %invoke.cont2
292; SELDAG-NEXT:    mov x0, x19
293; SELDAG-NEXT:    bl _objc_release
294; SELDAG-NEXT:    add x0, sp, #15
295; SELDAG-NEXT:    bl __ZN1SD1Ev
296; SELDAG-NEXT:    ldp x29, x30, [sp, #32] ; 16-byte Folded Reload
297; SELDAG-NEXT:    ldp x20, x19, [sp, #16] ; 16-byte Folded Reload
298; SELDAG-NEXT:    add sp, sp, #48
299; SELDAG-NEXT:    ret
300; SELDAG-NEXT:  LBB4_3: ; %lpad1
301; SELDAG-NEXT:  Ltmp8:
302; SELDAG-NEXT:    mov x20, x0
303; SELDAG-NEXT:    mov x0, x19
304; SELDAG-NEXT:    bl _objc_release
305; SELDAG-NEXT:    b LBB4_5
306; SELDAG-NEXT:  LBB4_4: ; %lpad
307; SELDAG-NEXT:  Ltmp5:
308; SELDAG-NEXT:    mov x20, x0
309; SELDAG-NEXT:  LBB4_5: ; %ehcleanup
310; SELDAG-NEXT:    add x0, sp, #15
311; SELDAG-NEXT:    bl __ZN1SD1Ev
312; SELDAG-NEXT:    mov x0, x20
313; SELDAG-NEXT:    bl __Unwind_Resume
314; SELDAG-NEXT:  Lfunc_end1:
315; SELDAG-NEXT:    .cfi_endproc
316; SELDAG-NEXT:    .section __TEXT,__gcc_except_tab
317; SELDAG-NEXT:    .p2align 2, 0x0
318; SELDAG-NEXT:  GCC_except_table4:
319; SELDAG-NEXT:  Lexception1:
320; SELDAG-NEXT:    .byte 255 ; @LPStart Encoding = omit
321; SELDAG-NEXT:    .byte 255 ; @TType Encoding = omit
322; SELDAG-NEXT:    .byte 1 ; Call site Encoding = uleb128
323; SELDAG-NEXT:    .uleb128 Lcst_end1-Lcst_begin1
324; SELDAG-NEXT:  Lcst_begin1:
325; SELDAG-NEXT:    .uleb128 Ltmp3-Lfunc_begin1 ; >> Call Site 1 <<
326; SELDAG-NEXT:    .uleb128 Ltmp4-Ltmp3 ; Call between Ltmp3 and Ltmp4
327; SELDAG-NEXT:    .uleb128 Ltmp5-Lfunc_begin1 ; jumps to Ltmp5
328; SELDAG-NEXT:    .byte 0 ; On action: cleanup
329; SELDAG-NEXT:    .uleb128 Ltmp6-Lfunc_begin1 ; >> Call Site 2 <<
330; SELDAG-NEXT:    .uleb128 Ltmp7-Ltmp6 ; Call between Ltmp6 and Ltmp7
331; SELDAG-NEXT:    .uleb128 Ltmp8-Lfunc_begin1 ; jumps to Ltmp8
332; SELDAG-NEXT:    .byte 0 ; On action: cleanup
333; SELDAG-NEXT:    .uleb128 Ltmp7-Lfunc_begin1 ; >> Call Site 3 <<
334; SELDAG-NEXT:    .uleb128 Lfunc_end1-Ltmp7 ; Call between Ltmp7 and Lfunc_end1
335; SELDAG-NEXT:    .byte 0 ; has no landing pad
336; SELDAG-NEXT:    .byte 0 ; On action: cleanup
337; SELDAG-NEXT:  Lcst_end1:
338; SELDAG-NEXT:    .p2align 2, 0x0
339;
340; GISEL-LABEL: rv_marker_4:
341; GISEL:       Lfunc_begin1:
342; GISEL-NEXT:    .cfi_startproc
343; GISEL-NEXT:    .cfi_personality 155, ___gxx_personality_v0
344; GISEL-NEXT:    .cfi_lsda 16, Lexception1
345; GISEL-NEXT:  ; %bb.0: ; %entry
346; GISEL-NEXT:    sub sp, sp, #48
347; GISEL-NEXT:    stp x20, x19, [sp, #16] ; 16-byte Folded Spill
348; GISEL-NEXT:    stp x29, x30, [sp, #32] ; 16-byte Folded Spill
349; GISEL-NEXT:    .cfi_def_cfa_offset 48
350; GISEL-NEXT:    .cfi_offset w30, -8
351; GISEL-NEXT:    .cfi_offset w29, -16
352; GISEL-NEXT:    .cfi_offset w19, -24
353; GISEL-NEXT:    .cfi_offset w20, -32
354; GISEL-NEXT:  Ltmp3:
355; GISEL-NEXT:    bl _foo1
356; GISEL-NEXT:    mov x29, x29
357; GISEL-NEXT:    bl _objc_retainAutoreleasedReturnValue
358; GISEL-NEXT:  Ltmp4:
359; GISEL-NEXT:  ; %bb.1: ; %invoke.cont
360; GISEL-NEXT:  Ltmp6:
361; GISEL-NEXT:    mov x19, x0
362; GISEL-NEXT:    bl _objc_object
363; GISEL-NEXT:  Ltmp7:
364; GISEL-NEXT:  ; %bb.2: ; %invoke.cont2
365; GISEL-NEXT:  Lloh4:
366; GISEL-NEXT:    adrp x8, _objc_release@GOTPAGE
367; GISEL-NEXT:    mov x0, x19
368; GISEL-NEXT:  Lloh5:
369; GISEL-NEXT:    ldr x8, [x8, _objc_release@GOTPAGEOFF]
370; GISEL-NEXT:    blr x8
371; GISEL-NEXT:    add x0, sp, #15
372; GISEL-NEXT:    bl __ZN1SD1Ev
373; GISEL-NEXT:    ldp x29, x30, [sp, #32] ; 16-byte Folded Reload
374; GISEL-NEXT:    ldp x20, x19, [sp, #16] ; 16-byte Folded Reload
375; GISEL-NEXT:    add sp, sp, #48
376; GISEL-NEXT:    ret
377; GISEL-NEXT:  LBB4_3: ; %lpad1
378; GISEL-NEXT:  Ltmp8:
379; GISEL-NEXT:  Lloh6:
380; GISEL-NEXT:    adrp x8, _objc_release@GOTPAGE
381; GISEL-NEXT:    mov x20, x0
382; GISEL-NEXT:    mov x0, x19
383; GISEL-NEXT:  Lloh7:
384; GISEL-NEXT:    ldr x8, [x8, _objc_release@GOTPAGEOFF]
385; GISEL-NEXT:    blr x8
386; GISEL-NEXT:    b LBB4_5
387; GISEL-NEXT:  LBB4_4: ; %lpad
388; GISEL-NEXT:  Ltmp5:
389; GISEL-NEXT:    mov x20, x0
390; GISEL-NEXT:  LBB4_5: ; %ehcleanup
391; GISEL-NEXT:    add x0, sp, #15
392; GISEL-NEXT:    bl __ZN1SD1Ev
393; GISEL-NEXT:    mov x0, x20
394; GISEL-NEXT:    bl __Unwind_Resume
395; GISEL-NEXT:    .loh AdrpLdrGot Lloh4, Lloh5
396; GISEL-NEXT:    .loh AdrpLdrGot Lloh6, Lloh7
397; GISEL-NEXT:  Lfunc_end1:
398; GISEL-NEXT:    .cfi_endproc
399; GISEL-NEXT:    .section __TEXT,__gcc_except_tab
400; GISEL-NEXT:    .p2align 2, 0x0
401; GISEL-NEXT:  GCC_except_table4:
402; GISEL-NEXT:  Lexception1:
403; GISEL-NEXT:    .byte 255 ; @LPStart Encoding = omit
404; GISEL-NEXT:    .byte 255 ; @TType Encoding = omit
405; GISEL-NEXT:    .byte 1 ; Call site Encoding = uleb128
406; GISEL-NEXT:    .uleb128 Lcst_end1-Lcst_begin1
407; GISEL-NEXT:  Lcst_begin1:
408; GISEL-NEXT:    .uleb128 Ltmp3-Lfunc_begin1 ; >> Call Site 1 <<
409; GISEL-NEXT:    .uleb128 Ltmp4-Ltmp3 ; Call between Ltmp3 and Ltmp4
410; GISEL-NEXT:    .uleb128 Ltmp5-Lfunc_begin1 ; jumps to Ltmp5
411; GISEL-NEXT:    .byte 0 ; On action: cleanup
412; GISEL-NEXT:    .uleb128 Ltmp6-Lfunc_begin1 ; >> Call Site 2 <<
413; GISEL-NEXT:    .uleb128 Ltmp7-Ltmp6 ; Call between Ltmp6 and Ltmp7
414; GISEL-NEXT:    .uleb128 Ltmp8-Lfunc_begin1 ; jumps to Ltmp8
415; GISEL-NEXT:    .byte 0 ; On action: cleanup
416; GISEL-NEXT:    .uleb128 Ltmp7-Lfunc_begin1 ; >> Call Site 3 <<
417; GISEL-NEXT:    .uleb128 Lfunc_end1-Ltmp7 ; Call between Ltmp7 and Lfunc_end1
418; GISEL-NEXT:    .byte 0 ; has no landing pad
419; GISEL-NEXT:    .byte 0 ; On action: cleanup
420; GISEL-NEXT:  Lcst_end1:
421; GISEL-NEXT:    .p2align 2, 0x0
422entry:
423  %s = alloca %struct.S, align 1
424  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %s) #2
425  %call = invoke ptr @foo1() [ "clang.arc.attachedcall"(ptr @objc_retainAutoreleasedReturnValue) ]
426          to label %invoke.cont unwind label %lpad
427
428invoke.cont:                                      ; preds = %entry
429  invoke void @objc_object(ptr %call) #5
430          to label %invoke.cont2 unwind label %lpad1
431
432invoke.cont2:                                     ; preds = %invoke.cont
433  tail call void @llvm.objc.release(ptr %call)
434  %call3 = call ptr @_ZN1SD1Ev(ptr nonnull dereferenceable(1) %s)
435  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %s)
436  ret void
437
438lpad:                                             ; preds = %entry
439  %0 = landingpad { ptr, i32 }
440          cleanup
441  br label %ehcleanup
442
443lpad1:                                            ; preds = %invoke.cont
444  %1 = landingpad { ptr, i32 }
445          cleanup
446  tail call void @llvm.objc.release(ptr %call)
447  br label %ehcleanup
448
449ehcleanup:                                        ; preds = %lpad1, %lpad
450  %.pn = phi { ptr, i32 } [ %1, %lpad1 ], [ %0, %lpad ]
451  %call4 = call ptr @_ZN1SD1Ev(ptr nonnull dereferenceable(1) %s)
452  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %s)
453  resume { ptr, i32 } %.pn
454}
455
456define dso_local ptr @rv_marker_5_indirect_call() {
457; SELDAG-LABEL: rv_marker_5_indirect_call:
458; SELDAG:       ; %bb.0: ; %entry
459; SELDAG-NEXT:    stp x20, x19, [sp, #-32]! ; 16-byte Folded Spill
460; SELDAG-NEXT:    stp x29, x30, [sp, #16] ; 16-byte Folded Spill
461; SELDAG-NEXT:    .cfi_def_cfa_offset 32
462; SELDAG-NEXT:    .cfi_offset w30, -8
463; SELDAG-NEXT:    .cfi_offset w29, -16
464; SELDAG-NEXT:    .cfi_offset w19, -24
465; SELDAG-NEXT:    .cfi_offset w20, -32
466; SELDAG-NEXT:  Lloh0:
467; SELDAG-NEXT:    adrp x8, _fptr@PAGE
468; SELDAG-NEXT:  Lloh1:
469; SELDAG-NEXT:    ldr x8, [x8, _fptr@PAGEOFF]
470; SELDAG-NEXT:    blr x8
471; SELDAG-NEXT:    mov x29, x29
472; SELDAG-NEXT:    bl _objc_retainAutoreleasedReturnValue
473; SELDAG-NEXT:    mov x19, x0
474; SELDAG-NEXT:    bl _foo2
475; SELDAG-NEXT:    ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
476; SELDAG-NEXT:    mov x0, x19
477; SELDAG-NEXT:    ldp x20, x19, [sp], #32 ; 16-byte Folded Reload
478; SELDAG-NEXT:    ret
479; SELDAG-NEXT:    .loh AdrpLdr Lloh0, Lloh1
480;
481; GISEL-LABEL: rv_marker_5_indirect_call:
482; GISEL:       ; %bb.0: ; %entry
483; GISEL-NEXT:    stp x20, x19, [sp, #-32]! ; 16-byte Folded Spill
484; GISEL-NEXT:    stp x29, x30, [sp, #16] ; 16-byte Folded Spill
485; GISEL-NEXT:    .cfi_def_cfa_offset 32
486; GISEL-NEXT:    .cfi_offset w30, -8
487; GISEL-NEXT:    .cfi_offset w29, -16
488; GISEL-NEXT:    .cfi_offset w19, -24
489; GISEL-NEXT:    .cfi_offset w20, -32
490; GISEL-NEXT:  Lloh8:
491; GISEL-NEXT:    adrp x8, _fptr@PAGE
492; GISEL-NEXT:  Lloh9:
493; GISEL-NEXT:    ldr x8, [x8, _fptr@PAGEOFF]
494; GISEL-NEXT:    blr x8
495; GISEL-NEXT:    mov x29, x29
496; GISEL-NEXT:    bl _objc_retainAutoreleasedReturnValue
497; GISEL-NEXT:    mov x19, x0
498; GISEL-NEXT:    bl _foo2
499; GISEL-NEXT:    ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
500; GISEL-NEXT:    mov x0, x19
501; GISEL-NEXT:    ldp x20, x19, [sp], #32 ; 16-byte Folded Reload
502; GISEL-NEXT:    ret
503; GISEL-NEXT:    .loh AdrpLdr Lloh8, Lloh9
504entry:
505  %0 = load ptr, ptr @fptr, align 8
506  %call = call ptr %0() [ "clang.arc.attachedcall"(ptr @objc_retainAutoreleasedReturnValue) ]
507  tail call void @foo2(ptr %call)
508  ret ptr %call
509}
510
511declare ptr @foo(i64, i64, i64)
512
513define dso_local void @rv_marker_multiarg(i64 %a, i64 %b, i64 %c) {
514; SELDAG-LABEL: rv_marker_multiarg:
515; SELDAG:       ; %bb.0:
516; SELDAG-NEXT:    stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
517; SELDAG-NEXT:    .cfi_def_cfa_offset 16
518; SELDAG-NEXT:    .cfi_offset w30, -8
519; SELDAG-NEXT:    .cfi_offset w29, -16
520; SELDAG-NEXT:    mov x8, x0
521; SELDAG-NEXT:    mov x0, x2
522; SELDAG-NEXT:    mov x2, x8
523; SELDAG-NEXT:    bl _foo
524; SELDAG-NEXT:    mov x29, x29
525; SELDAG-NEXT:    bl _objc_retainAutoreleasedReturnValue
526; SELDAG-NEXT:    ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
527; SELDAG-NEXT:    ret
528;
529; GISEL-LABEL: rv_marker_multiarg:
530; GISEL:       ; %bb.0:
531; GISEL-NEXT:    stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
532; GISEL-NEXT:    .cfi_def_cfa_offset 16
533; GISEL-NEXT:    .cfi_offset w30, -8
534; GISEL-NEXT:    .cfi_offset w29, -16
535; GISEL-NEXT:    mov x3, x0
536; GISEL-NEXT:    mov x0, x2
537; GISEL-NEXT:    mov x2, x3
538; GISEL-NEXT:    bl _foo
539; GISEL-NEXT:    mov x29, x29
540; GISEL-NEXT:    bl _objc_retainAutoreleasedReturnValue
541; GISEL-NEXT:    ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
542; GISEL-NEXT:    ret
543  call ptr @foo(i64 %c, i64 %b, i64 %a) [ "clang.arc.attachedcall"(ptr @objc_retainAutoreleasedReturnValue) ]
544  ret void
545}
546
547declare ptr @objc_retainAutoreleasedReturnValue(ptr)
548declare ptr @objc_unsafeClaimAutoreleasedReturnValue(ptr)
549declare i32 @__gxx_personality_v0(...)
550;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
551; CHECK: {{.*}}
552