Skip to content

Conversation

@topperc
Copy link
Collaborator

@topperc topperc commented Nov 25, 2025

This allows the compiler to verify we've covered all enum values.

This allows the compiler to verify we've covered all enum values.
@llvmbot
Copy link
Member

llvmbot commented Nov 25, 2025

@llvm/pr-subscribers-backend-risc-v

Author: Craig Topper (topperc)

Changes

This allows the compiler to verify we've covered all enum values.


Full diff: https://github.com/llvm/llvm-project/pull/169441.diff

1 Files Affected:

  • (modified) llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp (+12-5)
diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
index e5819d90526d9..2ddc9b0adb9e1 100644
--- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
@@ -838,16 +838,23 @@ class VSETVLIInfo {
   /// @{
   void print(raw_ostream &OS) const {
     OS << "{";
-    if (!isValid())
+    switch (State) {
+    case Uninitialized:
       OS << "Uninitialized";
-    if (isUnknown())
+      break;
+    case Unknown:
       OS << "unknown";
-    if (hasAVLReg())
+      break;
+    case AVLIsReg:
       OS << "AVLReg=" << llvm::printReg(getAVLReg());
-    if (hasAVLImm())
+      break;
+    case AVLIsImm:
       OS << "AVLImm=" << (unsigned)AVLImm;
-    if (hasAVLVLMAX())
+      break;
+    case AVLIsVLMAX:
       OS << "AVLVLMAX";
+      break;
+    }
     OS << ", ";
 
     unsigned LMul;

@topperc topperc enabled auto-merge (squash) November 25, 2025 01:54
@topperc topperc merged commit b63a188 into llvm:main Nov 25, 2025
9 of 11 checks passed
@topperc topperc deleted the pr/vsetvli-print branch November 25, 2025 05:51
aadeshps-mcw pushed a commit to aadeshps-mcw/llvm-project that referenced this pull request Nov 26, 2025
This allows the compiler to verify we've covered all enum values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants