summaryrefslogtreecommitdiffstats
path: root/llvm/tools/bugpoint/ExtractFunction.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-04-02 16:28:32 +0000
committerChris Lattner <sabre@nondot.org>2004-04-02 16:28:32 +0000
commit3838243d0477fad07c095ce2594c889097667da9 (patch)
tree2aec1866d53904a49d7591f906430fa06834ff79 /llvm/tools/bugpoint/ExtractFunction.cpp
parentfe66caa9a0aa01d6932a77ad2dab92c4af3de059 (diff)
downloadbcm5719-llvm-3838243d0477fad07c095ce2594c889097667da9.tar.gz
bcm5719-llvm-3838243d0477fad07c095ce2594c889097667da9.zip
Minor speedup
llvm-svn: 12612
Diffstat (limited to 'llvm/tools/bugpoint/ExtractFunction.cpp')
-rw-r--r--llvm/tools/bugpoint/ExtractFunction.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/llvm/tools/bugpoint/ExtractFunction.cpp b/llvm/tools/bugpoint/ExtractFunction.cpp
index eea7bd8e253..9f8dca8abd0 100644
--- a/llvm/tools/bugpoint/ExtractFunction.cpp
+++ b/llvm/tools/bugpoint/ExtractFunction.cpp
@@ -26,6 +26,7 @@
#include "Support/CommandLine.h"
#include "Support/Debug.h"
#include "Support/FileUtilities.h"
+#include <set>
using namespace llvm;
namespace llvm {
@@ -183,7 +184,9 @@ Module *llvm::SplitFunctionsOutOfModule(Module *M,
I->setInitializer(0); // Delete the initializer to make it external
// Remove the Test functions from the Safe module
+ std::set<std::pair<std::string, const PointerType*> > TestFunctions;
for (unsigned i = 0, e = F.size(); i != e; ++i) {
+ TestFunctions.insert(std::make_pair(F[i]->getName(), F[i]->getType()));
Function *TNOF = M->getFunction(F[i]->getName(), F[i]->getFunctionType());
DEBUG(std::cerr << "Removing function " << F[i]->getName() << "\n");
assert(TNOF && "Function doesn't exist in module!");
@@ -191,16 +194,8 @@ Module *llvm::SplitFunctionsOutOfModule(Module *M,
}
// Remove the Safe functions from the Test module
- for (Module::iterator I = New->begin(), E = New->end(); I != E; ++I) {
- bool funcFound = false;
- for (std::vector<Function*>::const_iterator FI = F.begin(), Fe = F.end();
- FI != Fe; ++FI)
- if (I->getName() == (*FI)->getName() &&
- I->getType() == (*FI)->getType())
- funcFound = true;
-
- if (!funcFound)
+ for (Module::iterator I = New->begin(), E = New->end(); I != E; ++I)
+ if (!TestFunctions.count(std::make_pair(I->getName(), I->getType())))
DeleteFunctionBody(I);
- }
return New;
}
OpenPOWER on IntegriCloud