From f6dd0eb5c4a1c4824d7f83fa39586478da618ffd Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 6 Mar 2009 02:16:23 +0000 Subject: [PATCH] Use CloneModule's ValueMap to avoid needing to look up functions by name. This fixes PR718. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66239 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/bugpoint/CrashDebugger.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/bugpoint/CrashDebugger.cpp b/tools/bugpoint/CrashDebugger.cpp index c290042d4c8..ba12621ad93 100644 --- a/tools/bugpoint/CrashDebugger.cpp +++ b/tools/bugpoint/CrashDebugger.cpp @@ -198,17 +198,16 @@ bool ReduceCrashingFunctions::TestFuncs(std::vector &Funcs) { return false; // Clone the program to try hacking it apart... - Module *M = CloneModule(BD.getProgram()); + DenseMap ValueMap; + Module *M = CloneModule(BD.getProgram(), ValueMap); // Convert list to set for fast lookup... std::set 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(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); }