Skip to content

Commit 35d1d72

Browse files
TNorthovermemfrob
authored andcommitted
AArch64: use 4-byte slots for arm64_32 pointers in a tail call
1 parent 84b967c commit 35d1d72

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5973,7 +5973,8 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo &CLI,
59735973
// common case. It should also work for fundamental types too.
59745974
uint32_t BEAlign = 0;
59755975
unsigned OpSize;
5976-
if (VA.getLocInfo() == CCValAssign::Indirect)
5976+
if (VA.getLocInfo() == CCValAssign::Indirect ||
5977+
VA.getLocInfo() == CCValAssign::Trunc)
59775978
OpSize = VA.getLocVT().getFixedSizeInBits();
59785979
else
59795980
OpSize = Flags.isByVal() ? Flags.getByValSize() * 8
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
; RUN: llc -mtriple=arm64_32-apple-watchos %s -o - | FileCheck %s
2+
3+
declare swifttailcc void @pointer_align_callee([8 x i64], i32, i32, i32, i8*)
4+
define swifttailcc void @pointer_align_caller(i8* swiftasync %as, i8* %in) "frame-pointer"="all" {
5+
; CHECK-LABEL: pointer_align_caller:
6+
; CHECK: sub sp, sp, #48
7+
; CHECK: mov [[TWO:w[0-9]+]], #2
8+
; CHECK: mov [[ZERO_ONE:x[0-9]+]], #4294967296
9+
; CHECK: stp [[TWO]], w0, [x29, #24]
10+
; CHECK: str [[ZERO_ONE]], [x29, #16]
11+
; CHECK: add sp, sp, #32
12+
; CHECK: b _pointer_align_callee
13+
alloca i32
14+
musttail call swifttailcc void @pointer_align_callee([8 x i64] undef, i32 0, i32 1, i32 2, i8* %in)
15+
ret void
16+
}

0 commit comments

Comments
 (0)