[llvm] 6a55aa5 - [CodeGen] Print invalid instead of crashing when dumping invalid MVT
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 31 11:01:43 PDT 2023
Author: Philip Reames
Date: 2023-08-31T11:01:34-07:00
New Revision: 6a55aa5ff3c376f21bd2a88ad6fb5e86b641ba1b
URL: https://github.com/llvm/llvm-project/commit/6a55aa5ff3c376f21bd2a88ad6fb5e86b641ba1b
DIFF: https://github.com/llvm/llvm-project/commit/6a55aa5ff3c376f21bd2a88ad6fb5e86b641ba1b.diff
LOG: [CodeGen] Print invalid instead of crashing when dumping invalid MVT
Added:
Modified:
llvm/lib/CodeGen/ValueTypes.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/ValueTypes.cpp b/llvm/lib/CodeGen/ValueTypes.cpp
index d514e1642e29d7..2d16ff2dfb2fbf 100644
--- a/llvm/lib/CodeGen/ValueTypes.cpp
+++ b/llvm/lib/CodeGen/ValueTypes.cpp
@@ -637,6 +637,9 @@ void MVT::dump() const {
#endif
void MVT::print(raw_ostream &OS) const {
- OS << EVT(*this).getEVTString();
+ if (SimpleTy == INVALID_SIMPLE_VALUE_TYPE)
+ OS << "invalid";
+ else
+ OS << EVT(*this).getEVTString();
}
More information about the llvm-commits
mailing list