diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp index 7d40405bd53..82eee56cd2b 100644 --- a/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -226,7 +226,10 @@ bool FastISel::SelectBitCast(Instruction *I, DenseMap &ValueMap) { // If the bitcast doesn't change the type, just use the operand value. if (I->getType() == I->getOperand(0)->getType()) { - ValueMap[I] = getRegForValue(I->getOperand(0), ValueMap); + unsigned Reg = getRegForValue(I->getOperand(0), ValueMap); + if (Reg == 0) + return false; + ValueMap[I] = Reg; return true; }