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

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 10:14:05 PST 2016


rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm



================
Comment at: lib/CodeGen/WinEHPrepare.cpp:1205-1207
+      // 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.
----------------
This can be shortened to something like "Insert NewBlock before looking up PHIBlock to avoid dangling references.". Anyone familiar with DenseMap should know how the iterator invalidation guarantees differ from std::map.


Repository:
  rL LLVM

https://reviews.llvm.org/D27693





More information about the llvm-commits mailing list