diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-01-08 08:03:55 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-01-08 08:03:55 +0000 |
commit | 086fec23ec438976a69e7232816e9c9d59d5d41c (patch) | |
tree | 66b6db578f4a125c89e30fc067a235db0ea8dd75 /llvm/lib/CodeGen/StackColoring.cpp | |
parent | 249edf3d22c4b46059e1495ee120671aa47e3abd (diff) | |
download | bcm5719-llvm-086fec23ec438976a69e7232816e9c9d59d5d41c.tar.gz bcm5719-llvm-086fec23ec438976a69e7232816e9c9d59d5d41c.zip |
[WinEH] Update WinEHFuncInfo if StackColoring merges allocas
Windows EH keeping track of which frame index corresponds to a catchpad
in order to inform the runtime where the catch parameter should be
initialized. LLVM's optimizations are able to prove that the memory
used by the catch parameter can be reused with another memory
optimization, changing it's frame index.
We need to keep WinEHFuncInfo up to date with respect to this or we will
miscompile/assert.
This fixes PR26069.
llvm-svn: 257158
Diffstat (limited to 'llvm/lib/CodeGen/StackColoring.cpp')
-rw-r--r-- | llvm/lib/CodeGen/StackColoring.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/StackColoring.cpp b/llvm/lib/CodeGen/StackColoring.cpp index 3541b33a844..d0c0cf77702 100644 --- a/llvm/lib/CodeGen/StackColoring.cpp +++ b/llvm/lib/CodeGen/StackColoring.cpp @@ -43,6 +43,7 @@ #include "llvm/CodeGen/PseudoSourceValue.h" #include "llvm/CodeGen/SlotIndexes.h" #include "llvm/CodeGen/StackProtector.h" +#include "llvm/CodeGen/WinEHFuncInfo.h" #include "llvm/IR/DebugInfo.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/Function.h" @@ -570,6 +571,12 @@ void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) { } } + if (WinEHFuncInfo *EHInfo = MF->getWinEHFuncInfo()) + for (WinEHTryBlockMapEntry &TBME : EHInfo->TryBlockMap) + for (WinEHHandlerType &H : TBME.HandlerArray) + if (SlotRemap.count(H.CatchObj.FrameIndex)) + H.CatchObj.FrameIndex = SlotRemap[H.CatchObj.FrameIndex]; + DEBUG(dbgs()<<"Fixed "<<FixedMemOp<<" machine memory operands.\n"); DEBUG(dbgs()<<"Fixed "<<FixedDbg<<" debug locations.\n"); DEBUG(dbgs()<<"Fixed "<<FixedInstr<<" machine instructions.\n"); |