[llvm] [TableGen][AsmMatcher] Fix optional operand mask indexing when HasMnemonicFirst is false (PR #176868)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 2 03:06:48 PST 2026


================
@@ -3733,7 +3733,8 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
   }
 
   if (HasOptionalOperands)
-    OS << "  SmallBitVector OptionalOperandsMask(" << MaxNumOperands << ");\n";
+    OS << "  SmallBitVector OptionalOperandsMask("
+       << MaxNumOperands + HasMnemonicFirst << ");\n";
----------------
s-barannikov wrote:

Why do we need `+ HasMnemonicFirst` here? Mnemonic cannot be optional in HasMnemonicFirst == true, so the 0-th entry should be unused?


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


More information about the llvm-commits mailing list