With debug info, there are nameless constant global values. do not crash when we...
authorAndrew Lenharth <andrewl@lenharth.org>
Mon, 24 Mar 2008 22:16:14 +0000 (22:16 +0000)
committerAndrew Lenharth <andrewl@lenharth.org>
Mon, 24 Mar 2008 22:16:14 +0000 (22:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48749 91177308-0d34-0410-b5e6-96231b3b80d8

tools/bugpoint/CrashDebugger.cpp

index 2257873ac831f395f3faec247beb33f83d731493..419e1f19987dec81ca754fa65deaf607a24795ed 100644 (file)
@@ -125,13 +125,14 @@ bool
 ReduceCrashingGlobalVariables::TestGlobalVariables(
                               std::vector<GlobalVariable*>& GVs) {
   // 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<GlobalVariable*> GVSet;
 
   for (unsigned i = 0, e = GVs.size(); i != e; ++i) {
-    GlobalVariable* CMGV = M->getNamedGlobal(GVs[i]->getName());
+    GlobalVariable* CMGV = cast<GlobalVariable>(ValueMap[GVs[i]]);
     assert(CMGV && "Global Variable not in module?!");
     GVSet.insert(CMGV);
   }