Skip to content

Commit e1e7e4a

Browse files
committed
Rename MI1/2 to Root/Prev in areRVVInstsReassociable
1 parent 8ec22b0 commit e1e7e4a

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfo.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,30 +1677,30 @@ bool RISCVInstrInfo::isVectorAssociativeAndCommutative(const MachineInstr &Inst,
16771677
#undef OPCODE_LMUL_CASE
16781678
}
16791679

1680-
bool RISCVInstrInfo::areRVVInstsReassociable(const MachineInstr &MI1,
1681-
const MachineInstr &MI2) const {
1682-
if (!areOpcodesEqualOrInverse(MI1.getOpcode(), MI2.getOpcode()))
1680+
bool RISCVInstrInfo::areRVVInstsReassociable(const MachineInstr &Root,
1681+
const MachineInstr &Prev) const {
1682+
if (!areOpcodesEqualOrInverse(Root.getOpcode(), Prev.getOpcode()))
16831683
return false;
16841684

1685-
assert(MI1.getMF() == MI2.getMF());
1686-
const MachineRegisterInfo *MRI = &MI1.getMF()->getRegInfo();
1685+
assert(Root.getMF() == Prev.getMF());
1686+
const MachineRegisterInfo *MRI = &Root.getMF()->getRegInfo();
16871687
const TargetRegisterInfo *TRI = MRI->getTargetRegisterInfo();
16881688

16891689
// Make sure vtype operands are also the same.
1690-
const MCInstrDesc &Desc = get(MI1.getOpcode());
1690+
const MCInstrDesc &Desc = get(Root.getOpcode());
16911691
const uint64_t TSFlags = Desc.TSFlags;
16921692

16931693
auto checkImmOperand = [&](unsigned OpIdx) {
1694-
return MI1.getOperand(OpIdx).getImm() == MI2.getOperand(OpIdx).getImm();
1694+
return Root.getOperand(OpIdx).getImm() == Prev.getOperand(OpIdx).getImm();
16951695
};
16961696

16971697
auto checkRegOperand = [&](unsigned OpIdx) {
1698-
return MI1.getOperand(OpIdx).getReg() == MI2.getOperand(OpIdx).getReg();
1698+
return Root.getOperand(OpIdx).getReg() == Prev.getOperand(OpIdx).getReg();
16991699
};
17001700

17011701
// PassThru
1702-
// TODO: Potentially we can loosen the condition to consider Root (MI1) to be
1703-
// associable with Prev (MI2) if Root has NoReg as passthru. In which case we
1702+
// TODO: Potentially we can loosen the condition to consider Root to be
1703+
// associable with Prev if Root has NoReg as passthru. In which case we
17041704
// also need to loosen the condition on vector policies between these.
17051705
if (!checkRegOperand(1))
17061706
return false;
@@ -1712,17 +1712,17 @@ bool RISCVInstrInfo::areRVVInstsReassociable(const MachineInstr &MI1,
17121712

17131713
// Mask
17141714
if (RISCVII::usesMaskPolicy(TSFlags)) {
1715-
const MachineBasicBlock *MBB = MI1.getParent();
1716-
const MachineBasicBlock::const_reverse_iterator It1(&MI1);
1717-
const MachineBasicBlock::const_reverse_iterator It2(&MI2);
1715+
const MachineBasicBlock *MBB = Root.getParent();
1716+
const MachineBasicBlock::const_reverse_iterator It1(&Root);
1717+
const MachineBasicBlock::const_reverse_iterator It2(&Prev);
17181718
Register MI1VReg;
17191719

17201720
bool SeenMI2 = false;
17211721
for (auto End = MBB->rend(), It = It1; It != End; ++It) {
17221722
if (It == It2) {
17231723
SeenMI2 = true;
17241724
if (!MI1VReg.isValid())
1725-
// There is no V0 def between MI1 and MI2; they're sharing the
1725+
// There is no V0 def between Root and Prev; they're sharing the
17261726
// same V0.
17271727
break;
17281728
}
@@ -1735,7 +1735,7 @@ bool RISCVInstrInfo::areRVVInstsReassociable(const MachineInstr &MI1,
17351735
return false;
17361736

17371737
if (!MI1VReg.isValid()) {
1738-
// This is the V0 def for MI1.
1738+
// This is the V0 def for Root.
17391739
MI1VReg = SrcReg;
17401740
continue;
17411741
}
@@ -1744,18 +1744,18 @@ bool RISCVInstrInfo::areRVVInstsReassociable(const MachineInstr &MI1,
17441744
if (!SeenMI2)
17451745
continue;
17461746

1747-
// This is the V0 def for MI2; check if it's the same as that of
1748-
// MI1.
1747+
// This is the V0 def for Prev; check if it's the same as that of
1748+
// Root.
17491749
if (MI1VReg != SrcReg)
17501750
return false;
17511751
else
17521752
break;
17531753
}
17541754
}
17551755

1756-
// If we haven't encountered MI2, it's likely that this function was
1757-
// called in a wrong way (e.g. MI1 is before MI2).
1758-
assert(SeenMI2 && "MI2 is expected to appear before MI1");
1756+
// If we haven't encountered Prev, it's likely that this function was
1757+
// called in a wrong way (e.g. Root is before Prev).
1758+
assert(SeenMI2 && "Prev is expected to appear before Root");
17591759
}
17601760

17611761
// Tail / Mask policies
@@ -1766,8 +1766,8 @@ bool RISCVInstrInfo::areRVVInstsReassociable(const MachineInstr &MI1,
17661766
// VL
17671767
if (RISCVII::hasVLOp(TSFlags)) {
17681768
unsigned OpIdx = RISCVII::getVLOpNum(Desc);
1769-
const MachineOperand &Op1 = MI1.getOperand(OpIdx);
1770-
const MachineOperand &Op2 = MI2.getOperand(OpIdx);
1769+
const MachineOperand &Op1 = Root.getOperand(OpIdx);
1770+
const MachineOperand &Op2 = Prev.getOperand(OpIdx);
17711771
if (Op1.getType() != Op2.getType())
17721772
return false;
17731773
switch (Op1.getType()) {

0 commit comments

Comments
 (0)