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 | 3c89c53f35e89956be26c7b4c5163164b41e75e5 (patch) | |
tree | 9ed3e55826736be51103e4fa4219a745d3793180 /llvm/lib/Transforms/Utils/ValueMapper.cpp | |
parent | 0a65b636ce884c07094a110d478d58acc4b37800 (diff) | |
download | bcm5719-llvm-3c89c53f35e89956be26c7b4c5163164b41e75e5.tar.gz bcm5719-llvm-3c89c53f35e89956be26c7b4c5163164b41e75e5.zip |
adjust a couple xforms to work with null bb's in BlockAddress.
llvm-svn: 85680
Diffstat (limited to 'llvm/lib/Transforms/Utils/ValueMapper.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/ValueMapper.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp index 39331d78169..7929eb9ac2b 100644 --- a/llvm/lib/Transforms/Utils/ValueMapper.cpp +++ b/llvm/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!"); |