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

Dan Gohman gohman at apple.com
Thu Mar 5 15:20:46 PST 2009


Author: djg
Date: Thu Mar  5 17:20:46 2009
New Revision: 66216

URL: http://llvm.org/viewvc/llvm-project?rev=66216&view=rev
Log:
Fix a bugpoint bug on anonymous functions. Instead of looking up
functions in the new module by name, use the ValueMap provided by
CloneModule to do the lookups.

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=66216&r1=66215&r2=66216&view=diff

==============================================================================
--- llvm/trunk/tools/bugpoint/CrashDebugger.cpp (original)
+++ llvm/trunk/tools/bugpoint/CrashDebugger.cpp Thu Mar  5 17:20:46 2009
@@ -264,16 +264,18 @@
 
 bool ReduceCrashingBlocks::TestBlocks(std::vector<const BasicBlock*> &BBs) {
   // 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<BasicBlock*> Blocks;
   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());
+    Function *CMF = cast<Function>(ValueMap[F]);
     assert(CMF && "Function not in module?!");
     assert(CMF->getFunctionType() == F->getFunctionType() && "wrong type?");
+    assert(CMF->getName() == F->getName() && "wrong name?");
 
     // Get the mapped basic block...
     Function::iterator CBI = CMF->begin();





More information about the llvm-commits mailing list