From 777a7717ef2fd0ba274cfb34418f7fd9883c6bea Mon Sep 17 00:00:00 2001 From: Quentin Colombet Date: Tue, 12 Apr 2016 00:38:51 +0000 Subject: [PATCH] [RegBankSelect] Teach the repairing code how to handle physical registers. llvm-svn: 266029 --- llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp b/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp index 0e77828..f31b2cc 100644 --- a/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp +++ b/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp @@ -63,7 +63,10 @@ RegBankSelect::repairReg(unsigned Reg, assert(ValMapping.BreakDown.size() == 1 && "Support for complex break down not supported yet"); const RegisterBankInfo::PartialMapping &PartialMap = ValMapping.BreakDown[0]; - assert(PartialMap.Mask.getBitWidth() == MRI->getSize(Reg) && + assert(PartialMap.Mask.getBitWidth() == + (TargetRegisterInfo::isPhysicalRegister(Reg) + ? TRI->getMinimalPhysRegClass(Reg)->getSize() * 8 + : MRI->getSize(Reg)) && "Repairing other than copy not implemented yet"); // If the MIRBuilder is configured to insert somewhere else than // DefUseMI, we may not use this function like was it first @@ -207,7 +210,8 @@ void RegBankSelect::assignInstr(MachineInstr &MI) { // Therefore, create a new temporary for Reg. assert(ValMapping.BreakDown.size() == 1 && "Support for complex break down not supported yet"); - if (MRI->getRegClassOrRegBank(Reg)) { + if (TargetRegisterInfo::isPhysicalRegister(Reg) || + MRI->getRegClassOrRegBank(Reg)) { if (!MO.isDef() && MI.isPHI()) { // Phis are already copies, so there is nothing to repair. // Note: This will not hold when we support break downs with -- 2.7.4