Fix a crash while promoting a value out of a loop from a global variable
authorChris Lattner <sabre@nondot.org>
Thu, 24 Mar 2005 04:22:04 +0000 (04:22 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 24 Mar 2005 04:22:04 +0000 (04:22 +0000)
when using ds-aa

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20802 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/DataStructure/BottomUpClosure.cpp
lib/Analysis/DataStructure/TopDownClosure.cpp

index 640463db301749647b719e5b69d5b0959974478c..5dcaa31dca243ee25a0a716692c73d09a559f22c 100644 (file)
@@ -527,5 +527,14 @@ void BUDataStructures::copyValue(Value *From, Value *To) {
     return;
   }
 
-  assert(!isa<GlobalVariable>(From) && "Do not know how to copy GV's yet!");
+  if (const Function *F = getFnForValue(To)) {
+    DSGraph &G = getDSGraph(*F);
+    G.getScalarMap().copyScalarIfExists(From, To);
+    return;
+  }
+
+  std::cerr << *From;
+  std::cerr << *To;
+  assert(0 && "Do not know how to copy this yet!");
+  abort();
 }
index 45b2f2b4d2df00225f01cb65c8fb87b6e230dad6..e44cea1d8e17dd9dbab7650559ae2004f58adf79 100644 (file)
@@ -468,5 +468,14 @@ void TDDataStructures::copyValue(Value *From, Value *To) {
     return;
   }
 
-  assert(!isa<GlobalVariable>(From) && "Do not know how to copy GV's yet!");
+  if (const Function *F = getFnForValue(To)) {
+    DSGraph &G = getDSGraph(*F);
+    G.getScalarMap().copyScalarIfExists(From, To);
+    return;
+  }
+
+  std::cerr << *From;
+  std::cerr << *To;
+  assert(0 && "Do not know how to copy this yet!");
+  abort();
 }