diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -1394,6 +1394,17 @@ SDValue &N = NodeMap[V]; if (N.getNode()) return N; + // Special handling BitCastInst with a constant. + if (const BitCastInst *I = dyn_cast(V)) { + if (const Constant *C = dyn_cast(I->getOperand(0))) { + visitBitCast(*I); + SDValue &N = NodeMap[V]; + assert(N.getNode()); + resolveDanglingDebugInfo(V, N); + return N; + } + } + // If there's a virtual register allocated and initialized for this // value, use it. if (SDValue copyFromReg = getCopyFromRegs(V, V->getType()))