From 2a1082cc6a0dee866d2815358ca6cf5e3e194956 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Mon, 24 Nov 2025 22:37:31 -0800 Subject: [PATCH] [RISCV] Add assertions to VSETVLIInfo accessors. NFC --- llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | 36 ++++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp index 2ddc9b0adb9e1..2ab8c113294f4 100644 --- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp +++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp @@ -607,12 +607,36 @@ class VSETVLIInfo { } } - unsigned getSEW() const { return SEW; } - RISCVVType::VLMUL getVLMUL() const { return VLMul; } - bool getTailAgnostic() const { return TailAgnostic; } - bool getMaskAgnostic() const { return MaskAgnostic; } - bool getAltFmt() const { return AltFmt; } - unsigned getTWiden() const { return TWiden; } + unsigned getSEW() const { + assert(isValid() && !isUnknown() && + "Can't use VTYPE for uninitialized or unknown"); + return SEW; + } + RISCVVType::VLMUL getVLMUL() const { + assert(isValid() && !isUnknown() && + "Can't use VTYPE for uninitialized or unknown"); + return VLMul; + } + bool getTailAgnostic() const { + assert(isValid() && !isUnknown() && + "Can't use VTYPE for uninitialized or unknown"); + return TailAgnostic; + } + bool getMaskAgnostic() const { + assert(isValid() && !isUnknown() && + "Can't use VTYPE for uninitialized or unknown"); + return MaskAgnostic; + } + bool getAltFmt() const { + assert(isValid() && !isUnknown() && + "Can't use VTYPE for uninitialized or unknown"); + return AltFmt; + } + unsigned getTWiden() const { + assert(isValid() && !isUnknown() && + "Can't use VTYPE for uninitialized or unknown"); + return TWiden; + } bool hasNonZeroAVL(const LiveIntervals *LIS) const { if (hasAVLImm())