Fixed a bug where we left a definition hanging
for a global variable that we had replaced with
a reference to a slot in the input array.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@118123 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/IRForTarget.cpp b/source/Expression/IRForTarget.cpp
index fbb2eda..d6d0586 100644
--- a/source/Expression/IRForTarget.cpp
+++ b/source/Expression/IRForTarget.cpp
@@ -1103,6 +1103,9 @@
UnfoldConstant(constant, bit_cast, first_entry_instruction);
else
value->replaceAllUsesWith(bit_cast);
+
+ if (GlobalVariable *var = dyn_cast<GlobalVariable>(value))
+ var->eraseFromParent();
}
if (log)