Use CloneModule's ValueMap to avoid needing to look up

functions by name. This fixes PR718.

llvm-svn: 66239
This commit is contained in:
Dan Gohman 2009-03-06 02:16:23 +00:00
parent 87ceb6e41b
commit 5487f51dbf

View File

@ -198,17 +198,16 @@ bool ReduceCrashingFunctions::TestFuncs(std::vector<Function*> &Funcs) {
return false;
// Clone the program to try hacking it apart...
Module *M = CloneModule(BD.getProgram());
DenseMap<const Value*, Value*> ValueMap;
Module *M = CloneModule(BD.getProgram(), ValueMap);
// Convert list to set for fast lookup...
std::set<Function*> Functions;
for (unsigned i = 0, e = Funcs.size(); i != e; ++i) {
// 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());
Function *CMF = cast<Function>(ValueMap[Funcs[i]]);
assert(CMF && "Function not in module?!");
assert(CMF->getFunctionType() == Funcs[i]->getFunctionType() && "wrong ty");
assert(CMF->getName() == Funcs[i]->getName() && "wrong name");
Functions.insert(CMF);
}