aboutsummaryrefslogtreecommitdiffstats
path: root/tools/bugpoint
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-04-11 23:52:35 +0000
committerChris Lattner <sabre@nondot.org>2004-04-11 23:52:35 +0000
commit36ee07ff9d26a2c6ebf9faf9ba90923644db29c5 (patch)
treeba1a2a3d52429d9c5c3147a838bc28483bd0d291 /tools/bugpoint
parentfeac3e18aa861a4dd1ba0e0d6222805821b6bc1b (diff)
downloadexternal_llvm-36ee07ff9d26a2c6ebf9faf9ba90923644db29c5.zip
external_llvm-36ee07ff9d26a2c6ebf9faf9ba90923644db29c5.tar.gz
external_llvm-36ee07ff9d26a2c6ebf9faf9ba90923644db29c5.tar.bz2
Disambiguate symbols after loop extraction so that we can diagnose a code
generator bug if multiple loops are extracted from a function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12847 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint')
-rw-r--r--tools/bugpoint/Miscompilation.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp
index fddbebdd..7c82b58 100644
--- a/tools/bugpoint/Miscompilation.cpp
+++ b/tools/bugpoint/Miscompilation.cpp
@@ -201,6 +201,19 @@ bool ReduceMiscompilingFunctions::TestFuncs(const std::vector<Function*>&Funcs){
return TestFn(BD, ToOptimize, ToNotOptimize);
}
+static void DisambiguateGlobalSymbols(Module *M) {
+ // Try not to cause collisions by minimizing chances of renaming an
+ // already-external symbol, so take in external globals and functions as-is.
+ // The code should work correctly without disambiguation (assuming the same
+ // mangler is used by the two code generators), but having symbols with the
+ // same name causes warnings to be emitted by the code generator.
+ Mangler Mang(*M);
+ for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I)
+ I->setName(Mang.getValueName(I));
+ for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
+ I->setName(Mang.getValueName(I));
+}
+
/// ExtractLoops - Given a reduced list of functions that still exposed the bug,
/// check to see if we can extract the loops in the region without obscuring the
/// bug. If so, it reduces the amount of code identified.
@@ -321,6 +334,11 @@ DebugAMiscompilation(BugDriver &BD,
// Okay, we extracted some loops and the problem still appears. See if we
// can eliminate some of the created functions from being candidates.
+ // Loop extraction can introduce functions with the same name (foo_code).
+ // Make sure to disambiguate the symbols so that when the program is split
+ // apart that we can link it back together again.
+ DisambiguateGlobalSymbols(BD.getProgram());
+
// Do the reduction...
ReduceMiscompilingFunctions(BD, TestFn).reduceList(MiscompiledFunctions);
@@ -549,22 +567,6 @@ static bool TestCodeGenerator(BugDriver &BD, Module *Test, Module *Safe) {
}
-
-static void DisambiguateGlobalSymbols(Module *M) {
- // Try not to cause collisions by minimizing chances of renaming an
- // already-external symbol, so take in external globals and functions as-is.
- // The code should work correctly without disambiguation (assuming the same
- // mangler is used by the two code generators), but having symbols with the
- // same name causes warnings to be emitted by the code generator.
- Mangler Mang(*M);
- for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I)
- I->setName(Mang.getValueName(I));
- for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
- I->setName(Mang.getValueName(I));
-}
-
-
-
bool BugDriver::debugCodeGenerator() {
if ((void*)cbe == (void*)Interpreter) {
std::string Result = executeProgramWithCBE("bugpoint.cbe.out");