[llvm] [RISCV][Verifier] Check operands and result type of RISC-V vsetvli/vsetvlimax (PR #218594)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 24 23:47:40 PDT 2026


================
@@ -6976,6 +6978,27 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
           Call);
     break;
   }
+  case Intrinsic::riscv_vsetvli:
+  case Intrinsic::riscv_vsetvlimax: {
+    // The result models VLMAX (or a VL bounded by it) and is only defined for
+    // XLen (i32/i64). Narrower types cannot represent the architectural VLMAX
+    // range of [1, 65536], which value analyses rely on.
+    unsigned BitWidth = Call.getType()->getScalarSizeInBits();
+    Check(BitWidth == 32 || BitWidth == 64,
----------------
lukel97 wrote:

I think this should probably just check `Call.getType()->isIntegerTy(32) || Call.getType()->isIntegerTy(64)`

https://github.com/llvm/llvm-project/pull/218594


More information about the llvm-commits mailing list