From 18c63b0f1859d9996b4d3b8c69c22f5f6b46498b Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 18 Dec 2015 19:57:26 +0000 Subject: Drop support for dematerializing. It was only used on lib/Linker and the use was "dead" since it was used on a function the IRMover had just moved. llvm-svn: 256019 --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 34 ------------------------------- 1 file changed, 34 deletions(-) (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp') 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 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 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(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(F)); -} - -void BitcodeReader::dematerialize(GlobalValue *GV) { - Function *F = dyn_cast(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."); -- cgit v1.2.3