diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp @@ -1196,8 +1196,9 @@ BuildMI(MBB, II, DL, TII->get(RISCV::ADDI), VN) .addReg(RISCV::X0) .addImm(NumOfVReg); - assert(MF.getSubtarget().hasStdExtM() && - "M-extension must be enabled to calculate the vscaled size/offset."); + if (!MF.getSubtarget().hasStdExtM()) + report_fatal_error("M-extension must be enabled to calculate the vscaled " + "size/offset."); BuildMI(MBB, II, DL, TII->get(RISCV::MUL), FactorRegister) .addReg(SizeOfVector, RegState::Kill) .addReg(VN, RegState::Kill);