[llvm-commits] [llvm] r66239 - /llvm/trunk/tools/bugpoint/CrashDebugger.cpp

Dan Gohman gohman at apple.com
Thu Mar 5 18:16:23 PST 2009


Author: djg
Date: Thu Mar  5 20:16:23 2009
New Revision: 66239

URL: http://llvm.org/viewvc/llvm-project?rev=66239&view=rev
Log:
Use CloneModule's ValueMap to avoid needing to look up
functions by name. This fixes PR718.

Modified:
    llvm/trunk/tools/bugpoint/CrashDebugger.cpp

Modified: llvm/trunk/tools/bugpoint/CrashDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/CrashDebugger.cpp?rev=66239&r1=66238&r2=66239&view=diff

==============================================================================
--- llvm/trunk/tools/bugpoint/CrashDebugger.cpp (original)
+++ llvm/trunk/tools/bugpoint/CrashDebugger.cpp Thu Mar  5 20:16:23 2009
@@ -198,17 +198,16 @@
     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);
   }
 





More information about the llvm-commits mailing list