[llvm] r289694 - [WinEH] Avoid holding references to BlockColor (DenseMap) entries while inserting new elements
Andrew Kaylor via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 14 11:30:18 PST 2016
Author: akaylor
Date: Wed Dec 14 13:30:18 2016
New Revision: 289694
URL: http://llvm.org/viewvc/llvm-project?rev=289694&view=rev
Log:
[WinEH] Avoid holding references to BlockColor (DenseMap) entries while inserting new elements
Differential Revision: https://reviews.llvm.org/D27693
Modified:
llvm/trunk/lib/CodeGen/WinEHPrepare.cpp
Modified: llvm/trunk/lib/CodeGen/WinEHPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/WinEHPrepare.cpp?rev=289694&r1=289693&r2=289694&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/WinEHPrepare.cpp (original)
+++ llvm/trunk/lib/CodeGen/WinEHPrepare.cpp Wed Dec 14 13:30:18 2016
@@ -1202,8 +1202,12 @@ void WinEHPrepare::replaceUseWithLoad(Va
Goto->setSuccessor(0, PHIBlock);
CatchRet->setSuccessor(NewBlock);
// 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];
- BlockColors[NewBlock] = ColorsForPHIBlock;
+ ColorsForNewBlock = ColorsForPHIBlock;
for (BasicBlock *FuncletPad : ColorsForPHIBlock)
FuncletBlocks[FuncletPad].push_back(NewBlock);
// Treat the new block as incoming for load insertion.
More information about the llvm-commits
mailing list