diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp index 1afd2fb40f54..98ae36012200 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp @@ -1237,6 +1237,10 @@ bool RISCVInstrInfo::verifyInstruction(const MachineInstr &MI, return false; } } + if (!RISCVII::hasSEWOp(TSFlags)) { + ErrInfo = "VL operand w/o SEW operand?"; + return false; + } } if (RISCVII::hasSEWOp(TSFlags)) { unsigned OpIdx = RISCVII::getSEWOpNum(Desc); @@ -1258,6 +1262,10 @@ bool RISCVInstrInfo::verifyInstruction(const MachineInstr &MI, ErrInfo = "Invalid Policy Value"; return false; } + if (!RISCVII::hasVLOp(TSFlags)) { + ErrInfo = "policy operand w/o VL operand?"; + return false; + } } return true;