From 34711747a1d2c8713e69333bacef1c880810e371 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Wed, 6 Oct 2010 01:22:42 +0000 Subject: 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 --- tools/lto/LTOModule.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'tools') diff --git a/tools/lto/LTOModule.cpp b/tools/lto/LTOModule.cpp index c4798ff..f0f3dbc 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 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); } -- cgit v1.1