summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorKeno Fischer <kfischer@college.harvard.edu>2015-12-23 18:27:23 +0000
committerKeno Fischer <kfischer@college.harvard.edu>2015-12-23 18:27:23 +0000
commit9bc46b117b460d83565794e1b7bdc3196afee907 (patch)
tree0f43bbc095133062a2bbfe66078d628a48eb6d95 /llvm/lib
parent61ad8b3907e4812aa5fb76edb030ff384c889246 (diff)
downloadbcm5719-llvm-9bc46b117b460d83565794e1b7bdc3196afee907.tar.gz
bcm5719-llvm-9bc46b117b460d83565794e1b7bdc3196afee907.zip
[Function] Properly remove use when clearing personality
Summary: We need to actually remove the use of the personality function, otherwise we can run into trouble if we want to e.g. delete the personality function because ther's no way to get rid of its uses. Do this by resetting to ConstantPointerNull value that the operands are set to when first allocated. Reviewers: vsk, dexonsmith Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D15752 llvm-svn: 256345
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/Function.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index f5974a63f45..cfb40b19c73 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -942,8 +942,7 @@ Constant *Function::getPersonalityFn() const {
}
void Function::setPersonalityFn(Constant *Fn) {
- if (Fn)
- setHungoffOperand<0>(Fn);
+ setHungoffOperand<0>(Fn);
setValueSubclassDataBit(3, Fn != nullptr);
}
@@ -953,8 +952,7 @@ Constant *Function::getPrefixData() const {
}
void Function::setPrefixData(Constant *PrefixData) {
- if (PrefixData)
- setHungoffOperand<1>(PrefixData);
+ setHungoffOperand<1>(PrefixData);
setValueSubclassDataBit(1, PrefixData != nullptr);
}
@@ -964,8 +962,7 @@ Constant *Function::getPrologueData() const {
}
void Function::setPrologueData(Constant *PrologueData) {
- if (PrologueData)
- setHungoffOperand<2>(PrologueData);
+ setHungoffOperand<2>(PrologueData);
setValueSubclassDataBit(2, PrologueData != nullptr);
}
@@ -986,9 +983,13 @@ void Function::allocHungoffUselist() {
template <int Idx>
void Function::setHungoffOperand(Constant *C) {
- assert(C && "Cannot set hungoff operand to nullptr");
- allocHungoffUselist();
- Op<Idx>().set(C);
+ if (C) {
+ allocHungoffUselist();
+ Op<Idx>().set(C);
+ } else if (getNumOperands()) {
+ Op<Idx>().set(
+ ConstantPointerNull::get(Type::getInt1PtrTy(getContext(), 0)));
+ }
}
void Function::setValueSubclassDataBit(unsigned Bit, bool On) {
OpenPOWER on IntegriCloud