From 55334fc45c27c55de61d895e4ec704f0727ebb46 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 30 Aug 2005 01:57:23 +0000 Subject: [PATCH] Handle CopyToReg nodes with flag operands correctly git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23144 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/ScheduleDAG.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp index af751edcbf5..8fac71c372c 100644 --- a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp +++ b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp @@ -205,8 +205,13 @@ unsigned SimpleSched::Emit(SDOperand Op) { Emit(Op.getOperand(i)); break; case ISD::CopyToReg: { - Emit(Op.getOperand(0)); // Emit the chain. + SDOperand ChainOp; + if (Op.getNumOperands() == 4) + ChainOp = Op.getOperand(3); + if (Op.getOperand(0).Val != ChainOp.Val) + Emit(Op.getOperand(0)); // Emit the chain. unsigned Val = Emit(Op.getOperand(2)); + if (ChainOp.Val) Emit(ChainOp); MRI.copyRegToReg(*BB, BB->end(), cast(Op.getOperand(1))->getReg(), Val, RegMap->getRegClass(Val));