[llvm] [AsmMatcher] Report a near-miss when all candidates mismatch multiple operands (PR #206390)

Mark Zhuang via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 30 18:53:03 PDT 2026


================
@@ -3784,6 +3784,13 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
   OS << "  if (MnemonicRange.first == MnemonicRange.second)\n";
   OS << "    return Match_MnemonicFail;\n\n";
 
+  if (ReportMultipleNearMisses) {
+    OS << "  // First operand near-miss of each opcode that mismatched in\n";
+    OS << "  // more than one operand. Used only if no opcode yields a\n";
+    OS << "  // near-miss of its own (see below).\n";
+    OS << "  SmallVector<NearMissInfo, 4> MultiMismatchFallback;\n\n";
----------------
zqb-all wrote:

Tried it — collapsing to std::optional regresses some ARM diagnostics, because FilterNearMisses needs multiple candidates to pick the best one (ARM does a reverse walk + subclass dedup). The vector leaves room for each target to choose.

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


More information about the llvm-commits mailing list