From da3b12a1bbf9d2863451efdee810a0ee646494a9 Mon Sep 17 00:00:00 2001 From: dim Date: Thu, 20 Jun 2013 18:25:10 +0000 Subject: Pull in r183984 from llvm trunk: Make PrologEpilogInserter save/restore all callee saved registers in functions which call __builtin_unwind_init() __builtin_unwind_init() is an undocumented gcc intrinsic which has this effect, and is used in libgcc_eh. Goes part of the way toward fixing PR8541. This obsoletes the ugly hack to libgcc's unwind code from r245272, and should also work for other arches, so revert the hack too. --- contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'contrib/llvm') diff --git a/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp index 959dd7d..9487cbd 100644 --- a/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp +++ b/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp @@ -29,6 +29,7 @@ #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineLoopInfo.h" +#include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/RegisterScavenging.h" #include "llvm/IR/InlineAsm.h" @@ -214,7 +215,8 @@ void PEI::calculateCalleeSavedRegisters(MachineFunction &F) { std::vector CSI; for (unsigned i = 0; CSRegs[i]; ++i) { unsigned Reg = CSRegs[i]; - if (F.getRegInfo().isPhysRegUsed(Reg)) { + // Functions which call __builtin_unwind_init get all their registers saved. + if (F.getRegInfo().isPhysRegUsed(Reg) || F.getMMI().callsUnwindInit()) { // If the reg is modified, save it! CSI.push_back(CalleeSavedInfo(Reg)); } -- cgit v1.1