diff options
author | Chris Lattner <sabre@nondot.org> | 2009-10-29 01:21:20 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-10-29 01:21:20 +0000 |
commit | 4c0236fd8b94f9721bac8a66c3220e797310c593 (patch) | |
tree | d7367f0b61584a270684fb043f7026de15ffe85b /lib/Transforms/Utils/ValueMapper.cpp | |
parent | 78c5cdaf2a24c9d2b5c89fdb5d66fd6ca3b5654b (diff) |
teach various passes about blockaddress. We no longer
crash on any clang tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85465 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/ValueMapper.cpp')
-rw-r--r-- | lib/Transforms/Utils/ValueMapper.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Transforms/Utils/ValueMapper.cpp b/lib/Transforms/Utils/ValueMapper.cpp index 21126c94ae..39331d7816 100644 --- a/lib/Transforms/Utils/ValueMapper.cpp +++ b/lib/Transforms/Utils/ValueMapper.cpp @@ -113,8 +113,8 @@ 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<BasicBlock>(MapValue(BA->getBasicBlock(), VM)); - return VM[V] = BlockAddress::get(F, BB); + BasicBlock *BB = cast_or_null<BasicBlock>(MapValue(BA->getBasicBlock(),VM)); + return VM[V] = BlockAddress::get(F, BB ? BB : BA->getBasicBlock()); } llvm_unreachable("Unknown type of constant!"); |