Skip to content

Commit 3a27fc4

Browse files
authored
[RISCV] Omit VTYPE in VSETVLIInfo::print() when state is uninit or unknown. (#169459)
1 parent 2ee12f1 commit 3a27fc4

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ class VSETVLIInfo {
861861
/// Implement operator<<.
862862
/// @{
863863
void print(raw_ostream &OS) const {
864-
OS << "{";
864+
OS << '{';
865865
switch (State) {
866866
case AVLState::Uninitialized:
867867
OS << "Uninitialized";
@@ -879,24 +879,26 @@ class VSETVLIInfo {
879879
OS << "AVLVLMAX";
880880
break;
881881
}
882-
OS << ", ";
882+
if (isValid() && !isUnknown()) {
883+
OS << ", ";
884+
885+
unsigned LMul;
886+
bool Fractional;
887+
std::tie(LMul, Fractional) = decodeVLMUL(VLMul);
888+
889+
OS << "VLMul=m";
890+
if (Fractional)
891+
OS << 'f';
892+
OS << LMul << ", "
893+
<< "SEW=e" << (unsigned)SEW << ", "
894+
<< "TailAgnostic=" << (bool)TailAgnostic << ", "
895+
<< "MaskAgnostic=" << (bool)MaskAgnostic << ", "
896+
<< "SEWLMULRatioOnly=" << (bool)SEWLMULRatioOnly << ", "
897+
<< "TWiden=" << (unsigned)TWiden << ", "
898+
<< "AltFmt=" << (bool)AltFmt;
899+
}
883900

884-
unsigned LMul;
885-
bool Fractional;
886-
std::tie(LMul, Fractional) = decodeVLMUL(VLMul);
887-
888-
OS << "VLMul=";
889-
if (Fractional)
890-
OS << "mf";
891-
else
892-
OS << "m";
893-
OS << LMul << ", "
894-
<< "SEW=e" << (unsigned)SEW << ", "
895-
<< "TailAgnostic=" << (bool)TailAgnostic << ", "
896-
<< "MaskAgnostic=" << (bool)MaskAgnostic << ", "
897-
<< "SEWLMULRatioOnly=" << (bool)SEWLMULRatioOnly << ", "
898-
<< "TWiden=" << (unsigned)TWiden << ", "
899-
<< "AltFmt=" << (bool)AltFmt << "}";
901+
OS << '}';
900902
}
901903
#endif
902904
};

0 commit comments

Comments
 (0)