Skip to content

Commit e5650ce

Browse files
committed
Address review comments
1 parent de1ad82 commit e5650ce

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

llvm/test/Transforms/LoopStrengthReduce/AArch64/vscale-fixups.ll

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ define void @mulvl123_addressing(ptr %src, ptr %dst, i64 %count) #0 {
1919
; COMMON-NEXT: ldr z3, [x0, #3, mul vl]
2020
; COMMON-NEXT: addvl x0, x0, #5
2121
; COMMON-NEXT: umax z0.b, p0/m, z0.b, z1.b
22-
; COMMON-NEXT: movprfx z1, z2
23-
; COMMON-NEXT: umax z1.b, p0/m, z1.b, z3.b
24-
; COMMON-NEXT: umax z0.b, p0/m, z0.b, z1.b
22+
; COMMON-NEXT: umax z2.b, p0/m, z2.b, z3.b
23+
; COMMON-NEXT: umax z0.b, p0/m, z0.b, z2.b
2524
; COMMON-NEXT: st1b { z0.b }, p0, [x1, x8]
2625
; COMMON-NEXT: incb x8
2726
; COMMON-NEXT: cmp x8, x2

0 commit comments

Comments
 (0)