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
This commit is contained in:
Chris Lattner
2009-10-29 01:21:20 +00:00
parent 78c5cdaf2a
commit 4c0236fd8b
3 changed files with 58 additions and 34 deletions

View File

@ -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!");