[PATCH] D22980: Imported statistics types changes

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 1 15:34:26 PDT 2016


vsk added a comment.

Lgtm.


================
Comment at: lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp:52-59
@@ -51,5 +51,10 @@
   CallerNode.InlinedCallees.push_back(&CalleeNode);
-  if (!CallerNode.Imported)
-    // Save Caller as a starting node for traversal.
-    NonImportedCallers.push_back(Caller.getName());
+  if (!CallerNode.Imported) {
+    // We could avoid second lookup, but it would make the code ultra ugly.
+    auto It = NodesMap.find(Caller.getName());
+    assert(It != NodesMap.end() && "The node should be already there.");
+    // Save Caller as a starting node for traversal. The string has to be one
+    // from map because Caller can disappear (and function name with it).
+    NonImportedCallers.push_back(It->first());
+  }
 }
----------------
Prazek wrote:
> exactly.
Thanks for explaining


https://reviews.llvm.org/D22980





More information about the llvm-commits mailing list