@@ -1154,25 +1154,29 @@ bool AArch64RegisterInfo::getRegAllocationHints(
11541154
11551155 // For predicated SVE instructions where the inactive lanes are undef,
11561156 // pick a destination register that is not unique to avoid introducing
1157- // a movprfx to copy a unique register to the destination operand .
1157+ // a movprfx.
11581158 const TargetRegisterClass *RegRC = MRI.getRegClass (VirtReg);
1159- if (ST.isSVEorStreamingSVEAvailable () &&
1160- AArch64::ZPRRegClass.hasSubClassEq (RegRC)) {
1159+ if (AArch64::ZPRRegClass.hasSubClassEq (RegRC)) {
11611160 for (const MachineOperand &DefOp : MRI.def_operands (VirtReg)) {
11621161 const MachineInstr &Def = *DefOp.getParent ();
11631162 if (DefOp.isImplicit () ||
11641163 (TII->get (Def.getOpcode ()).TSFlags & AArch64::FalseLanesMask) !=
11651164 AArch64::FalseLanesUndef)
11661165 continue ;
11671166
1167+ unsigned InstFlags =
1168+ TII->get (AArch64::getSVEPseudoMap (Def.getOpcode ())).TSFlags ;
1169+
11681170 for (MCPhysReg R : Order) {
11691171 auto AddHintIfSuitable = [&](MCPhysReg R, const MachineOperand &MO) {
1172+ // R is a suitable register hint if there exists an operand for the
1173+ // instruction that is not yet allocated a register or if R matches
1174+ // one of the other source operands.
11701175 if (!VRM->hasPhys (MO.getReg ()) || VRM->getPhys (MO.getReg ()) == R)
11711176 Hints.push_back (R);
11721177 };
11731178
1174- unsigned Opcode = AArch64::getSVEPseudoMap (Def.getOpcode ());
1175- switch (TII->get (Opcode).TSFlags & AArch64::DestructiveInstTypeMask) {
1179+ switch (InstFlags & AArch64::DestructiveInstTypeMask) {
11761180 default :
11771181 break ;
11781182 case AArch64::DestructiveTernaryCommWithRev:
@@ -1187,8 +1191,6 @@ bool AArch64RegisterInfo::getRegAllocationHints(
11871191 break ;
11881192 case AArch64::DestructiveBinary:
11891193 case AArch64::DestructiveBinaryImm:
1190- case AArch64::DestructiveUnaryPassthru:
1191- case AArch64::Destructive2xRegImmUnpred:
11921194 AddHintIfSuitable (R, Def.getOperand (2 ));
11931195 break ;
11941196 }
0 commit comments