diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-10-24 18:13:04 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-10-24 18:13:04 +0000 |
commit | d4bcefc7d9ff16710b2509e494614b5c08013567 (patch) | |
tree | b3737bb77e7daf33769e961cbb2cdf4e94d99faa /llvm/lib/Bitcode/Reader | |
parent | f924e11967750e5e269e063a22fc495799cfab6d (diff) | |
download | bcm5719-llvm-d4bcefc7d9ff16710b2509e494614b5c08013567.tar.gz bcm5719-llvm-d4bcefc7d9ff16710b2509e494614b5c08013567.zip |
Don't ever call materializeAllPermanently during LTO.
To do this, change the representation of lazy loaded functions.
The previous representation cannot differentiate between a function whose body
has been removed and one whose body hasn't been read from the .bc file. That
means that in order to drop a function, the entire body had to be read.
llvm-svn: 220580
Diffstat (limited to 'llvm/lib/Bitcode/Reader')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 11 | ||||
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.h | 1 |
2 files changed, 3 insertions, 9 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index ca6d73c12ba..507164c8468 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -2070,6 +2070,7 @@ std::error_code BitcodeReader::ParseModule(bool Resume) { // If this is a function with a body, remember the prototype we are // creating now, so that we can match up the body with them later. if (!isProto) { + Func->setIsMaterializable(true); FunctionsWithBodies.push_back(Func); if (LazyStreamer) DeferredFunctionInfo[Func] = 0; @@ -3281,14 +3282,6 @@ std::error_code BitcodeReader::FindFunctionInStream( void BitcodeReader::releaseBuffer() { Buffer.release(); } -bool BitcodeReader::isMaterializable(const GlobalValue *GV) const { - if (const Function *F = dyn_cast<Function>(GV)) { - return F->isDeclaration() && - DeferredFunctionInfo.count(const_cast<Function*>(F)); - } - return false; -} - std::error_code BitcodeReader::Materialize(GlobalValue *GV) { Function *F = dyn_cast<Function>(GV); // If it's not a function or is already material, ignore the request. @@ -3308,6 +3301,7 @@ std::error_code BitcodeReader::Materialize(GlobalValue *GV) { if (std::error_code EC = ParseFunctionBody(F)) return EC; + F->setIsMaterializable(false); // Upgrade any old intrinsic calls in the function. for (UpgradedIntrinsicMap::iterator I = UpgradedIntrinsics.begin(), @@ -3349,6 +3343,7 @@ void BitcodeReader::Dematerialize(GlobalValue *GV) { // Just forget the function body, we can remat it later. F->dropAllReferences(); + F->setIsMaterializable(true); } std::error_code BitcodeReader::MaterializeModule(Module *M) { diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.h b/llvm/lib/Bitcode/Reader/BitcodeReader.h index c9525661ec1..9f0f6686121 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.h +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.h @@ -223,7 +223,6 @@ public: void releaseBuffer(); - bool isMaterializable(const GlobalValue *GV) const override; bool isDematerializable(const GlobalValue *GV) const override; std::error_code Materialize(GlobalValue *GV) override; std::error_code MaterializeModule(Module *M) override; |