Index: lib/CodeGen/MachineRegisterInfo.cpp =================================================================== --- lib/CodeGen/MachineRegisterInfo.cpp +++ lib/CodeGen/MachineRegisterInfo.cpp @@ -13,9 +13,11 @@ #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/MachineInstrBuilder.h" +#include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/IR/Function.h" #include "llvm/Support/raw_os_ostream.h" #include "llvm/Target/TargetInstrInfo.h" +#include "llvm/Target/TargetLowering.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetSubtargetInfo.h" @@ -512,6 +514,12 @@ return true; } } + const TargetLowering *TLI = MF->getSubtarget().getTargetLowering(); + for (const Function *Personality : MF->getMMI().getPersonalities()) { + if (TLI->getExceptionPointerRegister(Personality) == PhysReg + || TLI->getExceptionSelectorRegister(Personality) == PhysReg) + return true; + } return false; } Index: test/DebugInfo/SystemZ/eh_frame_personality.ll =================================================================== --- test/DebugInfo/SystemZ/eh_frame_personality.ll +++ test/DebugInfo/SystemZ/eh_frame_personality.ll @@ -20,7 +20,9 @@ ; 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