From: Craig Topper Date: Mon, 31 Jan 2022 17:08:17 +0000 (-0800) Subject: [RISCV] Add a fatal error if ISD::VSCALE is used with Zvl32b. X-Git-Tag: upstream/15.0.7~18434 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2e45e8abb11b007ec9f575b1ea9b20b42fa74445;p=platform%2Fupstream%2Fllvm.git [RISCV] Add a fatal error if ISD::VSCALE is used with Zvl32b. We convert VLEN to vscale by dividing by RVVBitsPerBlock which is currently 64. This is only correct if VLEN is evenly divisible by 64. With only Zvl32b we can't assume that. This patch adds a fatal_error to prevent generating code that may be broken. We probably need to look at how we size stack frame objects too. Reviewed By: frasercrmck Differential Revision: https://reviews.llvm.org/D118583 --- diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index de24058..72bae06 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -3076,6 +3076,8 @@ SDValue RISCVTargetLowering::LowerOperation(SDValue Op, // minimum size. e.g. . VLENB is in bytes so we calculate // vscale as VLENB / 8. static_assert(RISCV::RVVBitsPerBlock == 64, "Unexpected bits per block!"); + if (Subtarget.getMinVLen() < RISCV::RVVBitsPerBlock) + report_fatal_error("Support for VLEN==32 is incomplete."); if (isa(Op.getOperand(0))) { // We assume VLENB is a multiple of 8. We manually choose the best shift // here because SimplifyDemandedBits isn't always able to simplify it.