[PATCH] D12537: [MergeFuncs] Efficiently defer functions on merge

JF Bastien via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 1 16:20:13 PDT 2015


jfb added a comment.

I'm not super comfortable with keeping iterators around: iterator invalidation is a great gotcha in C++. Is there a way to avoid keeping the iterators, without changing complexity (potentially by doing a replace on ->second)? e.g. set insertion doesn't invalidate, but set deletion does, and you have both so I can't naively convince myself that your code is valid.


================
Comment at: lib/Transforms/IPO/MergeFunctions.cpp:1723
@@ +1722,3 @@
+  FnTreeType::iterator IterToFN = I->second;
+  assert(I != FnsInTree.end());
+  assert(FnsInTree.count(G) == 0);
----------------
Move this assert up one line, after find.


http://reviews.llvm.org/D12537





More information about the llvm-commits mailing list