Make this code not depend on LinkModules leaving the second argument unmolested.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17874 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/bugpoint/ExtractFunction.cpp b/tools/bugpoint/ExtractFunction.cpp
index d65736a..bc38751 100644
--- a/tools/bugpoint/ExtractFunction.cpp
+++ b/tools/bugpoint/ExtractFunction.cpp
@@ -143,9 +143,18 @@
// 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;