From ee8b951e73a9580ada11725ccd2e4f49e758b34f Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 29 Oct 2009 01:21:20 +0000 Subject: teach various passes about blockaddress. We no longer crash on any clang tests. llvm-svn: 85465 --- llvm/lib/Transforms/Utils/ValueMapper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Transforms/Utils/ValueMapper.cpp') diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp index 21126c9..39331d7 100644 --- a/llvm/lib/Transforms/Utils/ValueMapper.cpp +++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp @@ -113,8 +113,8 @@ Value *llvm::MapValue(const Value *V, ValueMapTy &VM) { if (BlockAddress *BA = dyn_cast(C)) { Function *F = cast(MapValue(BA->getFunction(), VM)); - BasicBlock *BB = cast(MapValue(BA->getBasicBlock(), VM)); - return VM[V] = BlockAddress::get(F, BB); + BasicBlock *BB = cast_or_null(MapValue(BA->getBasicBlock(),VM)); + return VM[V] = BlockAddress::get(F, BB ? BB : BA->getBasicBlock()); } llvm_unreachable("Unknown type of constant!"); -- cgit v1.1