X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=test%2FCodeGen%2FAArch64%2Fregress-tail-livereg.ll;h=965aa0d062d5e9801eea01785e1bfae57b38367d;hb=30e21e7109a6467f2c5e60521c5ec849f6aededb;hp=32167752cb330374acff80de5a6f8943a879da84;hpb=b4dc0233c9f70e8cf946822811f233bb613a02e9;p=oota-llvm.git diff --git a/test/CodeGen/AArch64/regress-tail-livereg.ll b/test/CodeGen/AArch64/regress-tail-livereg.ll index 32167752cb3..965aa0d062d 100644 --- a/test/CodeGen/AArch64/regress-tail-livereg.ll +++ b/test/CodeGen/AArch64/regress-tail-livereg.ll @@ -1,11 +1,11 @@ -; RUN: llc -verify-machineinstrs -mtriple=aarch64-none-linux-gnu < %s | FileCheck %s +; RUN: llc -verify-machineinstrs -mtriple=arm64-apple-ios7.0 -o - %s | FileCheck %s @var = global void()* zeroinitializer declare void @bar() define void @foo() { -; CHECK: foo: - %func = load void()** @var +; CHECK-LABEL: foo: + %func = load void()*, void()** @var ; Calling a function encourages @foo to use a callee-saved register, ; which makes it a natural choice for the tail call itself. But we don't @@ -17,3 +17,17 @@ define void @foo() { ; CHECK: br {{x([0-79]|1[0-8])}} ret void } + +; No matter how tempting it is, LLVM should not use x30 since that'll be +; restored to its incoming value before the "br". +define void @test_x30_tail() { +; CHECK-LABEL: test_x30_tail: +; CHECK: mov [[DEST:x[0-9]+]], x30 +; CHECK: br [[DEST]] + %addr = call i8* @llvm.returnaddress(i32 0) + %faddr = bitcast i8* %addr to void()* + tail call void %faddr() + ret void +} + +declare i8* @llvm.returnaddress(i32)