[llvm-commits] CVS: llvm/tools/bugpoint/Miscompilation.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun Apr 11 18:53:01 PDT 2004
Changes in directory llvm/tools/bugpoint:
Miscompilation.cpp updated: 1.38 -> 1.39
---
Log message:
Disambiguate symbols after loop extraction so that we can diagnose a code
generator bug if multiple loops are extracted from a function.
---
Diffs of the changes: (+18 -16)
Index: llvm/tools/bugpoint/Miscompilation.cpp
diff -u llvm/tools/bugpoint/Miscompilation.cpp:1.38 llvm/tools/bugpoint/Miscompilation.cpp:1.39
--- llvm/tools/bugpoint/Miscompilation.cpp:1.38 Fri Apr 9 17:28:33 2004
+++ llvm/tools/bugpoint/Miscompilation.cpp Sun Apr 11 18:52:35 2004
@@ -201,6 +201,19 @@
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 @@
// 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);
@@ -547,22 +565,6 @@
return Result;
}
-
-
-
-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() {
More information about the llvm-commits
mailing list