RegisterCoalescer: Improve a comment.

Explain the relation of the example to the variables in the code,
explain what bad behaviour the code avoids in this case.

llvm-svn: 237706
This commit is contained in:
Matthias Braun 2015-05-19 17:52:32 +00:00
parent 3c9e370ec0
commit 7e10e53f14
1 changed files with 5 additions and 6 deletions

View File

@ -955,12 +955,11 @@ bool RegisterCoalescer::reMaterializeTrivialDef(const CoalescerPair &CP,
TII->reMaterialize(*MBB, MII, DstReg, SrcIdx, DefMI, *TRI);
MachineInstr *NewMI = std::prev(MII);
// A situation like the following:
// %vreg0:subX = instr ; DefMI
// %vregY = copy %vreg:subX ; CopyMI
// does not need subregisters/regclass widening after rematerialization, just
// do:
// %vregY = instr
// In a situation like the following:
// %vreg0:subreg = instr ; DefMI, subreg = DstIdx
// %vreg1 = copy %vreg0:subreg ; CopyMI, SrcIdx = 0
// instead of widening %vreg1 to the register class of %vreg0 simply do:
// %vreg1 = instr
const TargetRegisterClass *NewRC = CP.getNewRC();
if (DstIdx != 0) {
MachineOperand &DefMO = NewMI->getOperand(0);