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/IR/Function.cpp | |
parent | f924e11967750e5e269e063a22fc495799cfab6d (diff) | |
download | llvm-d4bcefc7d9ff16710b2509e494614b5c08013567.zip llvm-d4bcefc7d9ff16710b2509e494614b5c08013567.tar.gz llvm-d4bcefc7d9ff16710b2509e494614b5c08013567.tar.bz2 |
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/IR/Function.cpp')
-rw-r--r-- | llvm/lib/IR/Function.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index 2323c74..8a69e39 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -213,6 +213,12 @@ void Argument::removeAttr(AttributeSet AS) { // Helper Methods in Function //===----------------------------------------------------------------------===// +bool Function::isMaterializable() const { + return getGlobalObjectSubClassData(); +} + +void Function::setIsMaterializable(bool V) { setGlobalObjectSubClassData(V); } + LLVMContext &Function::getContext() const { return getType()->getContext(); } @@ -247,6 +253,7 @@ Function::Function(FunctionType *Ty, LinkageTypes Linkage, const Twine &name, Linkage, name) { assert(FunctionType::isValidReturnType(getReturnType()) && "invalid return type"); + setIsMaterializable(false); SymTab = new ValueSymbolTable(); // If the function has arguments, mark them as lazily built. @@ -318,6 +325,8 @@ void Function::setParent(Module *parent) { // delete. // void Function::dropAllReferences() { + setIsMaterializable(false); + for (iterator I = begin(), E = end(); I != E; ++I) I->dropAllReferences(); |