aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/bugpoint/Miscompilation.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp
index 21f4bcc73b..6524f7a8ae 100644
--- a/tools/bugpoint/Miscompilation.cpp
+++ b/tools/bugpoint/Miscompilation.cpp
@@ -268,6 +268,17 @@ static bool ExtractLoops(BugDriver &BD,
exit(1);
}
delete ToOptimizeLoopExtracted;
+
+ // All of the Function*'s in the MiscompiledFunctions list are in the old
+ // module. Make sure to update them to point to the corresponding functions
+ // in the new module.
+ for (unsigned i = 0, e = MiscompiledFunctions.size(); i != e; ++i) {
+ Function *OldF = MiscompiledFunctions[i];
+ Function *NewF =
+ ToNotOptimize->getFunction(OldF->getName(), OldF->getFunctionType());
+ MiscompiledFunctions[i] = NewF;
+ }
+
BD.setNewProgram(ToNotOptimize);
MadeChange = true;
}