[PATCH] D105027: AArch64: allocate 4-byte slot for arm64_32 pointers during tail call.

Tim Northover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 28 06:56:01 PDT 2021


t.p.northover created this revision.
Herald added subscribers: danielkiss, hiraditya, kristof.beyls, mcrosier.
t.p.northover requested review of this revision.
Herald added a project: LLVM.

Currently we use the `i64` type for pointers on arm64_32 which ends up with overlapping objects and eventually causes an assertion failure in PrologEpilogInserter.

This uses the LocVT instead for arm64_32 pointers (the only type in AArch64CallingConvention.td that actually selects `Trunc` as an option).


https://reviews.llvm.org/D105027

Files:
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/test/CodeGen/AArch64/swifttail-arm64_32.ll


Index: llvm/test/CodeGen/AArch64/swifttail-arm64_32.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/swifttail-arm64_32.ll
@@ -0,0 +1,10 @@
+; RUN: llc -mtriple=arm64_32-apple-watchos %s -o - | FileCheck %s
+
+declare swifttailcc void @pointer_align_callee([8 x i64], i32, i32, i32, i8*)
+define swifttailcc void @pointer_align_caller(i8* swiftasync %as, i8* %in) "frame-pointer"="all" {
+; CHECK-LABEL: pointer_align_caller:
+; CHECK: b _pointer_align_callee
+  alloca i32
+  musttail call swifttailcc void @pointer_align_callee([8 x i64] undef, i32 0, i32 1, i32 2, i8* %in)
+  ret void
+}
Index: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -5854,7 +5854,8 @@
       // common case. It should also work for fundamental types too.
       uint32_t BEAlign = 0;
       unsigned OpSize;
-      if (VA.getLocInfo() == CCValAssign::Indirect)
+      if (VA.getLocInfo() == CCValAssign::Indirect ||
+          VA.getLocInfo() == CCValAssign::Trunc)
         OpSize = VA.getLocVT().getFixedSizeInBits();
       else
         OpSize = Flags.isByVal() ? Flags.getByValSize() * 8


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105027.354883.patch
Type: text/x-patch
Size: 1315 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210628/503eae4c/attachment.bin>


More information about the llvm-commits mailing list