@@ -3696,7 +3696,8 @@ bool RISCVInstrInfo::findCommutedOpIndices(const MachineInstr &MI,
36963696 case CASE_VMA_OPCODE_LMULS (NMSAC, VV): {
36973697 // If the tail policy is undisturbed we can't commute.
36983698 assert (RISCVII::hasVecPolicyOp (MI.getDesc ().TSFlags ));
3699- if ((MI.getOperand (MI.getNumExplicitOperands () - 1 ).getImm () & 1 ) == 0 )
3699+ if ((MI.getOperand (RISCVII::getVecPolicyOpNum (MI.getDesc ())).getImm () &
3700+ 1 ) == 0 )
37003701 return false ;
37013702
37023703 // For these instructions we can only swap operand 1 and operand 3 by
@@ -3716,7 +3717,8 @@ bool RISCVInstrInfo::findCommutedOpIndices(const MachineInstr &MI,
37163717 case CASE_VMA_OPCODE_LMULS (NMSUB, VV): {
37173718 // If the tail policy is undisturbed we can't commute.
37183719 assert (RISCVII::hasVecPolicyOp (MI.getDesc ().TSFlags ));
3719- if ((MI.getOperand (MI.getNumExplicitOperands () - 1 ).getImm () & 1 ) == 0 )
3720+ if ((MI.getOperand (RISCVII::getVecPolicyOpNum (MI.getDesc ())).getImm () &
3721+ 1 ) == 0 )
37203722 return false ;
37213723
37223724 // For these instructions we have more freedom. We can commute with the
@@ -4331,7 +4333,8 @@ MachineInstr *RISCVInstrInfo::convertToThreeAddress(MachineInstr &MI,
43314333 // If the tail policy is undisturbed we can't convert.
43324334 assert (RISCVII::hasVecPolicyOp (MI.getDesc ().TSFlags ) &&
43334335 MI.getNumExplicitOperands () == 6 );
4334- if ((MI.getOperand (5 ).getImm () & 1 ) == 0 )
4336+ if ((MI.getOperand (RISCVII::getVecPolicyOpNum (MI.getDesc ())).getImm () &
4337+ 1 ) == 0 )
43354338 return nullptr ;
43364339
43374340 // clang-format off
0 commit comments