Skip to content

Commit cadf393

Browse files
committed
Move max into DemandedVL
1 parent ebce546 commit cadf393

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ struct DemandedVL {
5151
bool operator!=(const DemandedVL &Other) const {
5252
return !VL.isIdenticalTo(Other.VL);
5353
}
54-
};
5554

56-
static DemandedVL max(const DemandedVL &LHS, const DemandedVL &RHS) {
57-
if (RISCV::isVLKnownLE(LHS.VL, RHS.VL))
58-
return RHS;
59-
if (RISCV::isVLKnownLE(RHS.VL, LHS.VL))
60-
return LHS;
61-
return DemandedVL::vlmax();
62-
}
55+
DemandedVL max(const DemandedVL &X) const {
56+
if (RISCV::isVLKnownLE(VL, X.VL))
57+
return X;
58+
if (RISCV::isVLKnownLE(X.VL, VL))
59+
return *this;
60+
return DemandedVL::vlmax();
61+
}
62+
};
6363

6464
class RISCVVLOptimizer : public MachineFunctionPass {
6565
const MachineRegisterInfo *MRI;
@@ -1637,7 +1637,7 @@ void RISCVVLOptimizer::transfer(const MachineInstr &MI) {
16371637
for (const MachineOperand &MO : make_filter_range(MI.uses(), isVirtualVec)) {
16381638
const MachineInstr *Def = MRI->getVRegDef(MO.getReg());
16391639
DemandedVL Prev = DemandedVLs[Def];
1640-
DemandedVLs[Def] = max(DemandedVLs[Def], getMinimumVLForUser(MO));
1640+
DemandedVLs[Def] = DemandedVLs[Def].max(getMinimumVLForUser(MO));
16411641
if (DemandedVLs[Def] != Prev)
16421642
Worklist.insert(Def);
16431643
}

0 commit comments

Comments
 (0)