[ThinLTO] Handle bitcode without function summary sections gracefully
[oota-llvm.git] / lib / Bitcode / Reader / BitcodeReader.cpp
index 9d907773cb369fb2cc0b5d95c4fa1847adfe2b88..11c9b131da7059387605ee0c57822f50ecf1c14d 100644 (file)
@@ -5566,12 +5566,14 @@ std::error_code FunctionIndexBitcodeReader::parseModule() {
 
     case BitstreamEntry::SubBlock:
       if (CheckFuncSummaryPresenceOnly) {
 
     case BitstreamEntry::SubBlock:
       if (CheckFuncSummaryPresenceOnly) {
-        if (Entry.ID == bitc::FUNCTION_SUMMARY_BLOCK_ID)
+        if (Entry.ID == bitc::FUNCTION_SUMMARY_BLOCK_ID) {
           SeenFuncSummary = true;
           SeenFuncSummary = true;
+          // No need to parse the rest since we found the summary.
+          return std::error_code();
+        }
         if (Stream.SkipBlock())
           return error("Invalid record");
         if (Stream.SkipBlock())
           return error("Invalid record");
-        // No need to parse the rest since we found the summary.
-        return std::error_code();
+        continue;
       }
       switch (Entry.ID) {
       default: // Skip unknown content.
       }
       switch (Entry.ID) {
       default: // Skip unknown content.