summaryrefslogtreecommitdiff
path: root/tools/bugpoint/Miscompilation.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-16 21:34:01 +0000
committerChris Lattner <sabre@nondot.org>2010-01-16 21:34:01 +0000
commit8abfb8adb2f383cab46a5e8b9fca4301effd8140 (patch)
treed0ca478f04c55369f12355fc60bf9d6f09e513e1 /tools/bugpoint/Miscompilation.cpp
parent048fe3c9c3456709581962bebe1f92ece0f79643 (diff)
downloadllvm-8abfb8adb2f383cab46a5e8b9fca4301effd8140.tar.gz
llvm-8abfb8adb2f383cab46a5e8b9fca4301effd8140.tar.bz2
llvm-8abfb8adb2f383cab46a5e8b9fca4301effd8140.tar.xz
bugpoint doesn't need the mangler at all. DisambiguateGlobalSymbols
dates to a time when two different LLVM values could have the same name but different types. Simplify it to just assign names to unnamed things and let the core symtab resolve duplicates. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93660 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint/Miscompilation.cpp')
-rw-r--r--tools/bugpoint/Miscompilation.cpp30
1 files changed, 5 insertions, 25 deletions
diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp
index 92bf1437d5..4c184d64a6 100644
--- a/tools/bugpoint/Miscompilation.cpp
+++ b/tools/bugpoint/Miscompilation.cpp
@@ -22,7 +22,6 @@
#include "llvm/Module.h"
#include "llvm/Pass.h"
#include "llvm/Analysis/Verifier.h"
-#include "llvm/Support/Mangler.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileUtilities.h"
@@ -235,29 +234,18 @@ bool ReduceMiscompilingFunctions::TestFuncs(const std::vector<Function*>&Funcs){
return TestFn(BD, ToOptimize, ToNotOptimize);
}
-/// DisambiguateGlobalSymbols - Mangle symbols to guarantee uniqueness by
-/// modifying predominantly internal symbols rather than external ones.
+/// DisambiguateGlobalSymbols - Give anonymous global values names.
///
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);
- // Agree with the CBE on symbol naming
- Mang.markCharUnacceptable('.');
for (Module::global_iterator I = M->global_begin(), E = M->global_end();
I != E; ++I) {
// Don't mangle asm names.
- if (!I->hasName() || I->getName()[0] != 1)
- I->setName(Mang.getNameWithPrefix(I));
+ if (!I->hasName())
+ I->setName("anon_global");
}
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) {
- // Don't mangle asm names or intrinsics.
- if ((!I->hasName() || I->getName()[0] != 1) &&
- I->getIntrinsicID() == 0)
- I->setName(Mang.getNameWithPrefix(I));
+ if (!I->hasName())
+ I->setName("anon_fn");
}
}
@@ -548,10 +536,6 @@ DebugAMiscompilation(BugDriver &BD,
ExtractLoops(BD, TestFn, MiscompiledFunctions)) {
// 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...
@@ -569,10 +553,6 @@ DebugAMiscompilation(BugDriver &BD,
ExtractBlocks(BD, TestFn, MiscompiledFunctions)) {
// Okay, we extracted some blocks and the problem still appears. See if we
// can eliminate some of the created functions from being candidates.
-
- // Block 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...