Skip to content

Commit 8b9e208

Browse files
authored
[RISCV] Add helper function getVecPolicyOpNum in RISCVInsertVSETVLI.cpp. NFC. (#161476)
1 parent e37a973 commit 8b9e208

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ static unsigned getSEWOpNum(const MachineInstr &MI) {
7070
return RISCVII::getSEWOpNum(MI.getDesc());
7171
}
7272

73+
static unsigned getVecPolicyOpNum(const MachineInstr &MI) {
74+
return RISCVII::getVecPolicyOpNum(MI.getDesc());
75+
}
76+
7377
/// Get the EEW for a load or store instruction. Return std::nullopt if MI is
7478
/// not a load or store which ignores SEW.
7579
static std::optional<unsigned> getEEWForLoadStore(const MachineInstr &MI) {
@@ -986,7 +990,7 @@ RISCVInsertVSETVLI::computeInfoForInstr(const MachineInstr &MI) const {
986990

987991
// If there is a policy operand, use it.
988992
if (RISCVII::hasVecPolicyOp(TSFlags)) {
989-
const MachineOperand &Op = MI.getOperand(MI.getNumExplicitOperands() - 1);
993+
const MachineOperand &Op = MI.getOperand(getVecPolicyOpNum(MI));
990994
uint64_t Policy = Op.getImm();
991995
assert(Policy <=
992996
(RISCVVType::TAIL_AGNOSTIC | RISCVVType::MASK_AGNOSTIC) &&

0 commit comments

Comments
 (0)