Skip to content

Commit af39675

Browse files
committed
Extract helper for readability
1 parent 727770a commit af39675

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

llvm/lib/Target/RISCV/RISCVVectorMaskDAGMutation.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ class RISCVVectorMaskDAGMutation : public ScheduleDAGMutation {
4747
public:
4848
RISCVVectorMaskDAGMutation(const TargetRegisterInfo *TRI) : TRI(TRI) {}
4949

50+
bool isCopyToV0(const MachineInstr &MI) {
51+
return MI.isCopy() && MI.getOperand(0).getReg() == RISCV::V0 &&
52+
MI.getOperand(1).getReg().isVirtual() &&
53+
MI.getOperand(1).getSubReg() == RISCV::NoSubRegister;
54+
}
55+
5056
bool isSoleUseCopyToV0(SUnit &SU) {
5157
if (SU.Succs.size() != 1)
5258
return false;
@@ -58,11 +64,7 @@ class RISCVVectorMaskDAGMutation : public ScheduleDAGMutation {
5864
SUnit &DepSU = *Dep.getSUnit();
5965
if (DepSU.isBoundaryNode())
6066
return false;
61-
62-
const MachineInstr *DepMI = DepSU.getInstr();
63-
return DepMI->isCopy() && DepMI->getOperand(0).getReg() == RISCV::V0 &&
64-
DepMI->getOperand(1).getReg().isVirtual() &&
65-
DepMI->getOperand(1).getSubReg() == RISCV::NoSubRegister;
67+
return isCopyToV0(*DepSU.getInstr());
6668
}
6769

6870
void apply(ScheduleDAGInstrs *DAG) override {

0 commit comments

Comments
 (0)