Don't crash when a glue node contains an internal CopyToReg
[oota-llvm.git] / lib / CodeGen / SelectionDAG / InstrEmitter.cpp
index 3f4f9e2625478601c86436e7b1966312da5fbb9e..1467d887789c775a57993dadf27f24f718151193 100644 (file)
@@ -766,6 +766,9 @@ EmitMachineNode(SDNode *Node, bool IsClone, bool IsCloned,
       if (F->getOpcode() == ISD::CopyFromReg) {
         UsedRegs.push_back(cast<RegisterSDNode>(F->getOperand(1))->getReg());
         continue;
+      } else if (F->getOpcode() == ISD::CopyToReg) {
+        // Skip CopyToReg nodes that are internal to the glue chain.
+        continue;
       }
       // Collect declared implicit uses.
       const MCInstrDesc &MCID = TII->get(F->getMachineOpcode());