diff options
author | Chris Lattner <sabre@nondot.org> | 2009-10-31 20:08:37 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-10-31 20:08:37 +0000 |
commit | 7d83ebcadd725d050cc58962e9b7c4312d676e7f (patch) | |
tree | efdb3c359fa548ada932f522239be84ab602df20 /lib/VMCore/BasicBlock.cpp | |
parent | e3246fc6ab4ae7599fa1b7aa1b37107a843b2032 (diff) |
Make blockaddress(@func, null) be valid, and make 'deleting a basic
block with a blockaddress still referring to it' replace the invalid
blockaddress with a new blockaddress(@func, null) instead of a
inttoptr(1).
This changes the bitcode encoding format, and still needs codegen
support (this should produce a non-zero value, referring to the entry
block of the function would also be quite reasonable).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85678 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/BasicBlock.cpp')
-rw-r--r-- | lib/VMCore/BasicBlock.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp index 23d0557dc7..c609ef85eb 100644 --- a/lib/VMCore/BasicBlock.cpp +++ b/lib/VMCore/BasicBlock.cpp @@ -63,15 +63,13 @@ 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. There are no other possible uses at this point. + // nodes, replacing them with BlockAddress(F, NULL). 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(ConstantExpr::getIntToPtr(Replacement, - BA->getType())); + BA->replaceAllUsesWith(BlockAddress::get(BA->getFunction(), 0)); BA->destroyConstant(); } } |