[llvm] r315823 - Revert "[AArch64][RegisterBankInfo] Use the statically computed mappings for COPY"
Bruno Cardoso Lopes via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 14 12:31:03 PDT 2017
Author: bruno
Date: Sat Oct 14 12:31:03 2017
New Revision: 315823
URL: http://llvm.org/viewvc/llvm-project?rev=315823&view=rev
Log:
Revert "[AArch64][RegisterBankInfo] Use the statically computed mappings for COPY"
This reverts commit r315781, breaks:
http://green.lab.llvm.org/green/job/Compiler_Verifiers_GlobalISEL/9882
Modified:
llvm/trunk/lib/Target/AArch64/AArch64RegisterBankInfo.cpp
Modified: llvm/trunk/lib/Target/AArch64/AArch64RegisterBankInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64RegisterBankInfo.cpp?rev=315823&r1=315822&r2=315823&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64RegisterBankInfo.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64RegisterBankInfo.cpp Sat Oct 14 12:31:03 2017
@@ -415,10 +415,12 @@ AArch64RegisterBankInfo::getSameKindOfOp
const RegisterBankInfo::InstructionMapping &
AArch64RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
const unsigned Opc = MI.getOpcode();
+ const MachineFunction &MF = *MI.getParent()->getParent();
+ const MachineRegisterInfo &MRI = MF.getRegInfo();
// Try the default logic for non-generic instructions that are either copies
// or already have some operands assigned to banks.
- if ((Opc != TargetOpcode::COPY && !isPreISelGenericOpcode(Opc)) ||
+ if (!isPreISelGenericOpcode(Opc) ||
Opc == TargetOpcode::G_PHI) {
const RegisterBankInfo::InstructionMapping &Mapping =
getInstrMappingImpl(MI);
@@ -426,11 +428,6 @@ AArch64RegisterBankInfo::getInstrMapping
return Mapping;
}
- const MachineFunction &MF = *MI.getParent()->getParent();
- const MachineRegisterInfo &MRI = MF.getRegInfo();
- const TargetSubtargetInfo &STI = MF.getSubtarget();
- const TargetRegisterInfo &TRI = *STI.getRegisterInfo();
-
switch (Opc) {
// G_{F|S|U}REM are not listed because they are not legal.
// Arithmetic ops.
@@ -454,30 +451,6 @@ AArch64RegisterBankInfo::getInstrMapping
case TargetOpcode::G_FMUL:
case TargetOpcode::G_FDIV:
return getSameKindOfOperandsMapping(MI);
- case TargetOpcode::COPY: {
- unsigned DstReg = MI.getOperand(0).getReg();
- unsigned SrcReg = MI.getOperand(1).getReg();
- if (TargetRegisterInfo::isPhysicalRegister(DstReg) ||
- TargetRegisterInfo::isPhysicalRegister(SrcReg)) {
- const RegisterBank *DstRB = getRegBank(DstReg, MRI, TRI);
- const RegisterBank *SrcRB = getRegBank(SrcReg, MRI, TRI);
- if (!DstRB)
- DstRB = SrcRB;
- else if (!SrcRB)
- SrcRB = DstRB;
- // If both RB are null that means both registers are generic.
- // We shouldn't be here.
- assert(DstRB && SrcRB && "Both RegBank were nullptr");
- unsigned Size = getSizeInBits(DstReg, MRI, TRI);
- return getInstructionMapping(
- DefaultMappingID, copyCost(*DstRB, *SrcRB, Size),
- getCopyMapping(DstRB->getID(), SrcRB->getID(), Size),
- // We only care about the mapping of the destination.
- /*NumOperands*/ 1);
- }
- // Both registers are generic, use G_BITCAST.
- LLVM_FALLTHROUGH;
- }
case TargetOpcode::G_BITCAST: {
LLT DstTy = MRI.getType(MI.getOperand(0).getReg());
LLT SrcTy = MRI.getType(MI.getOperand(1).getReg());
@@ -491,8 +464,7 @@ AArch64RegisterBankInfo::getInstrMapping
return getInstructionMapping(
DefaultMappingID, copyCost(DstRB, SrcRB, Size),
getCopyMapping(DstRB.getID(), SrcRB.getID(), Size),
- // We only care about the mapping of the destination for COPY.
- /*NumOperands*/ Opc == TargetOpcode::G_BITCAST ? 2 : 1);
+ /*NumOperands*/ 2);
}
default:
break;
More information about the llvm-commits
mailing list