summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/IRForTarget.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2013-07-15 23:31:47 +0000
committerSean Callanan <scallanan@apple.com>2013-07-15 23:31:47 +0000
commit0e016fe31b5bbd01a11e60bde1bb296843c7030b (patch)
tree3b07b298d62c504054f7a07dac45d7f38dc867a7 /lldb/source/Expression/IRForTarget.cpp
parentea9f9e8e06a215496a02b7eef2df9e0c128834de (diff)
downloadbcm5719-llvm-0e016fe31b5bbd01a11e60bde1bb296843c7030b.tar.gz
bcm5719-llvm-0e016fe31b5bbd01a11e60bde1bb296843c7030b.zip
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. <rdar://problem/14379043> llvm-svn: 186363
Diffstat (limited to 'lldb/source/Expression/IRForTarget.cpp')
-rw-r--r--lldb/source/Expression/IRForTarget.cpp11
1 files changed, 9 insertions, 2 deletions
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<Instruction>(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<Instruction>(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<GlobalValue>(old_constant))
+ {
+ old_constant->destroyConstant();
+ }
+
return true;
}
OpenPOWER on IntegriCloud