summaryrefslogtreecommitdiffstats
path: root/llvm/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
commitb38cc9c026dd13207ecbe09776787a55af50844a (patch)
tree4d3fc32bc818ff00504308232a591e6efdf3899a /llvm/tools/bugpoint/Miscompilation.cpp
parent7e51a502bc0e829866465e4b3ff137422c65fdec (diff)
downloadbcm5719-llvm-b38cc9c026dd13207ecbe09776787a55af50844a.tar.gz
bcm5719-llvm-b38cc9c026dd13207ecbe09776787a55af50844a.zip
When loop extraction succeeds, make sure to map the function pointers over
to avoid dangling references. llvm-svn: 12470
Diffstat (limited to 'llvm/tools/bugpoint/Miscompilation.cpp')
-rw-r--r--llvm/tools/bugpoint/Miscompilation.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/tools/bugpoint/Miscompilation.cpp b/llvm/tools/bugpoint/Miscompilation.cpp
index 21f4bcc73ba..6524f7a8aea 100644
--- a/llvm/tools/bugpoint/Miscompilation.cpp
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud