Use KILL instead of IMPLICIT_DEF in LowerSubregs pass.

llvm-svn: 83007
This commit is contained in:
Jakob Stoklund Olesen 2009-09-28 20:32:46 +00:00
parent dc9efe8078
commit 0bb5af345a
2 changed files with 13 additions and 14 deletions

View File

@ -126,11 +126,10 @@ bool LowerSubregsInstructionPass::LowerExtract(MachineInstr *MI) {
if (SrcReg == DstReg) { if (SrcReg == DstReg) {
// No need to insert an identity copy instruction. // No need to insert an identity copy instruction.
if (MI->getOperand(1).isKill()) { if (MI->getOperand(1).isKill()) {
// We must make sure the super-register gets killed.Replace the // We must make sure the super-register gets killed. Replace the
// instruction with IMPLICIT_DEF. // instruction with KILL.
MI->setDesc(TII.get(TargetInstrInfo::IMPLICIT_DEF)); MI->setDesc(TII.get(TargetInstrInfo::KILL));
MI->RemoveOperand(2); // SubIdx MI->RemoveOperand(2); // SubIdx
MI->getOperand(1).setImplicit(true);
DEBUG(errs() << "subreg: replace by: " << *MI); DEBUG(errs() << "subreg: replace by: " << *MI);
return true; return true;
} }
@ -243,14 +242,14 @@ bool LowerSubregsInstructionPass::LowerInsert(MachineInstr *MI) {
if (DstSubReg == InsReg) { if (DstSubReg == InsReg) {
// No need to insert an identity copy instruction. If the SrcReg was // No need to insert an identity copy instruction. If the SrcReg was
// <undef>, we need to make sure it is alive by inserting an IMPLICIT_DEF // <undef>, we need to make sure it is alive by inserting a KILL
if (MI->getOperand(1).isUndef() && !MI->getOperand(0).isDead()) { if (MI->getOperand(1).isUndef() && !MI->getOperand(0).isDead()) {
MachineInstrBuilder MIB = BuildMI(*MBB, MI, MI->getDebugLoc(), MachineInstrBuilder MIB = BuildMI(*MBB, MI, MI->getDebugLoc(),
TII.get(TargetInstrInfo::IMPLICIT_DEF), DstReg); TII.get(TargetInstrInfo::KILL), DstReg);
if (MI->getOperand(2).isUndef()) if (MI->getOperand(2).isUndef())
MIB.addReg(InsReg, RegState::Implicit | RegState::Undef); MIB.addReg(InsReg, RegState::Undef);
else else
MIB.addReg(InsReg, RegState::ImplicitKill); MIB.addReg(InsReg, RegState::Kill);
} else { } else {
DEBUG(errs() << "subreg: eliminated!\n"); DEBUG(errs() << "subreg: eliminated!\n");
MBB->erase(MI); MBB->erase(MI);
@ -261,10 +260,10 @@ bool LowerSubregsInstructionPass::LowerInsert(MachineInstr *MI) {
const TargetRegisterClass *TRC0= TRI.getPhysicalRegisterRegClass(DstSubReg); const TargetRegisterClass *TRC0= TRI.getPhysicalRegisterRegClass(DstSubReg);
const TargetRegisterClass *TRC1= TRI.getPhysicalRegisterRegClass(InsReg); const TargetRegisterClass *TRC1= TRI.getPhysicalRegisterRegClass(InsReg);
if (MI->getOperand(2).isUndef()) if (MI->getOperand(2).isUndef())
// If the source register being inserted is undef, then this becomes an // If the source register being inserted is undef, then this becomes a
// implicit_def. // KILL.
BuildMI(*MBB, MI, MI->getDebugLoc(), BuildMI(*MBB, MI, MI->getDebugLoc(),
TII.get(TargetInstrInfo::IMPLICIT_DEF), DstSubReg); TII.get(TargetInstrInfo::KILL), DstSubReg);
else else
TII.copyRegToReg(*MBB, MI, DstSubReg, InsReg, TRC0, TRC1); TII.copyRegToReg(*MBB, MI, DstSubReg, InsReg, TRC0, TRC1);
MachineBasicBlock::iterator CopyMI = MI; MachineBasicBlock::iterator CopyMI = MI;

View File

@ -655,11 +655,11 @@ bool SchedulePostRATDList::BreakAntiDependencies() {
I != E; --Count) { I != E; --Count) {
MachineInstr *MI = --I; MachineInstr *MI = --I;
// After regalloc, IMPLICIT_DEF instructions aren't safe to treat as // After regalloc, KILL instructions aren't safe to treat as
// dependence-breaking. In the case of an INSERT_SUBREG, the IMPLICIT_DEF // dependence-breaking. In the case of an INSERT_SUBREG, the KILL
// is left behind appearing to clobber the super-register, while the // is left behind appearing to clobber the super-register, while the
// subregister needs to remain live. So we just ignore them. // subregister needs to remain live. So we just ignore them.
if (MI->getOpcode() == TargetInstrInfo::IMPLICIT_DEF) if (MI->getOpcode() == TargetInstrInfo::KILL)
continue; continue;
// Check if this instruction has a dependence on the critical path that // Check if this instruction has a dependence on the critical path that