Fix FastISel's bitcast code for the case where getRegForValue fails.
authorDan Gohman <gohman@apple.com>
Wed, 27 Aug 2008 20:41:38 +0000 (20:41 +0000)
committerDan Gohman <gohman@apple.com>
Wed, 27 Aug 2008 20:41:38 +0000 (20:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55431 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/FastISel.cpp

index 7d40405bd534e94cfb27296d7e07a41427506860..82eee56cd2b9d376b5b2ac22a3765b4968139fd4 100644 (file)
@@ -226,7 +226,10 @@ bool FastISel::SelectBitCast(Instruction *I,
                              DenseMap<const Value*, unsigned> &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;
   }