diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2014-10-30 20:13:34 -0400 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2014-11-06 12:05:06 -0500 |
commit | fddaef18ace05c796d7655d558a437e1a533e4ea (patch) | |
tree | 2413de97ecc1d9968ea5c48775c67083ef6cef35 | |
parent | 9f44935ad573a87cb02d436969e93ca1c926f0d5 (diff) |
InstrEmitter: Set kill flag when creating a cross-class copy
-rw-r--r-- | lib/CodeGen/SelectionDAG/InstrEmitter.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/CodeGen/SelectionDAG/InstrEmitter.cpp b/lib/CodeGen/SelectionDAG/InstrEmitter.cpp index a65f33e1777..14647eb57f5 100644 --- a/lib/CodeGen/SelectionDAG/InstrEmitter.cpp +++ b/lib/CodeGen/SelectionDAG/InstrEmitter.cpp @@ -325,6 +325,18 @@ InstrEmitter::AddRegisterOperand(MachineInstrBuilder &MIB, bool isOptDef = IIOpNum < MCID.getNumOperands() && MCID.OpInfo[IIOpNum].isOptionalDef(); + // If this value has only one use, that use is a kill. This is a + // conservative approximation. InstrEmitter does trivial coalescing + // with CopyFromReg nodes, so don't emit kill flags for them. + // Avoid kill flags on Schedule cloned nodes, since there will be + // multiple uses. + // Tied operands are never killed, so we need to check that. And that + // means we need to determine the index of the operand. + bool isKill = Op.hasOneUse() && + Op.getNode()->getOpcode() != ISD::CopyFromReg && + !IsDebug && + !(IsClone || IsCloned); + // If the instruction requires a register in a different class, create // a new virtual register and copy the value into it, but first attempt to // shrink VReg's register class within reason. For example, if VReg == GR32 @@ -338,20 +350,10 @@ InstrEmitter::AddRegisterOperand(MachineInstrBuilder &MIB, BuildMI(*MBB, InsertPos, Op.getNode()->getDebugLoc(), TII->get(TargetOpcode::COPY), NewVReg).addReg(VReg); VReg = NewVReg; + isKill = true; } } - // If this value has only one use, that use is a kill. This is a - // conservative approximation. InstrEmitter does trivial coalescing - // with CopyFromReg nodes, so don't emit kill flags for them. - // Avoid kill flags on Schedule cloned nodes, since there will be - // multiple uses. - // Tied operands are never killed, so we need to check that. And that - // means we need to determine the index of the operand. - bool isKill = Op.hasOneUse() && - Op.getNode()->getOpcode() != ISD::CopyFromReg && - !IsDebug && - !(IsClone || IsCloned); if (isKill) { unsigned Idx = MIB->getNumOperands(); while (Idx > 0 && |