Changes in directory llvm/tools/bugpoint:
CrashDebugger.cpp updated: 1.55 -> 1.56 ExtractFunction.cpp updated: 1.57 -> 1.58 Miscompilation.cpp updated: 1.85 -> 1.86 --- Log message: For PR411: http://llvm.org/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. --- Diffs of the changes: (+21 -17) CrashDebugger.cpp | 17 +++++++++-------- ExtractFunction.cpp | 10 +++++----- Miscompilation.cpp | 11 +++++++---- 3 files changed, 21 insertions(+), 17 deletions(-) Index: llvm/tools/bugpoint/CrashDebugger.cpp diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.55 llvm/tools/bugpoint/CrashDebugger.cpp:1.56 --- llvm/tools/bugpoint/CrashDebugger.cpp:1.55 Tue Jan 30 14:08:38 2007 +++ llvm/tools/bugpoint/CrashDebugger.cpp Mon Feb 5 14:47:21 2007 @@ -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 @@ // 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 @@ 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 @@ // 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; } Index: llvm/tools/bugpoint/ExtractFunction.cpp diff -u llvm/tools/bugpoint/ExtractFunction.cpp:1.57 llvm/tools/bugpoint/ExtractFunction.cpp:1.58 --- llvm/tools/bugpoint/ExtractFunction.cpp:1.57 Tue Jan 30 14:08:38 2007 +++ llvm/tools/bugpoint/ExtractFunction.cpp Mon Feb 5 14:47:21 2007 @@ -110,7 +110,6 @@ 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 @@ 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 @@ 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 @@ 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(); Index: llvm/tools/bugpoint/Miscompilation.cpp diff -u llvm/tools/bugpoint/Miscompilation.cpp:1.85 llvm/tools/bugpoint/Miscompilation.cpp:1.86 --- llvm/tools/bugpoint/Miscompilation.cpp:1.85 Tue Jan 30 14:08:38 2007 +++ llvm/tools/bugpoint/Miscompilation.cpp Mon Feb 5 14:47:21 2007 @@ -341,9 +341,11 @@ // 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 @@ 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); } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits