diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 34 | ||||
-rw-r--r-- | llvm/lib/IR/Globals.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/IR/Module.cpp | 11 | ||||
-rw-r--r-- | llvm/lib/Linker/IRMover.cpp | 1 |
4 files changed, 0 insertions, 52 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index ff08f55d43f..d7fce0580c2 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -227,9 +227,6 @@ class BitcodeReader : public GVMaterializer { /// (e.g.) blockaddress forward references. bool WillMaterializeAllForwardRefs = false; - /// Functions that have block addresses taken. This is usually empty. - SmallPtrSet<const Function *, 4> BlockAddressesTaken; - /// True if any Metadata block has been materialized. bool IsMetadataMaterialized = false; @@ -256,11 +253,9 @@ public: void releaseBuffer(); - bool isDematerializable(const GlobalValue *GV) const override; std::error_code materialize(GlobalValue *GV) override; std::error_code materializeModule(Module *M) override; std::vector<StructType *> getIdentifiedStructTypes() const override; - void dematerialize(GlobalValue *GV) override; /// \brief Main interface to parsing a bitcode buffer. /// \returns true if an error occurred. @@ -2951,9 +2946,6 @@ std::error_code BitcodeReader::parseConstants() { if (!Fn) return error("Invalid record"); - // Don't let Fn get dematerialized. - BlockAddressesTaken.insert(Fn); - // If the function is already parsed we can insert the block address right // away. BasicBlock *BB; @@ -5291,32 +5283,6 @@ std::error_code BitcodeReader::materialize(GlobalValue *GV) { return materializeForwardReferencedFunctions(); } -bool BitcodeReader::isDematerializable(const GlobalValue *GV) const { - const Function *F = dyn_cast<Function>(GV); - if (!F || F->isDeclaration()) - return false; - - // Dematerializing F would leave dangling references that wouldn't be - // reconnected on re-materialization. - if (BlockAddressesTaken.count(F)) - return false; - - return DeferredFunctionInfo.count(const_cast<Function*>(F)); -} - -void BitcodeReader::dematerialize(GlobalValue *GV) { - Function *F = dyn_cast<Function>(GV); - // If this function isn't dematerializable, this is a noop. - if (!F || !isDematerializable(F)) - return; - - assert(DeferredFunctionInfo.count(F) && "No info to read function later?"); - - // Just forget the function body, we can remat it later. - F->dropAllReferences(); - F->setIsMaterializable(true); -} - std::error_code BitcodeReader::materializeModule(Module *M) { assert(M == TheModule && "Can only Materialize the Module this BitcodeReader is attached to."); diff --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp index c538c7baa1f..6159f93faf8 100644 --- a/llvm/lib/IR/Globals.cpp +++ b/llvm/lib/IR/Globals.cpp @@ -32,15 +32,9 @@ bool GlobalValue::isMaterializable() const { return F->isMaterializable(); return false; } -bool GlobalValue::isDematerializable() const { - return getParent() && getParent()->isDematerializable(this); -} std::error_code GlobalValue::materialize() { return getParent()->materialize(this); } -void GlobalValue::dematerialize() { - getParent()->dematerialize(this); -} /// Override destroyConstantImpl to make sure it doesn't get called on /// GlobalValue's because they shouldn't be treated like other constants. diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp index 2acd9db210d..d1744910869 100644 --- a/llvm/lib/IR/Module.cpp +++ b/llvm/lib/IR/Module.cpp @@ -384,12 +384,6 @@ void Module::setMaterializer(GVMaterializer *GVM) { Materializer.reset(GVM); } -bool Module::isDematerializable(const GlobalValue *GV) const { - if (Materializer) - return Materializer->isDematerializable(GV); - return false; -} - std::error_code Module::materialize(GlobalValue *GV) { if (!Materializer) return std::error_code(); @@ -397,11 +391,6 @@ std::error_code Module::materialize(GlobalValue *GV) { return Materializer->materialize(GV); } -void Module::dematerialize(GlobalValue *GV) { - if (Materializer) - return Materializer->dematerialize(GV); -} - std::error_code Module::materializeAll() { if (!Materializer) return std::error_code(); diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp index 718bfc998cb..6e344f81b5f 100644 --- a/llvm/lib/Linker/IRMover.cpp +++ b/llvm/lib/Linker/IRMover.cpp @@ -1163,7 +1163,6 @@ bool IRLinker::linkFunctionBody(Function &Dst, Function &Src) { for (Argument &Arg : Src.args()) ValueMap.erase(&Arg); - Src.dematerialize(); return false; } |