[llvm] [RISCV] Omit VTYPE in VSETVLIInfo::print() when state is uninit or unknown. (PR #169459)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 25 07:19:08 PST 2025


https://github.com/topperc updated https://github.com/llvm/llvm-project/pull/169459

>From 6936611d2f9cd3b90611d9b22bb3de73fb86e9db Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Mon, 24 Nov 2025 22:21:32 -0800
Subject: [PATCH] [RISCV] Omit VTYPE in VSETVLIInfo::print() when state is
 uninit or unknown.

---
 llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | 38 ++++++++++----------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
index 2ddc9b0adb9e12..418525ea4017f9 100644
--- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
@@ -837,7 +837,7 @@ class VSETVLIInfo {
   /// Implement operator<<.
   /// @{
   void print(raw_ostream &OS) const {
-    OS << "{";
+    OS << '{';
     switch (State) {
     case Uninitialized:
       OS << "Uninitialized";
@@ -855,24 +855,26 @@ class VSETVLIInfo {
       OS << "AVLVLMAX";
       break;
     }
-    OS << ", ";
+    if (State != Uninitialized && State != Unknown) {
+      OS << ", ";
+
+      unsigned LMul;
+      bool Fractional;
+      std::tie(LMul, Fractional) = decodeVLMUL(VLMul);
+
+      OS << "VLMul=m";
+      if (Fractional)
+        OS << 'f';
+      OS << LMul << ", "
+         << "SEW=e" << (unsigned)SEW << ", "
+         << "TailAgnostic=" << (bool)TailAgnostic << ", "
+         << "MaskAgnostic=" << (bool)MaskAgnostic << ", "
+         << "SEWLMULRatioOnly=" << (bool)SEWLMULRatioOnly << ", "
+         << "TWiden=" << (unsigned)TWiden << ", "
+         << "AltFmt=" << (bool)AltFmt;
+    }
 
-    unsigned LMul;
-    bool Fractional;
-    std::tie(LMul, Fractional) = decodeVLMUL(VLMul);
-
-    OS << "VLMul=";
-    if (Fractional)
-      OS << "mf";
-    else
-      OS << "m";
-    OS << LMul << ", "
-       << "SEW=e" << (unsigned)SEW << ", "
-       << "TailAgnostic=" << (bool)TailAgnostic << ", "
-       << "MaskAgnostic=" << (bool)MaskAgnostic << ", "
-       << "SEWLMULRatioOnly=" << (bool)SEWLMULRatioOnly << ", "
-       << "TWiden=" << (unsigned)TWiden << ", "
-       << "AltFmt=" << (bool)AltFmt << "}";
+    OS << '}';
   }
 #endif
 };



More information about the llvm-commits mailing list