Skip to content

Commit 718a1c9

Browse files
committed
[X86] Add test where block placement separates call from RV marker.
The test shows how block placement can separate a call from the marker instruction and the ObjC call after CALL_RVMARKER expansion.
1 parent 0395e01 commit 718a1c9

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

llvm/test/CodeGen/X86/call-rv-marker.ll

+39
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,42 @@ declare i8* @foo_nonlazybind() nonlazybind
219219
declare i8* @objc_retainAutoreleasedReturnValue(i8*)
220220
declare i8* @objc_unsafeClaimAutoreleasedReturnValue(i8*)
221221
declare i32 @__gxx_personality_v0(...)
222+
223+
declare i8* @fn1()
224+
declare i8* @fn2()
225+
226+
define i8* @rv_marker_block_placement(i1 %c.0) {
227+
; CHECK-LABEL: _rv_marker_block_placement:
228+
; CHECK: pushq %rax
229+
; CHECK-NEXT: .cfi_def_cfa_offset 16
230+
; CHECK-NEXT: testb $1, %dil
231+
; CHECK-NEXT: je LBB8_2
232+
233+
; CHECK-NEXT: ## %bb.1:
234+
; CHECK-NEXT: callq _fn1
235+
; CHECK-NEXT: jmp LBB8_3
236+
237+
; CHECK-NEXT: LBB8_2:
238+
; CHECK-NEXT: callq _fn2
239+
240+
; CHECK-NEXT: LBB8_3:
241+
; CHECK-NEXT: movq %rax, %rdi
242+
; CHECK-NEXT: callq _objc_retainAutoreleasedReturnValue
243+
; CHECK-NEXT: xorl %eax, %eax
244+
; CHECK-NEXT: popq %rcx
245+
; CHECK-NEXT: retq
246+
;
247+
entry:
248+
br i1 %c.0, label %then, label %else
249+
250+
then:
251+
%call.0 = notail call i8* @fn1() [ "clang.arc.attachedcall"(i8* (i8*)* @objc_retainAutoreleasedReturnValue) ]
252+
br label %exit
253+
254+
else:
255+
%call.1 = notail call i8* @fn2() [ "clang.arc.attachedcall"(i8* (i8*)* @objc_retainAutoreleasedReturnValue) ]
256+
br label %exit
257+
258+
exit:
259+
ret i8* null
260+
}

0 commit comments

Comments
 (0)