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
This commit is contained in:
Rafael Espindola
2015-12-18 19:57:26 +00:00
parent 081a24e3a7
commit 18c63b0f18
8 changed files with 0 additions and 119 deletions

View File

@@ -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.");