summaryrefslogtreecommitdiff
path: root/tools/bugpoint/Miscompilation.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-03-17 17:42:09 +0000
committerChris Lattner <sabre@nondot.org>2004-03-17 17:42:09 +0000
commitd3a533d94dae1e57194001af08763eb3ba199c8f (patch)
tree7149ed22544326891a788a5133b5ae224dfe09ea /tools/bugpoint/Miscompilation.cpp
parent7fa44fca308a0f8d13d981c2460ddb6de5a7b667 (diff)
downloadllvm-d3a533d94dae1e57194001af08763eb3ba199c8f.tar.gz
llvm-d3a533d94dae1e57194001af08763eb3ba199c8f.tar.bz2
llvm-d3a533d94dae1e57194001af08763eb3ba199c8f.tar.xz
When loop extraction succeeds, make sure to map the function pointers over
to avoid dangling references. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12470 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint/Miscompilation.cpp')
-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;
}