Value *Val = getVal(Values, IBI->getAddress())->stripPointerCasts();
if (BlockAddress *BA = dyn_cast<BlockAddress>(Val))
NewBB = BA->getBasicBlock();
- else
- return false; // Cannot determine.
+ if (NewBB == 0) return false; // Cannot determine.
} else if (ReturnInst *RI = dyn_cast<ReturnInst>(CurInst)) {
if (RI->getNumOperands())
RetVal = getVal(Values, RI->getOperand(0));
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!");