summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2016-08-13 23:31:53 +0000
committerMehdi Amini <mehdi.amini@apple.com>2016-08-13 23:31:53 +0000
commite62aaf2303a11e53741b0dacb6d93f29ee706afc (patch)
treef3510c17da7b392de042b2497d3af85f2e87151d /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent8c629ecf3af5bc2717ceb62b73e4dda98fdfe82d (diff)
downloadbcm5719-llvm-e62aaf2303a11e53741b0dacb6d93f29ee706afc.tar.gz
bcm5719-llvm-e62aaf2303a11e53741b0dacb6d93f29ee706afc.zip
Fix bitcode auto-upgrade when using bitcode lazy loading
The auto-upgrade path could be called before the VST (global names) was fully parsed, and thus intrinsic names were not available and the autoupgrade logic could not operate. Fix link failures with ThinLTO. llvm-svn: 278610
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 9bb8b2f50bb..a93c4edd120 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -3634,15 +3634,6 @@ std::error_code BitcodeReader::parseModule(uint64_t ResumeBit,
return EC;
break;
case bitc::FUNCTION_BLOCK_ID:
- // If this is the first function body we've seen, reverse the
- // FunctionsWithBodies list.
- if (!SeenFirstFunctionBody) {
- std::reverse(FunctionsWithBodies.begin(), FunctionsWithBodies.end());
- if (std::error_code EC = globalCleanup())
- return EC;
- SeenFirstFunctionBody = true;
- }
-
if (VSTOffset > 0) {
// If we have a VST forward declaration record, make sure we
// parse the VST now if we haven't already. It is needed to
@@ -3669,6 +3660,15 @@ std::error_code BitcodeReader::parseModule(uint64_t ResumeBit,
}
}
+ // If this is the first function body we've seen, reverse the
+ // FunctionsWithBodies list.
+ if (!SeenFirstFunctionBody) {
+ std::reverse(FunctionsWithBodies.begin(), FunctionsWithBodies.end());
+ if (std::error_code EC = globalCleanup())
+ return EC;
+ SeenFirstFunctionBody = true;
+ }
+
// Support older bitcode files that did not have the function
// index in the VST, nor a VST forward declaration record, as
// well as anonymous functions that do not have VST entries.
OpenPOWER on IntegriCloud