[PATCH] D121116: AArch64: take compact unwind frame size from last CFI instruction.

Tim Northover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 7 07:16:47 PST 2022


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

Asynchronous exception support for the prologue means that there can be multiple .cfi_def_cfa_offset instructions in a single function, which tripped up an assertion in the compact unwind generator.

In reality the compact unwind format is far too restrictive to represent asynchronous frames so if we ever wanted that on Darwin we'd fall back to DWARF (possibly keeping compact unwind around for synchronous users). So the compact format should continue to represent the synchronous situation, and the assertion can be removed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121116

Files:
  llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
  llvm/test/CodeGen/AArch64/compact-unwind-async.ll


Index: llvm/test/CodeGen/AArch64/compact-unwind-async.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/compact-unwind-async.ll
@@ -0,0 +1,11 @@
+; RUN: llc -mtriple=arm64-apple-macosx %s -filetype=obj -o - | llvm-objdump --unwind-info - | FileCheck %s
+
+; CHECK: Contents of __compact_unwind section
+; CHECK: compact encoding: 0x02021010
+
+; 0x02|021|010 => frameless, stack size 0x21 * 16 = 528, x27 & x28 saved
+
+define void @func() {
+  alloca i8, i32 512
+  ret void
+}
Index: llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
===================================================================
--- llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
+++ llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
@@ -621,7 +621,6 @@
         break;
       }
       case MCCFIInstruction::OpDefCfaOffset: {
-        assert(StackSize == 0 && "We already have the CFA offset!");
         StackSize = std::abs(Inst.getOffset());
         break;
       }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121116.413462.patch
Type: text/x-patch
Size: 1041 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220307/9d27c81b/attachment.bin>


More information about the llvm-commits mailing list