[WebAssembly] Factor out a TypeToString function, since we need it in multiple places.
[oota-llvm.git] / lib / IR / FunctionInfo.cpp
index 015f1235f6df7552f5bf1110d60a87d078363a83..17a67bcf04721a2668f7f8eea98320eebac94070 100644 (file)
@@ -23,7 +23,7 @@ void FunctionInfoIndex::mergeFrom(std::unique_ptr<FunctionInfoIndex> Other,
 
   StringRef ModPath;
   for (auto &OtherFuncInfoLists : *Other) {
-    StringRef FuncName = OtherFuncInfoLists.getKey();
+    std::string FuncName = OtherFuncInfoLists.getKey();
     FunctionInfoList &List = OtherFuncInfoLists.second;
 
     // Assert that the func info list only has one entry, since we shouldn't
@@ -31,6 +31,10 @@ void FunctionInfoIndex::mergeFrom(std::unique_ptr<FunctionInfoIndex> Other,
     assert(List.size() == 1);
     std::unique_ptr<FunctionInfo> Info = std::move(List.front());
 
+    // Skip if there was no function summary section.
+    if (!Info->functionSummary())
+      continue;
+
     // Add the module path string ref for this module if we haven't already
     // saved a reference to it.
     if (ModPath.empty())