diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-01-08 17:24:47 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-01-08 17:24:47 +0000 |
commit | 2a6368f6090258a0caff96e22a0ca0e9e05e8abe (patch) | |
tree | 77b8fb3775a23cc0f999b7ba1e7a95903ae0ef8a /llvm/lib/CodeGen/StackColoring.cpp | |
parent | 1b00f2d99abe369cede650af4c98f0db2aad9abe (diff) | |
download | bcm5719-llvm-2a6368f6090258a0caff96e22a0ca0e9e05e8abe.tar.gz bcm5719-llvm-2a6368f6090258a0caff96e22a0ca0e9e05e8abe.zip |
[WinEH] CatchHandler which don't have catch objects in StackColoring
StackColoring rewrites the frame indicies of operations involving
allocas if it can find that the life time of two objects do not overlap.
MSVC EH needs to be kept aware of this if happens in the event that a
catch object has moved around. However, we represent the non-existance
of a catch object with a sentinel frame index (INT_MAX). This sentinel
also happens to be the EmptyKey of the SlotRemap DenseMap. Testing for
whether or not we need to translate the frame index fails in this case
because we call the count method on the DenseMap with the EmptyKey,
leading to assertions. Instead, check if it is our sentinel value
before trying to look into the DenseMap.
This fixes PR26073.
llvm-svn: 257182
Diffstat (limited to 'llvm/lib/CodeGen/StackColoring.cpp')
-rw-r--r-- | llvm/lib/CodeGen/StackColoring.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/StackColoring.cpp b/llvm/lib/CodeGen/StackColoring.cpp index d0c0cf77702..7b520381517 100644 --- a/llvm/lib/CodeGen/StackColoring.cpp +++ b/llvm/lib/CodeGen/StackColoring.cpp @@ -571,10 +571,12 @@ void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) { } } + // Update the location of C++ catch objects for the MSVC personality routine. if (WinEHFuncInfo *EHInfo = MF->getWinEHFuncInfo()) for (WinEHTryBlockMapEntry &TBME : EHInfo->TryBlockMap) for (WinEHHandlerType &H : TBME.HandlerArray) - if (SlotRemap.count(H.CatchObj.FrameIndex)) + if (H.CatchObj.FrameIndex != INT_MAX && + SlotRemap.count(H.CatchObj.FrameIndex)) H.CatchObj.FrameIndex = SlotRemap[H.CatchObj.FrameIndex]; DEBUG(dbgs()<<"Fixed "<<FixedMemOp<<" machine memory operands.\n"); |