[llvm] 4120a3a - AArch64: take compact unwind frame size from last CFI instruction.

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 11 04:24:56 PDT 2022


Author: Tim Northover
Date: 2022-04-11T12:24:48+01:00
New Revision: 4120a3abdd02b99194ede41797d820d3579d04f6

URL: https://github.com/llvm/llvm-project/commit/4120a3abdd02b99194ede41797d820d3579d04f6
DIFF: https://github.com/llvm/llvm-project/commit/4120a3abdd02b99194ede41797d820d3579d04f6.diff

LOG: AArch64: take compact unwind frame size from last CFI instruction.

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.

Added: 
    llvm/test/CodeGen/AArch64/compact-unwind-async.ll

Modified: 
    llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
    llvm/test/MC/AArch64/arm64-compact-unwind-fallback.s

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
index 85b221286ecd0..04d9b4999d2e2 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
@@ -621,8 +621,6 @@ class DarwinAArch64AsmBackend : public AArch64AsmBackend {
         break;
       }
       case MCCFIInstruction::OpDefCfaOffset: {
-        if (StackSize != 0)
-          return CU::UNWIND_ARM64_MODE_DWARF;
         StackSize = std::abs(Inst.getOffset());
         break;
       }

diff  --git a/llvm/test/CodeGen/AArch64/compact-unwind-async.ll b/llvm/test/CodeGen/AArch64/compact-unwind-async.ll
new file mode 100644
index 0000000000000..f1d09357f7d30
--- /dev/null
+++ b/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
+}

diff  --git a/llvm/test/MC/AArch64/arm64-compact-unwind-fallback.s b/llvm/test/MC/AArch64/arm64-compact-unwind-fallback.s
index 12525b78a274b..d2a078729b75c 100644
--- a/llvm/test/MC/AArch64/arm64-compact-unwind-fallback.s
+++ b/llvm/test/MC/AArch64/arm64-compact-unwind-fallback.s
@@ -5,21 +5,11 @@
 
 // CHECK: Contents of __compact_unwind section:
 // CHECK: compact encoding:     0x03000000
-// CHECK: compact encoding:     0x03000000
 
 // CHECK: .eh_frame contents:
 // CHECK: DW_CFA_def_cfa: reg1 +32
 
-//  DW_CFA_def_cfa_offset: +32
-//  DW_CFA_def_cfa_offset: +64
-
 _cfi_dwarf0:
  .cfi_startproc
  .cfi_def_cfa x1, 32;
  .cfi_endproc
-
-_cfi_dwarf1:
- .cfi_startproc
- .cfi_def_cfa_offset 32
- .cfi_def_cfa_offset 64
- .cfi_endproc


        


More information about the llvm-commits mailing list