summaryrefslogtreecommitdiff
path: root/tools/lto
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2010-10-06 01:22:42 +0000
committerBill Wendling <isanbard@gmail.com>2010-10-06 01:22:42 +0000
commit34711747a1d2c8713e69333bacef1c880810e371 (patch)
tree0dc76a5863ab9848365c88c02692d7b730104c94 /tools/lto
parent417b54354b3fcccb4f5919b8d2d9dcd8bba50069 (diff)
downloadllvm-34711747a1d2c8713e69333bacef1c880810e371.tar.gz
llvm-34711747a1d2c8713e69333bacef1c880810e371.tar.bz2
llvm-34711747a1d2c8713e69333bacef1c880810e371.tar.xz
Provide a fast "get me the target triple from the module" API. This can
drastically reduce the linking time during LTO. Patch by Shantonu Sen! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115728 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lto')
-rw-r--r--tools/lto/LTOModule.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/tools/lto/LTOModule.cpp b/tools/lto/LTOModule.cpp
index c4798ff3ac..f0f3dbcce4 100644
--- a/tools/lto/LTOModule.cpp
+++ b/tools/lto/LTOModule.cpp
@@ -64,15 +64,10 @@ bool LTOModule::isBitcodeFileForTarget(const char *path,
// Takes ownership of buffer.
bool LTOModule::isTargetMatch(MemoryBuffer *buffer, const char *triplePrefix) {
- OwningPtr<Module> m(getLazyBitcodeModule(buffer, getGlobalContext()));
- // On success, m owns buffer and both are deleted at end of this method.
- if (!m) {
- delete buffer;
- return false;
- }
- std::string actualTarget = m->getTargetTriple();
- return (strncmp(actualTarget.c_str(), triplePrefix,
- strlen(triplePrefix)) == 0);
+ std::string Triple = getBitcodeTargetTriple(buffer, getGlobalContext());
+ delete buffer;
+ return (strncmp(Triple.c_str(), triplePrefix,
+ strlen(triplePrefix)) == 0);
}