adjust a couple xforms to work with null bb's in BlockAddress.

llvm-svn: 85680
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp
index 39331d7..7929eb9 100644
--- a/llvm/lib/Transforms/Utils/ValueMapper.cpp
+++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp
@@ -113,8 +113,13 @@
   
   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!");