diff options
-rw-r--r-- | llvm/include/llvm/IR/Module.h | 9 | ||||
-rw-r--r-- | llvm/lib/IR/LLVMContextImpl.cpp | 27 | ||||
-rw-r--r-- | llvm/lib/IR/LLVMContextImpl.h | 3 | ||||
-rw-r--r-- | llvm/lib/Linker/IRMover.cpp | 4 |
4 files changed, 1 insertions, 42 deletions
diff --git a/llvm/include/llvm/IR/Module.h b/llvm/include/llvm/IR/Module.h index d69025a..53d10053 100644 --- a/llvm/include/llvm/IR/Module.h +++ b/llvm/include/llvm/IR/Module.h @@ -877,15 +877,6 @@ public: } /// @} - /// Destroy ConstantArrays in LLVMContext if they are not used. - /// ConstantArrays constructed during linking can cause quadratic memory - /// explosion. Releasing all unused constants can cause a 20% LTO compile-time - /// slowdown for a large application. - /// - /// NOTE: Constants are currently owned by LLVMContext. This can then only - /// be called where all uses of the LLVMContext are understood. - void dropTriviallyDeadConstantArrays(); - /// @name Utility functions for printing and dumping Module objects /// @{ diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp index d8cdbf8..dfeabb4 100644 --- a/llvm/lib/IR/LLVMContextImpl.cpp +++ b/llvm/lib/IR/LLVMContextImpl.cpp @@ -147,33 +147,6 @@ LLVMContextImpl::~LLVMContextImpl() { delete Pair.second; } -void LLVMContextImpl::dropTriviallyDeadConstantArrays() { - SmallSetVector<ConstantArray *, 4> WorkList; - - // When ArrayConstants are of substantial size and only a few in them are - // dead, starting WorkList with all elements of ArrayConstants can be - // wasteful. Instead, starting WorkList with only elements that have empty - // uses. - for (ConstantArray *C : ArrayConstants) - if (C->use_empty()) - WorkList.insert(C); - - while (!WorkList.empty()) { - ConstantArray *C = WorkList.pop_back_val(); - if (C->use_empty()) { - for (const Use &Op : C->operands()) { - if (auto *COp = dyn_cast<ConstantArray>(Op)) - WorkList.insert(COp); - } - C->destroyConstant(); - } - } -} - -void Module::dropTriviallyDeadConstantArrays() { - Context.pImpl->dropTriviallyDeadConstantArrays(); -} - namespace llvm { /// Make MDOperand transparent for hashing. diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h index 9b60b57..71369772f 100644 --- a/llvm/lib/IR/LLVMContextImpl.h +++ b/llvm/lib/IR/LLVMContextImpl.h @@ -1808,9 +1808,6 @@ public: LLVMContextImpl(LLVMContext &C); ~LLVMContextImpl(); - /// Destroy the ConstantArrays if they are not used. - void dropTriviallyDeadConstantArrays(); - mutable OptPassGate *OPG = nullptr; /// Access the object which can disable optional passes and individual diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp index 98d6905..e456669 100644 --- a/llvm/lib/Linker/IRMover.cpp +++ b/llvm/lib/Linker/IRMover.cpp @@ -1753,7 +1753,5 @@ Error IRMover::move(std::unique_ptr<Module> Src, IRLinker TheIRLinker(Composite, SharedMDs, IdentifiedStructTypes, std::move(Src), ValuesToLink, std::move(AddLazyFor), IsPerformingImport); - Error E = TheIRLinker.run(); - Composite.dropTriviallyDeadConstantArrays(); - return E; + return TheIRLinker.run(); } |