[llvm-branch-commits] [llvm] [NFC][IR2Vec] Minor refactoring of opcode access in vocabulary (PR #147585)

Aiden Grossman via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jul 10 11:10:47 PDT 2025


================
@@ -297,9 +309,9 @@ StringRef Vocabulary::getVocabKeyForOperandKind(Vocabulary::OperandKind Kind) {
     OPERAND_KINDS
 #undef OPERAND_KIND
   case Vocabulary::OperandKind::MaxOperandKind:
-    llvm_unreachable("Invalid OperandKind");
+    return "UnknownOperand";
   }
-  llvm_unreachable("Unknown OperandKind");
+  return "UnknownOperand";
----------------
boomanaiden154 wrote:

Well yeah, it lowers to an assertion in debug mode and it lowers to an optimization hint in release mode. If this is something that should be an assertion, then it needs to be `llvm_unreachable`. If you expect to hit this because you haven't handled cases yet or something, it needs to be a standard return.

https://github.com/llvm/llvm-project/pull/147585


More information about the llvm-branch-commits mailing list