From 0e016fe31b5bbd01a11e60bde1bb296843c7030b Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Mon, 15 Jul 2013 23:31:47 +0000 Subject: Fixed a problem in IRForTarget where we would not delete a constant after we replaced it with a dynamically-computed value. Also ensured that we replace all users of the constant if there are multiple ones. Added a testcase. llvm-svn: 186363 --- lldb/source/Expression/IRForTarget.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lldb/source/Expression/IRForTarget.cpp') diff --git a/lldb/source/Expression/IRForTarget.cpp b/lldb/source/Expression/IRForTarget.cpp index 711943401db..dc27b65548e 100644 --- a/lldb/source/Expression/IRForTarget.cpp +++ b/lldb/source/Expression/IRForTarget.cpp @@ -2210,7 +2210,8 @@ IRForTarget::UnfoldConstant(Constant *old_constant, llvm::cast(entry_instruction_finder.GetValue(function))); }); - return UnfoldConstant(constant_expr, bit_cast_maker, entry_instruction_finder); + if (!UnfoldConstant(constant_expr, bit_cast_maker, entry_instruction_finder)) + return false; } break; case Instruction::GetElementPtr: @@ -2247,7 +2248,8 @@ IRForTarget::UnfoldConstant(Constant *old_constant, return GetElementPtrInst::Create(ptr, indices, "", llvm::cast(entry_instruction_finder.GetValue(function))); }); - return UnfoldConstant(constant_expr, get_element_pointer_maker, entry_instruction_finder); + if (!UnfoldConstant(constant_expr, get_element_pointer_maker, entry_instruction_finder)) + return false; } break; } @@ -2274,6 +2276,11 @@ IRForTarget::UnfoldConstant(Constant *old_constant, } } + if (!isa(old_constant)) + { + old_constant->destroyConstant(); + } + return true; } -- cgit v1.2.3