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

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 14 11:40:48 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL289694: [WinEH] Avoid holding references to BlockColor (DenseMap) entries while… (authored by akaylor).

Changed prior to commit:
  https://reviews.llvm.org/D27693?vs=81167&id=81428#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27693

Files:
  llvm/trunk/lib/CodeGen/WinEHPrepare.cpp


Index: llvm/trunk/lib/CodeGen/WinEHPrepare.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/WinEHPrepare.cpp
+++ llvm/trunk/lib/CodeGen/WinEHPrepare.cpp
@@ -1202,8 +1202,12 @@
       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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27693.81428.patch
Type: text/x-patch
Size: 991 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161214/8361826f/attachment.bin>


More information about the llvm-commits mailing list