[PATCH] D80238: [AArch64] Fix unwind info generated by outliner.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 19 13:44:44 PDT 2020


efriedma created this revision.
efriedma added reviewers: paquette, dmgreen.
Herald added subscribers: danielkiss, hiraditya, kristof.beyls.
Herald added a project: LLVM.

The offsets were wrong.  The result is now the same as what the compiler would generate for a function that spills lr normally.

(Looking over the code, I'm concerned this doesn't work correctly on Windows, since the unwind info there is different, but that's a separate issue, I guess.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80238

Files:
  llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
  llvm/test/CodeGen/AArch64/machine-outliner-calls.mir


Index: llvm/test/CodeGen/AArch64/machine-outliner-calls.mir
===================================================================
--- llvm/test/CodeGen/AArch64/machine-outliner-calls.mir
+++ llvm/test/CodeGen/AArch64/machine-outliner-calls.mir
@@ -57,8 +57,8 @@
 # CHECK: name:            OUTLINED_FUNCTION_0
 # CHECK: bb.0:
 # CHECK: liveins: $x19, $x20, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28, $d15, $d8, $d9, $d10, $d11, $d12, $d13, $d14, $lr
-# CHECK-DAG: frame-setup CFI_INSTRUCTION def_cfa_offset -16
-# CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $w30, 16
+# CHECK-DAG: frame-setup CFI_INSTRUCTION def_cfa_offset 16
+# CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $w30, -16
 # CHECK-NEXT: early-clobber $sp = STRXpre $lr, $sp, -16
 # CHECK-NEXT: BL @baz, implicit-def dead $lr, implicit $sp
 # CHECK-NEXT: $w17 = ORRWri $wzr, 1
Index: llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
+++ llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
@@ -6483,7 +6483,7 @@
 
     // Add a CFI saying the stack was moved 16 B down.
     int64_t StackPosEntry =
-        MF.addFrameInst(MCCFIInstruction::createDefCfaOffset(nullptr, 16));
+        MF.addFrameInst(MCCFIInstruction::createDefCfaOffset(nullptr, -16));
     BuildMI(MBB, It, DebugLoc(), get(AArch64::CFI_INSTRUCTION))
         .addCFIIndex(StackPosEntry)
         .setMIFlags(MachineInstr::FrameSetup);
@@ -6491,7 +6491,7 @@
     // Add a CFI saying that the LR that we want to find is now 16 B higher than
     // before.
     int64_t LRPosEntry =
-        MF.addFrameInst(MCCFIInstruction::createOffset(nullptr, DwarfReg, 16));
+        MF.addFrameInst(MCCFIInstruction::createOffset(nullptr, DwarfReg, -16));
     BuildMI(MBB, It, DebugLoc(), get(AArch64::CFI_INSTRUCTION))
         .addCFIIndex(LRPosEntry)
         .setMIFlags(MachineInstr::FrameSetup);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80238.265016.patch
Type: text/x-patch
Size: 1934 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200519/209df4c1/attachment-0001.bin>


More information about the llvm-commits mailing list