From 7e10e53f1490e42b8730e8567ed668955d858123 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Tue, 19 May 2015 17:52:32 +0000 Subject: [PATCH] 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 --- llvm/lib/CodeGen/RegisterCoalescer.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/llvm/lib/CodeGen/RegisterCoalescer.cpp b/llvm/lib/CodeGen/RegisterCoalescer.cpp index c2d1620c5524..9c3d075ff0f6 100644 --- a/llvm/lib/CodeGen/RegisterCoalescer.cpp +++ b/llvm/lib/CodeGen/RegisterCoalescer.cpp @@ -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);