diff options
author | Chris Lattner <sabre@nondot.org> | 2009-10-31 20:13:24 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-10-31 20:13:24 +0000 |
commit | 4200f2c815159e939351d5d447f7f68fb557e600 (patch) | |
tree | fc2ae649b0f036d8ad53661a318ae6e9bc43d57f /lib/Transforms/Utils/ValueMapper.cpp | |
parent | 7bc5f36e65090bc44026333e2966b720d0747a0d (diff) | |
download | external_llvm-4200f2c815159e939351d5d447f7f68fb557e600.zip external_llvm-4200f2c815159e939351d5d447f7f68fb557e600.tar.gz external_llvm-4200f2c815159e939351d5d447f7f68fb557e600.tar.bz2 |
adjust a couple xforms to work with null bb's in BlockAddress.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85680 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/ValueMapper.cpp')
-rw-r--r-- | lib/Transforms/Utils/ValueMapper.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Transforms/Utils/ValueMapper.cpp b/lib/Transforms/Utils/ValueMapper.cpp index 39331d7..7929eb9 100644 --- a/lib/Transforms/Utils/ValueMapper.cpp +++ b/lib/Transforms/Utils/ValueMapper.cpp @@ -113,8 +113,13 @@ Value *llvm::MapValue(const Value *V, ValueMapTy &VM) { if (BlockAddress *BA = dyn_cast<BlockAddress>(C)) { Function *F = cast<Function>(MapValue(BA->getFunction(), VM)); - BasicBlock *BB = cast_or_null<BasicBlock>(MapValue(BA->getBasicBlock(),VM)); - return VM[V] = BlockAddress::get(F, BB ? BB : BA->getBasicBlock()); + BasicBlock *BB = 0; + if (BA->getBasicBlock()) { + BB = cast_or_null<BasicBlock>(MapValue(BA->getBasicBlock(),VM)); + BB = BB ? BB : BA->getBasicBlock(); + } + + return VM[V] = BlockAddress::get(F, BB); } llvm_unreachable("Unknown type of constant!"); |