Skip to content

Commit 9e70dca

Browse files
- Added isSSA() assert to visitRegSequence
- Reworded comment above the FORM_TRANSPOSED_REG_TUPLE definitions
1 parent 02dc7a2 commit 9e70dca

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

llvm/lib/Target/AArch64/SMEInstrFormats.td

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@ let WantsRoot = true in
3636
def am_sme_indexed_b4 : ComplexPattern<iPTR, 2, "SelectAddrModeIndexedSVE<0, 15>">;
3737

3838
// The FORM_TRANSPOSED_REG_TUPLE pseudos defined below are intended to
39-
// improve register allocation for intrinsics which use strided and contiguous
40-
// multi-vector registers, avoiding unnecessary copies.
41-
// If the operands of the pseudo are copies where the source register is in
42-
// the StridedOrContiguous class, the pseudo is used to provide a hint to the
43-
// register allocator suggesting a contigious multi-vector register which
44-
// matches the subregister sequence used by the operands.
45-
// If the operands do not match this pattern, the pseudos are expanded
46-
// to a REG_SEQUENCE using the post-isel hook.
39+
// improve register allocation for intrinsics which use strided and
40+
// contiguous multi-vector registers, avoiding unnecessary copies.
41+
// The SMEPeepholeOpt pass will replace a REG_SEQUENCE instruction with the
42+
// FORM_TRANSPOSED_REG_TUPLE pseudo if the operands are copies where the
43+
// source register is in the StridedOrContiguous class. The operands in the
44+
// sequence must all have the same subreg index.
45+
// The pseudo is then used to provide a hint to the register allocator
46+
// suggesting a contigious multi-vector register which matches the
47+
// subregister sequence used by the operands.
4748

4849
def FORM_TRANSPOSED_REG_TUPLE_X2_PSEUDO :
4950
Pseudo<(outs ZPR2:$tup),

llvm/lib/Target/AArch64/SMEPeepholeOpt.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,9 @@ bool SMEPeepholeOpt::optimizeStartStopPairs(
242242
// -> %9:zpr2mul2 = FORM_TRANSPOSED_REG_TUPLE_X2_PSEUDO %5:zpr, %8:zpr
243243
//
244244
bool SMEPeepholeOpt::visitRegSequence(MachineInstr &MI) {
245-
MachineRegisterInfo &MRI = MI.getMF()->getRegInfo();
245+
assert(MF.getRegInfo().isSSA() && "Expected to be run on SSA form!");
246246

247+
MachineRegisterInfo &MRI = MI.getMF()->getRegInfo();
247248
switch (MRI.getRegClass(MI.getOperand(0).getReg())->getID()) {
248249
case AArch64::ZPR2RegClassID:
249250
case AArch64::ZPR4RegClassID:
@@ -264,9 +265,6 @@ bool SMEPeepholeOpt::visitRegSequence(MachineInstr &MI) {
264265
for (unsigned I = 1; I < MI.getNumOperands(); I += 2) {
265266
MachineOperand &MO = MI.getOperand(I);
266267

267-
if (!MI.getOperand(I).isReg())
268-
return false;
269-
270268
MachineOperand *Def = MRI.getOneDef(MO.getReg());
271269
if (!Def || !Def->getParent()->isCopy())
272270
return false;

0 commit comments

Comments
 (0)