[RISCV] Use Zvl*b as a lower bound for VScaleRange.
authorCraig Topper <craig.topper@sifive.com>
Tue, 17 Jan 2023 19:32:08 +0000 (11:32 -0800)
committerCraig Topper <craig.topper@sifive.com>
Tue, 17 Jan 2023 19:32:29 +0000 (11:32 -0800)
commit226ceebfa232492d0c4613cd6c9f8e72b970fe08
treedf9c18d1562d25f7556c6396a0cf3473be67cddb
parentf1f0a0d8e8fdd2e534d9423b2e64c6b8aaa53aee
[RISCV] Use Zvl*b as a lower bound for VScaleRange.

The backend has a fatal error in RISCVSubtarget::getMinRVVVectorSizeInBits
if RVVVectorBitsMin is less than the Zvl length from -march. Now
RVVVectorBitsMin is connected to VScaleRange in the backend, we
can trip this fatal error.

This patch adds the Zvl*b length as a lower bound to protect this.
The test is updated to test vscale-min with Zvl64b instead of V.

I'd like to do a proper diagnostic for this, but I don't think we
can do that from this function. Since -mvscale-min is an internal cc1
option, I'm not sure it's a big deal.

I'm planning to add a driver option -msve-vector-bits. I will
probably implement a diagnostic for that.

Reviewed By: kito-cheng

Differential Revision: https://reviews.llvm.org/D141459
clang/lib/Basic/Targets/RISCV.cpp
clang/test/CodeGen/riscv-vector-bits-vscale-range.c