1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[WinEH] Avoid holding references to BlockColor (DenseMap) entries while inserting new elements

Differential Revision: https://reviews.llvm.org/D27693

llvm-svn: 289694
This commit is contained in:
Andrew Kaylor 2016-12-14 19:30:18 +00:00
parent af1853c43a
commit 9f2d83ffdb

View File

@ -1202,8 +1202,12 @@ void WinEHPrepare::replaceUseWithLoad(Value *V, Use &U, AllocaInst *&SpillSlot,
Goto->setSuccessor(0, PHIBlock); Goto->setSuccessor(0, PHIBlock);
CatchRet->setSuccessor(NewBlock); CatchRet->setSuccessor(NewBlock);
// Update the color mapping for the newly split edge. // Update the color mapping for the newly split edge.
// Grab a reference to the ColorVector to be inserted before getting the
// reference to the vector we are copying because inserting the new
// element in BlockColors might cause the map to be reallocated.
ColorVector &ColorsForNewBlock = BlockColors[NewBlock];
ColorVector &ColorsForPHIBlock = BlockColors[PHIBlock]; ColorVector &ColorsForPHIBlock = BlockColors[PHIBlock];
BlockColors[NewBlock] = ColorsForPHIBlock; ColorsForNewBlock = ColorsForPHIBlock;
for (BasicBlock *FuncletPad : ColorsForPHIBlock) for (BasicBlock *FuncletPad : ColorsForPHIBlock)
FuncletBlocks[FuncletPad].push_back(NewBlock); FuncletBlocks[FuncletPad].push_back(NewBlock);
// Treat the new block as incoming for load insertion. // Treat the new block as incoming for load insertion.