[SDAG] Ignore chain operand in REG_SEQUENCE when emitting instructions
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>
Fri, 14 Dec 2018 20:14:12 +0000 (20:14 +0000)
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>
Fri, 14 Dec 2018 20:14:12 +0000 (20:14 +0000)
llvm-svn: 349186

llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp

index b51c23c..da6d973 100644 (file)
@@ -652,6 +652,10 @@ void InstrEmitter::EmitRegSequence(SDNode *Node,
   const MCInstrDesc &II = TII->get(TargetOpcode::REG_SEQUENCE);
   MachineInstrBuilder MIB = BuildMI(*MF, Node->getDebugLoc(), II, NewVReg);
   unsigned NumOps = Node->getNumOperands();
+  // REG_SEQUENCE can "inherit" a chain from a subnode.
+  if (NumOps && Node->getOperand(NumOps-1).getValueType() == MVT::Other)
+    --NumOps; // Ignore chain if it exists.
+
   assert((NumOps & 1) == 1 &&
          "REG_SEQUENCE must have an odd number of operands!");
   for (unsigned i = 1; i != NumOps; ++i) {