summaryrefslogtreecommitdiffstats
path: root/tools/bugpoint
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-02-05 20:47:22 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-02-05 20:47:22 +0000
commitef9b9a793949469cdaa4ab6d0173136229dcab7b (patch)
tree137b30d24ba219e5e745a11abb3807a9c4964aaa /tools/bugpoint
parent15468bfc22302b4f79300252425d74cd6865f8b1 (diff)
downloadexternal_llvm-ef9b9a793949469cdaa4ab6d0173136229dcab7b.zip
external_llvm-ef9b9a793949469cdaa4ab6d0173136229dcab7b.tar.gz
external_llvm-ef9b9a793949469cdaa4ab6d0173136229dcab7b.tar.bz2
For PR411:
This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33918 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint')
-rw-r--r--tools/bugpoint/CrashDebugger.cpp17
-rw-r--r--tools/bugpoint/ExtractFunction.cpp10
-rw-r--r--tools/bugpoint/Miscompilation.cpp11
3 files changed, 21 insertions, 17 deletions
diff --git a/tools/bugpoint/CrashDebugger.cpp b/tools/bugpoint/CrashDebugger.cpp
index 66b6511..b597d82 100644
--- a/tools/bugpoint/CrashDebugger.cpp
+++ b/tools/bugpoint/CrashDebugger.cpp
@@ -20,7 +20,7 @@
#include "llvm/Module.h"
#include "llvm/Pass.h"
#include "llvm/PassManager.h"
-#include "llvm/SymbolTable.h"
+#include "llvm/ValueSymbolTable.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Bytecode/Writer.h"
#include "llvm/Support/CFG.h"
@@ -206,9 +206,9 @@ bool ReduceCrashingFunctions::TestFuncs(std::vector<Function*> &Funcs) {
// FIXME: bugpoint should add names to all stripped symbols.
assert(!Funcs[i]->getName().empty() &&
"Bugpoint doesn't work on stripped modules yet PR718!");
- Function *CMF = M->getFunction(Funcs[i]->getName(),
- Funcs[i]->getFunctionType());
+ Function *CMF = M->getFunction(Funcs[i]->getName());
assert(CMF && "Function not in module?!");
+ assert(CMF->getFunctionType() == Funcs[i]->getFunctionType() && "wrong ty");
Functions.insert(CMF);
}
@@ -271,8 +271,9 @@ bool ReduceCrashingBlocks::TestBlocks(std::vector<const BasicBlock*> &BBs) {
for (unsigned i = 0, e = BBs.size(); i != e; ++i) {
// Convert the basic block from the original module to the new module...
const Function *F = BBs[i]->getParent();
- Function *CMF = M->getFunction(F->getName(), F->getFunctionType());
+ Function *CMF = M->getFunction(F->getName());
assert(CMF && "Function not in module?!");
+ assert(CMF->getFunctionType() == F->getFunctionType() && "wrong type?");
// Get the mapped basic block...
Function::iterator CBI = CMF->begin();
@@ -337,10 +338,10 @@ bool ReduceCrashingBlocks::TestBlocks(std::vector<const BasicBlock*> &BBs) {
// module, and that they don't include any deleted blocks.
BBs.clear();
for (unsigned i = 0, e = BlockInfo.size(); i != e; ++i) {
- SymbolTable &ST = BlockInfo[i].first->getValueSymbolTable();
- SymbolTable::plane_iterator PI = ST.find(Type::LabelTy);
- if (PI != ST.plane_end() && PI->second.count(BlockInfo[i].second))
- BBs.push_back(cast<BasicBlock>(PI->second[BlockInfo[i].second]));
+ ValueSymbolTable &ST = BlockInfo[i].first->getValueSymbolTable();
+ Value* V = ST.lookup(BlockInfo[i].second);
+ if (V && V->getType() == Type::LabelTy)
+ BBs.push_back(cast<BasicBlock>(V));
}
return true;
}
diff --git a/tools/bugpoint/ExtractFunction.cpp b/tools/bugpoint/ExtractFunction.cpp
index b9d43e8..1ff06f8 100644
--- a/tools/bugpoint/ExtractFunction.cpp
+++ b/tools/bugpoint/ExtractFunction.cpp
@@ -110,7 +110,6 @@ Module *BugDriver::performFinalCleanups(Module *M, bool MayModifySemantics) {
I->setLinkage(GlobalValue::ExternalLinkage);
std::vector<const PassInfo*> CleanupPasses;
- CleanupPasses.push_back(getPI(createFunctionResolvingPass()));
CleanupPasses.push_back(getPI(createGlobalDCEPass()));
CleanupPasses.push_back(getPI(createDeadTypeEliminationPass()));
@@ -221,7 +220,7 @@ static void SplitStaticCtorDtor(const char *GlobalName, Module *M1, Module *M2){
M1Tors.push_back(std::make_pair(F, Priority));
else {
// Map to M2's version of the function.
- F = M2->getFunction(F->getName(), F->getFunctionType());
+ F = M2->getFunction(F->getName());
M2Tors.push_back(std::make_pair(F, Priority));
}
}
@@ -272,9 +271,10 @@ Module *llvm::SplitFunctionsOutOfModule(Module *M,
std::set<std::pair<std::string, const PointerType*> > TestFunctions;
for (unsigned i = 0, e = F.size(); i != e; ++i) {
TestFunctions.insert(std::make_pair(F[i]->getName(), F[i]->getType()));
- Function *TNOF = M->getFunction(F[i]->getName(), F[i]->getFunctionType());
- DEBUG(std::cerr << "Removing function " << F[i]->getName() << "\n");
+ Function *TNOF = M->getFunction(F[i]->getName());
assert(TNOF && "Function doesn't exist in module!");
+ assert(TNOF->getFunctionType() == F[i]->getFunctionType() && "wrong type?");
+ DEBUG(std::cerr << "Removing function " << F[i]->getName() << "\n");
DeleteFunctionBody(TNOF); // Function is now external in this module!
}
@@ -317,7 +317,7 @@ bool BlockExtractorPass::runOnModule(Module &M) {
Function *F = BB->getParent();
// Map the corresponding function in this module.
- Function *MF = M.getFunction(F->getName(), F->getFunctionType());
+ Function *MF = M.getFunction(F->getName());
// Figure out which index the basic block is in its function.
Function::iterator BBI = MF->begin();
diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp
index bdbd11b..38ccf0b 100644
--- a/tools/bugpoint/Miscompilation.cpp
+++ b/tools/bugpoint/Miscompilation.cpp
@@ -341,9 +341,11 @@ static bool ExtractLoops(BugDriver &BD,
// optimized and loop extracted module.
MiscompiledFunctions.clear();
for (unsigned i = 0, e = MisCompFunctions.size(); i != e; ++i) {
- Function *NewF = ToNotOptimize->getFunction(MisCompFunctions[i].first,
- MisCompFunctions[i].second);
+ Function *NewF = ToNotOptimize->getFunction(MisCompFunctions[i].first);
+
assert(NewF && "Function not found??");
+ assert(NewF->getFunctionType() == MisCompFunctions[i].second &&
+ "found wrong function type?");
MiscompiledFunctions.push_back(NewF);
}
@@ -479,9 +481,10 @@ static bool ExtractBlocks(BugDriver &BD,
MiscompiledFunctions.clear();
for (unsigned i = 0, e = MisCompFunctions.size(); i != e; ++i) {
- Function *NewF = ProgClone->getFunction(MisCompFunctions[i].first,
- MisCompFunctions[i].second);
+ Function *NewF = ProgClone->getFunction(MisCompFunctions[i].first);
assert(NewF && "Function not found??");
+ assert(NewF->getFunctionType() == MisCompFunctions[i].second &&
+ "Function has wrong type??");
MiscompiledFunctions.push_back(NewF);
}