aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-11-01 01:27:45 +0000
committerChris Lattner <sabre@nondot.org>2009-11-01 01:27:45 +0000
commit620cead9d0a40e874503c5605952c40186d585f0 (patch)
treed726a0bce552dab388c526c707aa0b88455241e5 /lib/VMCore
parent538da74ec2d9bb494a7704e195515c8be8b5b373 (diff)
downloadexternal_llvm-620cead9d0a40e874503c5605952c40186d585f0.zip
external_llvm-620cead9d0a40e874503c5605952c40186d585f0.tar.gz
external_llvm-620cead9d0a40e874503c5605952c40186d585f0.tar.bz2
Revert 85678/85680. The decision is to stay with the current form of
indirectbr, thus we don't need "blockaddr(@func, null)". Eliminate it for simplicity. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85699 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/AsmWriter.cpp5
-rw-r--r--lib/VMCore/BasicBlock.cpp8
-rw-r--r--lib/VMCore/Constants.cpp5
3 files changed, 8 insertions, 10 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index df1d19b..9a803a1 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -1065,10 +1065,7 @@ static void WriteConstantInt(raw_ostream &Out, const Constant *CV,
Out << "blockaddress(";
WriteAsOperandInternal(Out, BA->getFunction(), &TypePrinter, Machine);
Out << ", ";
- if (BA->getBasicBlock())
- WriteAsOperandInternal(Out, BA->getBasicBlock(), &TypePrinter, Machine);
- else
- Out << "null";
+ WriteAsOperandInternal(Out, BA->getBasicBlock(), &TypePrinter, Machine);
Out << ")";
return;
}
diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp
index c609ef8..23d0557 100644
--- a/lib/VMCore/BasicBlock.cpp
+++ b/lib/VMCore/BasicBlock.cpp
@@ -63,13 +63,15 @@ BasicBlock::~BasicBlock() {
// hanging off the block, or an undefined use of the block (source code
// expecting the address of a label to keep the block alive even though there
// is no indirect branch). Handle these cases by zapping the BlockAddress
- // nodes, replacing them with BlockAddress(F, NULL). There are no other
- // possible uses at this point.
+ // nodes. There are no other possible uses at this point.
if (hasAddressTaken()) {
assert(!use_empty() && "There should be at least one blockaddress!");
+ Constant *Replacement =
+ ConstantInt::get(llvm::Type::getInt32Ty(getContext()), 1);
while (!use_empty()) {
BlockAddress *BA = cast<BlockAddress>(use_back());
- BA->replaceAllUsesWith(BlockAddress::get(BA->getFunction(), 0));
+ BA->replaceAllUsesWith(ConstantExpr::getIntToPtr(Replacement,
+ BA->getType()));
BA->destroyConstant();
}
}
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index e0adf9d..2d3d71b 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -1045,7 +1045,7 @@ BlockAddress::BlockAddress(Function *F, BasicBlock *BB)
&Op<0>(), 2) {
Op<0>() = F;
Op<1>() = BB;
- if (BB) BB->AdjustBlockAddressRefCount(1);
+ BB->AdjustBlockAddressRefCount(1);
}
@@ -1054,8 +1054,7 @@ BlockAddress::BlockAddress(Function *F, BasicBlock *BB)
void BlockAddress::destroyConstant() {
getFunction()->getType()->getContext().pImpl
->BlockAddresses.erase(std::make_pair(getFunction(), getBasicBlock()));
- if (BasicBlock *BB = getBasicBlock())
- BB->AdjustBlockAddressRefCount(-1);
+ getBasicBlock()->AdjustBlockAddressRefCount(-1);
destroyConstantImpl();
}