diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp index faa8d3797ea05..0dfffc7fd1430 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 AVLState::Uninitialized: OS << "Uninitialized"; @@ -855,24 +855,26 @@ class VSETVLIInfo { OS << "AVLVLMAX"; break; } - OS << ", "; + if (isValid() && !isUnknown()) { + 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 };