From a318dabc0edbcc7a2b54d99b026a093361ec14fc Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 27 Aug 2008 20:41:38 +0000 Subject: [PATCH] Fix FastISel's bitcast code for the case where getRegForValue fails. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55431 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/FastISel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; }