[llvm] [RISCV] Track the value range of vsetvlimax (PR #218313)
Pengcheng Wang via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 24 03:09:14 PDT 2026
================
@@ -2903,12 +2897,13 @@ bool llvm::isKnownToBeAPowerOfTwo(const Value *V, bool OrZero,
if (II->getArgOperand(0) == II->getArgOperand(1))
return isKnownToBeAPowerOfTwo(II->getArgOperand(0), OrZero, Q, Depth);
break;
- case Intrinsic::riscv_vsetvlimax:
- // VLEN and LMUL are powers of two, and SEW is a power of two.
- if (ConstantRange Range = getRISCVVSetVLMaxRange(*II);
- !Range.isFullSet())
- return OrZero || !Range.contains(APInt(Range.getBitWidth(), 0));
- return false;
+ case Intrinsic::riscv_vsetvlimax: {
+ // VLMAX is VLEN * LMUL / SEW, which is always a power of two. It can
+ // still be zero for a fractional LMUL with a large SEW and small VLEN
+ // (e.g. e64mf8), so consult the range to rule out zero unless OrZero.
----------------
wangpc-pp wrote:
AI illusion :-)
https://github.com/llvm/llvm-project/pull/218313
More information about the llvm-commits
mailing list