mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
AArch64: disallow x30 & x29 as the destination for indirect tail calls
As Ana Pazos pointed out, these have to be restored to their incoming values before a function returns; i.e. before the tail call. So they can't be used correctly as the destination register. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210525 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user