@@ -1677,30 +1677,30 @@ bool RISCVInstrInfo::isVectorAssociativeAndCommutative(const MachineInstr &Inst,
1677
1677
#undef OPCODE_LMUL_CASE
1678
1678
}
1679
1679
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 ()))
1683
1683
return false ;
1684
1684
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 ();
1687
1687
const TargetRegisterInfo *TRI = MRI->getTargetRegisterInfo ();
1688
1688
1689
1689
// Make sure vtype operands are also the same.
1690
- const MCInstrDesc &Desc = get (MI1 .getOpcode ());
1690
+ const MCInstrDesc &Desc = get (Root .getOpcode ());
1691
1691
const uint64_t TSFlags = Desc.TSFlags ;
1692
1692
1693
1693
auto checkImmOperand = [&](unsigned OpIdx) {
1694
- return MI1 .getOperand (OpIdx).getImm () == MI2 .getOperand (OpIdx).getImm ();
1694
+ return Root .getOperand (OpIdx).getImm () == Prev .getOperand (OpIdx).getImm ();
1695
1695
};
1696
1696
1697
1697
auto checkRegOperand = [&](unsigned OpIdx) {
1698
- return MI1 .getOperand (OpIdx).getReg () == MI2 .getOperand (OpIdx).getReg ();
1698
+ return Root .getOperand (OpIdx).getReg () == Prev .getOperand (OpIdx).getReg ();
1699
1699
};
1700
1700
1701
1701
// 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
1704
1704
// also need to loosen the condition on vector policies between these.
1705
1705
if (!checkRegOperand (1 ))
1706
1706
return false ;
@@ -1712,17 +1712,17 @@ bool RISCVInstrInfo::areRVVInstsReassociable(const MachineInstr &MI1,
1712
1712
1713
1713
// Mask
1714
1714
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 );
1718
1718
Register MI1VReg;
1719
1719
1720
1720
bool SeenMI2 = false ;
1721
1721
for (auto End = MBB->rend (), It = It1; It != End; ++It) {
1722
1722
if (It == It2) {
1723
1723
SeenMI2 = true ;
1724
1724
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
1726
1726
// same V0.
1727
1727
break ;
1728
1728
}
@@ -1735,7 +1735,7 @@ bool RISCVInstrInfo::areRVVInstsReassociable(const MachineInstr &MI1,
1735
1735
return false ;
1736
1736
1737
1737
if (!MI1VReg.isValid ()) {
1738
- // This is the V0 def for MI1 .
1738
+ // This is the V0 def for Root .
1739
1739
MI1VReg = SrcReg;
1740
1740
continue ;
1741
1741
}
@@ -1744,18 +1744,18 @@ bool RISCVInstrInfo::areRVVInstsReassociable(const MachineInstr &MI1,
1744
1744
if (!SeenMI2)
1745
1745
continue ;
1746
1746
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 .
1749
1749
if (MI1VReg != SrcReg)
1750
1750
return false ;
1751
1751
else
1752
1752
break ;
1753
1753
}
1754
1754
}
1755
1755
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 " );
1759
1759
}
1760
1760
1761
1761
// Tail / Mask policies
@@ -1766,8 +1766,8 @@ bool RISCVInstrInfo::areRVVInstsReassociable(const MachineInstr &MI1,
1766
1766
// VL
1767
1767
if (RISCVII::hasVLOp (TSFlags)) {
1768
1768
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);
1771
1771
if (Op1.getType () != Op2.getType ())
1772
1772
return false ;
1773
1773
switch (Op1.getType ()) {
0 commit comments