summaryrefslogtreecommitdiffstats
path: root/llvm/tools/bugpoint/ExtractFunction.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-11-16 06:31:38 +0000
committerChris Lattner <sabre@nondot.org>2004-11-16 06:31:38 +0000
commitd308797cae970045d2baa1dcc38f675e3b573f24 (patch)
treea9417040f343562a5e1998e26ad2786647ac09ab /llvm/tools/bugpoint/ExtractFunction.cpp
parent09e9f2a37b6e65a3c7a62a3b39b69095b5d644e3 (diff)
downloadbcm5719-llvm-d308797cae970045d2baa1dcc38f675e3b573f24.tar.gz
bcm5719-llvm-d308797cae970045d2baa1dcc38f675e3b573f24.zip
Make this code not depend on LinkModules leaving the second argument unmolested.
llvm-svn: 17874
Diffstat (limited to 'llvm/tools/bugpoint/ExtractFunction.cpp')
-rw-r--r--llvm/tools/bugpoint/ExtractFunction.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/tools/bugpoint/ExtractFunction.cpp b/llvm/tools/bugpoint/ExtractFunction.cpp
index d65736a1ead..bc38751048a 100644
--- a/llvm/tools/bugpoint/ExtractFunction.cpp
+++ b/llvm/tools/bugpoint/ExtractFunction.cpp
@@ -143,9 +143,18 @@ Module *BugDriver::ExtractLoop(Module *M) {
// Check to see if we created any new functions. If not, no loops were
// extracted and we should return null.
- if (M->size() == NewM->size()) {
+ static unsigned NumExtracted = 15;
+
+ if (M->size() == NewM->size() || --NumExtracted == 0) {
delete NewM;
return 0;
+ } else {
+ assert(M->size() < NewM->size() && "Loop extract removed functions?");
+ Module::iterator MI = NewM->begin();
+ for (unsigned i = 0, e = M->size(); i != e; ++i)
+ ++MI;
+ for (; MI != NewM->end(); ++MI)
+ std::cerr << "NEW FUNCTION: " << *MI;
}
return NewM;
OpenPOWER on IntegriCloud