aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Linker/LinkModules.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-08-03 00:30:35 +0000
committerBill Wendling <isanbard@gmail.com>2012-08-03 00:30:35 +0000
commit8555a37c04a8ebf14d52e548eccde1c237783079 (patch)
treec9aeeec67caaf89fa6efe0cecb7511ff2fdcc5ec /llvm/lib/Linker/LinkModules.cpp
parentd15385c9e459feb4c5b83182c9b75f56df9519e9 (diff)
downloadllvm-8555a37c04a8ebf14d52e548eccde1c237783079.zip
llvm-8555a37c04a8ebf14d52e548eccde1c237783079.tar.gz
llvm-8555a37c04a8ebf14d52e548eccde1c237783079.tar.bz2
Move the "findUsedStructTypes" functionality outside of the Module class.
The "findUsedStructTypes" method is very expensive to run. It needs to be optimized so that LTO can run faster. Splitting this method out of the Module class will help this occur. For instance, it can keep a list of seen objects so that it doesn't process them over and over again. llvm-svn: 161228
Diffstat (limited to 'llvm/lib/Linker/LinkModules.cpp')
-rw-r--r--llvm/lib/Linker/LinkModules.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp
index afba2e8..a6599bf 100644
--- a/llvm/lib/Linker/LinkModules.cpp
+++ b/llvm/lib/Linker/LinkModules.cpp
@@ -16,6 +16,7 @@
#include "llvm/DerivedTypes.h"
#include "llvm/Instructions.h"
#include "llvm/Module.h"
+#include "llvm/TypeFinder.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SetVector.h"
@@ -595,13 +596,13 @@ void ModuleLinker::computeTypeMapping() {
// At this point, the destination module may have a type "%foo = { i32 }" for
// example. When the source module got loaded into the same LLVMContext, if
// it had the same type, it would have been renamed to "%foo.42 = { i32 }".
- std::vector<StructType*> SrcStructTypes;
- SrcM->findUsedStructTypes(SrcStructTypes, true);
+ TypeFinder SrcStructTypes;
+ SrcStructTypes.run(*SrcM, true);
SmallPtrSet<StructType*, 32> SrcStructTypesSet(SrcStructTypes.begin(),
SrcStructTypes.end());
- std::vector<StructType*> DstStructTypes;
- DstM->findUsedStructTypes(DstStructTypes, true);
+ TypeFinder DstStructTypes;
+ DstStructTypes.run(*DstM, true);
SmallPtrSet<StructType*, 32> DstStructTypesSet(DstStructTypes.begin(),
DstStructTypes.end());