OSDN Git Service

[AArch64] Fix unwind info generated by outliner.
authorEli Friedman <efriedma@quicinc.com>
Tue, 19 May 2020 20:24:53 +0000 (13:24 -0700)
committerEli Friedman <efriedma@quicinc.com>
Wed, 20 May 2020 23:39:00 +0000 (16:39 -0700)
The offsets were wrong. The result is now the same as what the compiler
would generate for a function that spills lr normally.

Differential Revision: https://reviews.llvm.org/D80238

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

index 83acf0d..094dec6 100644 (file)
@@ -6487,7 +6487,7 @@ void AArch64InstrInfo::buildOutlinedFrame(
 
     // 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);
@@ -6495,7 +6495,7 @@ void AArch64InstrInfo::buildOutlinedFrame(
     // 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);
index 6a33bda..8abd56f 100644 (file)
@@ -58,8 +58,8 @@ body:             |
 # 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