33 lines · plain
1; RUN: llc -verify-machineinstrs -mtriple=arm64-apple-ios7.0 -o - %s | FileCheck %s2@var = global ptr zeroinitializer3 4declare void @bar()5 6define void @foo() {7; CHECK-LABEL: foo:8 %func = load ptr, ptr @var9 10 ; Calling a function encourages @foo to use a callee-saved register,11 ; which makes it a natural choice for the tail call itself. But we don't12 ; want that: the final "br xN" has to use a temporary or argument13 ; register.14 call void @bar()15 16 tail call void %func()17; CHECK: br {{x([0-79]|1[0-8])}}18 ret void19}20 21; No matter how tempting it is, LLVM should not use x30 since that'll be22; restored to its incoming value before the "br".23define void @test_x30_tail() {24; CHECK-LABEL: test_x30_tail:25; CHECK: mov [[DEST:x[0-9]+]], x3026; CHECK: br [[DEST]]27 %addr = call ptr @llvm.returnaddress(i32 0)28 tail call void %addr()29 ret void30}31 32declare ptr @llvm.returnaddress(i32)33