Preserve <def,undef> flags in CoalesceExtSubRegs.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148779 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen 2012-01-24 04:44:01 +00:00
parent 45bb5c5333
commit defe12df51

View File

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