Preserve <def,undef> flags in CoalesceExtSubRegs.

This won't have an effect until EliminateRegSequences() starts setting
the undef flags.

llvm-svn: 148779
This commit is contained in:
Jakob Stoklund Olesen 2012-01-24 04:44:01 +00:00
parent e4f3f102c2
commit c46534a0cd
1 changed files with 7 additions and 3 deletions

View File

@ -1728,7 +1728,9 @@ TwoAddressInstructionPass::CoalesceExtSubRegs(SmallVector<unsigned,4> &Srcs,
CanCoalesce = false; CanCoalesce = false;
break; break;
} }
// Keep track of one of the uses. // Keep track of one of the uses. Preferably the first one which has a
// <def,undef> flag.
if (!SomeMI || UseMI->getOperand(0).isUndef())
SomeMI = UseMI; SomeMI = UseMI;
} }
if (!CanCoalesce) if (!CanCoalesce)
@ -1738,7 +1740,9 @@ TwoAddressInstructionPass::CoalesceExtSubRegs(SmallVector<unsigned,4> &Srcs,
MachineInstr *CopyMI = BuildMI(*SomeMI->getParent(), SomeMI, MachineInstr *CopyMI = BuildMI(*SomeMI->getParent(), SomeMI,
SomeMI->getDebugLoc(), SomeMI->getDebugLoc(),
TII->get(TargetOpcode::COPY)) TII->get(TargetOpcode::COPY))
.addReg(DstReg, RegState::Define, NewDstSubIdx) .addReg(DstReg, RegState::Define |
getUndefRegState(SomeMI->getOperand(0).isUndef()),
NewDstSubIdx)
.addReg(SrcReg, 0, NewSrcSubIdx); .addReg(SrcReg, 0, NewSrcSubIdx);
// Remove all the old extract instructions. // Remove all the old extract instructions.