]> granicus.if.org Git - llvm/commitdiff
[SystemZ] Save/restore r6 and r7 if function contains landing pad.
authorMarcin Koscielnicki <koriakin@0x04.net>
Tue, 28 Jun 2016 14:13:11 +0000 (14:13 +0000)
committerMarcin Koscielnicki <koriakin@0x04.net>
Tue, 28 Jun 2016 14:13:11 +0000 (14:13 +0000)
This fixes PR27102.

Differential Revision: http://reviews.llvm.org/D18541

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274017 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/SystemZ/SystemZFrameLowering.cpp
test/DebugInfo/SystemZ/eh_frame_personality.ll

index a1f036d68ec55ab2b70b0d96c8d50eee2d4b009e..ccaed49475caf93b372c762d4d56ba949b32efad 100644 (file)
@@ -81,6 +81,12 @@ void SystemZFrameLowering::determineCalleeSaves(MachineFunction &MF,
     for (unsigned I = MFI->getVarArgsFirstGPR(); I < SystemZ::NumArgGPRs; ++I)
       SavedRegs.set(SystemZ::ArgGPRs[I]);
 
+  // If there are any landing pads, entering them will modify r6/r7.
+  if (!MF.getMMI().getLandingPads().empty()) {
+    SavedRegs.set(SystemZ::R6D);
+    SavedRegs.set(SystemZ::R7D);
+  }
+
   // If the function requires a frame pointer, record that the hard
   // frame pointer will be clobbered.
   if (HasFP)
index f7863a89af0412bfe6d338fded0dc2dff14ae7a4..ba439dcd3d48474e9b4fa39e38f0cdb8264ae3f8 100644 (file)
@@ -20,7 +20,9 @@ clean:
 ; CHECK-FUNC: .cfi_startproc
 ; CHECK-FUNC: .cfi_personality 0, __gxx_personality_v0
 ; CHECK-FUNC: .cfi_lsda 0, .Lexception0
-; CHECK-FUNC: stmg     %r14, %r15, 112(%r15)
+; CHECK-FUNC: stmg     %r6, %r15, 48(%r15)
+; CHECK-FUNC: .cfi_offset %r6, -112
+; CHECK-FUNC: .cfi_offset %r7, -104
 ; CHECK-FUNC: .cfi_offset %r14, -48
 ; CHECK-FUNC: .cfi_offset %r15, -40
 ; CHECK-FUNC: aghi     %r15, -160