https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/233308
>From 78cabc405687f35c7f9c4a41f3c4c08a25abd4cd Mon Sep 17 00:00:00 2001 From: Alex Richardson <[email protected]> Date: Wed, 28 Oct 2026 11:12:54 -0700 Subject: [PATCH 1/3] [nspr] initial commit --- llvm/docs/CommandGuide/llvm-mc.md | 3 +- .../Support/SourceMgrDiagnosticVerifier.h | 8 +-- .../Support/SourceMgrDiagnosticVerifier.cpp | 49 ++++++++++++------- llvm/test/tools/llvm-mc/verify/basic.s | 35 +++++++++++++ mlir/docs/Diagnostics.md | 9 ++-- .../Dialect/GPU/transform-gpu-failing.mlir | 4 +- mlir/test/Dialect/Linalg/invalid.mlir | 2 +- .../Dialect/Linalg/match-ops-interpreter.mlir | 4 +- .../Linalg/transform-op-specialize.mlir | 2 +- mlir/test/Dialect/SCF/loop-pipelining.mlir | 2 +- .../Transform/check-use-after-free.mlir | 4 +- .../Dialect/Transform/expensive-checks.mlir | 1 + .../test/Dialect/Transform/foreach-match.mlir | 6 +-- .../Transform/multi-arg-top-level-values.mlir | 10 +--- mlir/test/Dialect/Transform/ops-invalid.mlir | 2 +- .../Dialect/Transform/test-interpreter.mlir | 10 ++-- mlir/test/IR/invalid-builtin-attributes.mlir | 2 +- mlir/test/IR/test-verification-order.mlir | 4 +- 18 files changed, 102 insertions(+), 55 deletions(-) diff --git a/llvm/docs/CommandGuide/llvm-mc.md b/llvm/docs/CommandGuide/llvm-mc.md index 5dfb2fc9ecb509..e96294b9384d16 100644 --- a/llvm/docs/CommandGuide/llvm-mc.md +++ b/llvm/docs/CommandGuide/llvm-mc.md @@ -170,7 +170,7 @@ them (similar to Clang's `-verify`): Directives have the form: ```text -<prefix>-<kind>[-re][@<offset>] {{<text>}} +<prefix>-<kind>[-re][@<offset>] [<count>] {{<text>}} ``` - `<prefix>`: `expected` by default, or any prefix listed in the @@ -183,6 +183,7 @@ Directives have the form: - `@+N` / `@-N`: `N` lines below or above the directive. - `@above` / `@below`: the nearest non-directive line above or below. - `@unknown`: a diagnostic with no source location. +- `<count>`: the number of times the diagnostic is expected (defaults to 1). At most one directive is recognized per line. {program}`llvm-mc` succeeds if all directives are matched and no unexpected diagnostics are emitted. Unlike Clang, diff --git a/llvm/include/llvm/Support/SourceMgrDiagnosticVerifier.h b/llvm/include/llvm/Support/SourceMgrDiagnosticVerifier.h index 0a83d312fc5dba..3890405fef1934 100644 --- a/llvm/include/llvm/Support/SourceMgrDiagnosticVerifier.h +++ b/llvm/include/llvm/Support/SourceMgrDiagnosticVerifier.h @@ -32,7 +32,7 @@ class raw_ostream; /// Scans SourceMgr source buffers for 'expected-<kind>' comments (e.g. /// 'expected-error {{message}}') and verifies that the diagnostics reported /// to it via \c process match them, and that every expected diagnostic is -/// matched at least once. +/// matched the expected number of times. class LLVM_ABI SourceMgrDiagnosticVerifier { public: /// The result of matching a single actual diagnostic against the expected @@ -76,8 +76,10 @@ class LLVM_ABI SourceMgrDiagnosticVerifier { unsigned lineNo; /// The location of the expected diagnostic within the input file. SMLoc fileLoc; - /// A flag indicating if the expected diagnostic has been matched yet. - bool matched = false; + /// The number of times this diagnostic is expected. + unsigned numExpected = 1; + /// The number of matching diagnostics seen so far. + unsigned numSeen = 0; /// The substring that is expected to be within the diagnostic. StringRef substring; /// An optional regex matcher, if the expected diagnostic substring was a diff --git a/llvm/lib/Support/SourceMgrDiagnosticVerifier.cpp b/llvm/lib/Support/SourceMgrDiagnosticVerifier.cpp index d6082ce369f435..89926a00867857 100644 --- a/llvm/lib/Support/SourceMgrDiagnosticVerifier.cpp +++ b/llvm/lib/Support/SourceMgrDiagnosticVerifier.cpp @@ -100,7 +100,8 @@ static Regex buildExpectedRegex(ArrayRef<StringRef> prefixes) { }, [&] { pattern += '|'; }); pattern += ")-(error|note|remark|warning)(-re)?" - "( *@([+-][0-9]+|above|below|unknown))? *{{(.*)}}$"; + "( *@([+-][0-9]+|above|below|unknown))?" + "( +([0-9]+))? *{{(.*)}}$"; return Regex(pattern); } @@ -127,7 +128,7 @@ SourceMgrDiagnosticVerifier::computeExpectedDiags(raw_ostream &os, SmallVector<StringRef, 100> lines; buf->getBuffer().split(lines, '\n'); for (unsigned lineNo = 0, e = lines.size(); lineNo < e; ++lineNo) { - SmallVector<StringRef, 8> matches; + SmallVector<StringRef, 10> matches; if (!expected.match(lines[lineNo].rtrim(), &matches)) { // Check for designators that apply to this line. if (!designatorsForNextLine.empty()) { @@ -153,7 +154,7 @@ SourceMgrDiagnosticVerifier::computeExpectedDiags(raw_ostream &os, assert(matches[3] == "note"); kind = SourceMgr::DK_Note; } - ExpectedDiag record(kind, lineNo + 1, expectedStart, matches[7]); + ExpectedDiag record(kind, lineNo + 1, expectedStart, matches[9]); // Check to see if this is a regex match, i.e. it includes the `-re`. if (!matches[4].empty() && !record.computeRegex(os, mgr)) { @@ -161,6 +162,14 @@ SourceMgrDiagnosticVerifier::computeExpectedDiags(raw_ostream &os, continue; } + if (!matches[8].empty() && + (matches[8].getAsInteger(10, record.numExpected) || + record.numExpected == 0)) { + record.emitError(os, mgr, "invalid count '" + matches[8] + "'"); + ok = false; + continue; + } + StringRef offsetMatch = matches[6]; if (!offsetMatch.empty()) { // Get the integer value without the @ and +/- prefix. @@ -228,21 +237,19 @@ SourceMgrDiagnosticVerifier::process(raw_ostream &os, SourceMgr &mgr, // If we find something that is close then emit a more specific error. ExpectedDiag *nearMiss = nullptr; - // If this was an expected error, remember that we saw it and return. for (auto &e : diags) { // File line must match (unless it's an unknown location). if (hasLoc && e.lineNo != lineNo) continue; - if (e.match(message)) { - if (e.kind == kind) { - e.matched = true; - return MatchResult::Matched; - } - - // If this only differs based on the diagnostic kind, then consider it - // to be a near miss. - nearMiss = &e; + if (e.numSeen == e.numExpected || !e.match(message)) + continue; + if (e.kind == kind) { + ++e.numSeen; + return MatchResult::Matched; } + // If this only differs based on the diagnostic kind, then consider it + // to be a near miss. + nearMiss = &e; } if (!reportUnexpected) @@ -264,12 +271,18 @@ SourceMgrDiagnosticVerifier::process(raw_ostream &os, SourceMgr &mgr, bool SourceMgrDiagnosticVerifier::verify(raw_ostream &os, SourceMgr &mgr) { // Verify that all expected errors were seen. auto checkExpectedDiags = [&](ExpectedDiag &diag) { - if (!diag.matched) { + if (diag.numSeen == diag.numExpected) + return; + std::string expectedMsg = ("expected " + getDiagKindStr(diag.kind) + " \"" + + diag.substring + "\"") + .str(); + if (diag.numExpected == 1) + diag.emitError(os, mgr, expectedMsg + " was not produced"); + else diag.emitError(os, mgr, - "expected " + getDiagKindStr(diag.kind) + " \"" + - diag.substring + "\" was not produced"); - ok = false; - } + expectedMsg + " was produced " + Twine(diag.numSeen) + + " of " + Twine(diag.numExpected) + " times"); + ok = false; }; for (auto &expectedDiagsPair : expectedDiagsPerFile) for (auto &diag : expectedDiagsPair.second) diff --git a/llvm/test/tools/llvm-mc/verify/basic.s b/llvm/test/tools/llvm-mc/verify/basic.s index 237a9377bd8a25..97cb46daedc1fe 100644 --- a/llvm/test/tools/llvm-mc/verify/basic.s +++ b/llvm/test/tools/llvm-mc/verify/basic.s @@ -29,6 +29,19 @@ .qux_directive # expected-error {{unknown directive}} .quux_directive // expected-error {{unknown directive}} +## A diagnostic that is reported twice on a line needs two directives or a count. +.dup_directive; .dup_directive +# expected-error@-1 {{unknown directive}} +# expected-error@-2 {{unknown directive}} +.dup_directive; .dup_directive +# expected-error@-1 2 {{unknown directive}} + +## A directive that was already matched does not steal a later diagnostic from +## a second directive on the same line. +movl $1, %eax, %ebx; movl $1, %eax, %ebx +# expected-error@-1 {{operand}} +# expected-error@-2 {{invalid operand}} + movl $1, %eax, %ebx # expected-error@-1 {{invalid operand for instruction}} @@ -85,6 +98,28 @@ nop # expected-error@-1 {{this will never happen}} # CHECK: error: expected error "this will never happen" was not produced +#--- duplicate.s +## Each directive matches only one diagnostic, and an already-matched +## directive is not reported as a near miss for a later diagnostic. +# RUN: not llvm-mc --triple=x86_64 --verify duplicate.s 2>&1 \ +# RUN: | FileCheck duplicate.s --implicit-check-not=error: +.dup_directive; .dup_directive +# expected-error@-1 {{unknown directive}} +# CHECK: duplicate.s:[[#@LINE-2]]:17: error: unexpected error: unknown directive +.foo_directive; .warning "unknown directive" +# expected-error@-1 {{unknown directive}} +# CHECK: duplicate.s:[[#@LINE-2]]:17: error: unexpected warning: unknown directive + +#--- too-few.s +## Directives with an invalid count or a count that is matched fewer times fail. +# RUN: not llvm-mc --triple=x86_64 --verify too-few.s 2>&1 \ +# RUN: | FileCheck too-few.s --implicit-check-not=error: +.foo_directive +# expected-error@-1 2 {{unknown directive}} +# expected-warning@-2 0 {{zero count}} +# CHECK: too-few.s:[[#@LINE-1]]:3: error: invalid count '0' +# CHECK: too-few.s:[[#@LINE-3]]:3: error: expected error "unknown directive" was produced 1 of 2 times + #--- no-diagnostics.s ## A file without diagnostics or directives passes. # RUN: llvm-mc --triple=x86_64 --verify no-diagnostics.s diff --git a/mlir/docs/Diagnostics.md b/mlir/docs/Diagnostics.md index c9d3692f427dce..d8a399985f4f0f 100644 --- a/mlir/docs/Diagnostics.md +++ b/mlir/docs/Diagnostics.md @@ -318,15 +318,16 @@ This handler is a wrapper around a llvm::SourceMgr that is used to verify that certain diagnostics have been emitted to the context. To use this handler, annotate your source file with expected diagnostics in the form of: -* `expected-(error|note|remark|warning)(-re)? {{ message }}` +* `expected-(error|note|remark|warning)(-re)?(@([+-][0-9]+|above|below|unknown))?( [0-9]+)? {{ message }}` The provided `message` is a string expected to be contained within the generated diagnostic. The `-re` suffix may be used to enable regex matching within the `message`. When present, the `message` may define regex match sequences within `{{` `}}` blocks. The regular expression matcher supports Extended POSIX regular -expressions (ERE). `expected-` must not be preceded by an alphanumeric -character, hyphen, or underscore (so e.g. `unexpected-error` is ignored). A few -examples are shown below: +expressions (ERE). An optional positive integer count before `{{` specifies how +many diagnostics the directive must match (default: 1). `expected-` must not be +preceded by an alphanumeric character, hyphen, or underscore (so e.g. +`unexpected-error` is ignored). A few examples are shown below: ```mlir // Expect an error on the same line. diff --git a/mlir/test/Dialect/GPU/transform-gpu-failing.mlir b/mlir/test/Dialect/GPU/transform-gpu-failing.mlir index 099283826cee02..aa0b3c1c7a7cb8 100644 --- a/mlir/test/Dialect/GPU/transform-gpu-failing.mlir +++ b/mlir/test/Dialect/GPU/transform-gpu-failing.mlir @@ -50,8 +50,8 @@ func.func @map_nested_forall_to_threads_excessive_threads(%x: memref<2 x 32 x f3 module attributes {transform.with_named_sequence} { transform.named_sequence @__transform_main(%arg0: !transform.any_op {transform.readonly}) { %funcop = transform.structured.match ops{["gpu.launch"]} in %arg0 : (!transform.any_op) -> !transform.any_op - // expected-error @below {{Trying to launch a GPU kernel with grid_dims = (1, 1, 1) block_dims = (1200, 9, 1). It is larger than the limits.}} - // expected-note @below {{"block_dims" is too large}} + // expected-error @below 2 {{Trying to launch a GPU kernel with grid_dims = (1, 1, 1) block_dims = (1200, 9, 1). It is larger than the limits.}} + // expected-note @below 2 {{"block_dims" is too large}} transform.gpu.map_nested_forall_to_threads %funcop block_dims = [1200, 9, 1] : (!transform.any_op) -> !transform.any_op transform.yield } diff --git a/mlir/test/Dialect/Linalg/invalid.mlir b/mlir/test/Dialect/Linalg/invalid.mlir index 70b375ef24941b..81ec1e227d0e9e 100644 --- a/mlir/test/Dialect/Linalg/invalid.mlir +++ b/mlir/test/Dialect/Linalg/invalid.mlir @@ -2426,7 +2426,7 @@ func.func @pooling_nwc_min_unsigned_i1( func.func @matmul_invalid_mixed_types(%t: tensor<?xf16>, %f: vector<4xf16>) -> (tensor<?xf16>, vector<4xf16>) { - // expected-warning @unknown {{could not cast operand of type 'f16' to 'vector<4xf16>'}} + // expected-warning @unknown 2 {{could not cast operand of type 'f16' to 'vector<4xf16>'}} // expected-error @below {{Cannot build binary Linalg operation: expects allComplex, allFloatingPoint, or allInteger, got 'vector<4xf16>' and 'f16'}} %0 = linalg.matmul ins(%t, %t : tensor<?xf16>, tensor<?xf16>) outs(%f : vector<4xf16>) -> tensor<?xf16> diff --git a/mlir/test/Dialect/Linalg/match-ops-interpreter.mlir b/mlir/test/Dialect/Linalg/match-ops-interpreter.mlir index 0d60e5e5655dd9..47879d9485f59b 100644 --- a/mlir/test/Dialect/Linalg/match-ops-interpreter.mlir +++ b/mlir/test/Dialect/Linalg/match-ops-interpreter.mlir @@ -546,7 +546,7 @@ module attributes { transform.with_named_sequence } { func.func @payload(%f32: f32, // expected-remark @below {{output 0}} // expected-remark @below {{all output}} - // expected-note @below {{value handle points to a block argument #1 in block #0 in region #0}} + // expected-note @below 2 {{value handle points to a block argument #1 in block #0 in region #0}} %tf32: tensor<?xf32>, // expected-remark @below {{all output}} // expected-note @below {{value handle points to a block argument #2 in block #0 in region #0}} @@ -555,7 +555,7 @@ module attributes { transform.with_named_sequence } { // expected-remark @below {{output 0}} // expected-remark @below {{output producer}} // expected-remark @below {{all output}} - // expected-note @below {{value handle points to an op result #0}} + // expected-note @below 2 {{value handle points to an op result #0}} %0 = linalg.fill ins(%f32: f32) outs(%tf32: tensor<?xf32>) -> tensor<?xf32> linalg.generic { diff --git a/mlir/test/Dialect/Linalg/transform-op-specialize.mlir b/mlir/test/Dialect/Linalg/transform-op-specialize.mlir index 8ede2e0add10ba..0f5a7c5485d244 100644 --- a/mlir/test/Dialect/Linalg/transform-op-specialize.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-specialize.mlir @@ -58,7 +58,7 @@ func.func @copy_with_down_cast(%arg0: memref<?x?xf32>, %arg1: memref<?x?xf16>) { module attributes {transform.with_named_sequence} { transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) { %0 = transform.structured.match interface{LinalgOp} in %arg1 : (!transform.any_op) -> !transform.any_op - // expected-error @below {{failed to apply}} + // expected-error @below 4 {{failed to apply}} %1 = transform.structured.specialize %0 : (!transform.any_op) -> !transform.any_op transform.yield } diff --git a/mlir/test/Dialect/SCF/loop-pipelining.mlir b/mlir/test/Dialect/SCF/loop-pipelining.mlir index 99f8d84a6af2ec..5d36dff262be78 100644 --- a/mlir/test/Dialect/SCF/loop-pipelining.mlir +++ b/mlir/test/Dialect/SCF/loop-pipelining.mlir @@ -990,7 +990,7 @@ func.func @invalid_schedule2(%A: memref<?xf32>, %result: memref<?xf32>) { %c4 = arith.constant 4 : index %cf = arith.constant 1.0 : f32 %r = scf.for %i0 = %c0 to %c4 step %c1 iter_args(%idx = %c0) -> (index) { - // expected-error@+1 {{operation scheduled before its operands}} + // expected-error@+1 2 {{operation scheduled before its operands}} %A_elem = memref.load %A[%idx] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 0 } : memref<?xf32> %idx1 = arith.addi %idx, %c1 { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1 } : index memref.store %A_elem, %result[%idx] { __test_pipelining_stage__ = 2, __test_pipelining_op_order__ = 2 } : memref<?xf32> diff --git a/mlir/test/Dialect/Transform/check-use-after-free.mlir b/mlir/test/Dialect/Transform/check-use-after-free.mlir index 6c196e425a40a4..8896d49ba651db 100644 --- a/mlir/test/Dialect/Transform/check-use-after-free.mlir +++ b/mlir/test/Dialect/Transform/check-use-after-free.mlir @@ -117,7 +117,7 @@ func.func @use_after_free() { // precede the one that frees it in the same block. Both operations should // be reported as use-after-free. func.func @use_after_free_self_cycle() { - // expected-note @below {{allocated here}} + // expected-note @below 2 {{allocated here}} %0 = transform.test_produce_self_handle_or_forward_operand : () -> !transform.any_op transform.test_transform_op_with_regions { "transform.test_branching_transform_op_terminator"() : () -> () @@ -131,7 +131,7 @@ func.func @use_after_free_self_cycle() { ^bb0(%arg0: !transform.any_op): } // expected-warning @below {{operand #0 may be used after free}} - // expected-note @below {{freed here}} + // expected-note @below 2 {{freed here}} transform.test_consume_operand_of_op_kind_or_fail %0, "transform.test_produce_self_handle_or_forward_operand" : !transform.any_op "transform.test_branching_transform_op_terminator"()[^bb1, ^bb2] : () -> () ^bb2: diff --git a/mlir/test/Dialect/Transform/expensive-checks.mlir b/mlir/test/Dialect/Transform/expensive-checks.mlir index 397e988f62364b..03d01ff679677c 100644 --- a/mlir/test/Dialect/Transform/expensive-checks.mlir +++ b/mlir/test/Dialect/Transform/expensive-checks.mlir @@ -436,6 +436,7 @@ module attributes {transform.with_named_sequence} { module attributes {transform.with_named_sequence} { transform.named_sequence @__transform_main(%arg0: !transform.any_op) { // expected-note @below {{payload op}} + // expected-note @below {{nested payload op}} // expected-note @below {{handle to invalidated ops}} %0 = transform.test_produce_self_handle_or_forward_operand : () -> !transform.any_op transform.test_re_enter_region { diff --git a/mlir/test/Dialect/Transform/foreach-match.mlir b/mlir/test/Dialect/Transform/foreach-match.mlir index a7cd8e9ff543ee..e5208fa18d98ed 100644 --- a/mlir/test/Dialect/Transform/foreach-match.mlir +++ b/mlir/test/Dialect/Transform/foreach-match.mlir @@ -81,9 +81,9 @@ module attributes { transform.with_named_sequence } { // ----- -// expected-remark @below {{op from within the matcher}} +// expected-remark @below 2 {{op from within the matcher}} module attributes { transform.with_named_sequence } { - // expected-remark @below {{returned root}} + // expected-remark @below 2 {{returned root}} func.func @foo() { return } @@ -101,7 +101,7 @@ module attributes { transform.with_named_sequence } { %root: !transform.any_op {transform.readonly}, %param: !transform.param<i64> {transform.readonly}) -> (!transform.any_op, !transform.param<i64>) { transform.debug.emit_remark_at %root, "op from within the matcher" : !transform.any_op - // expected-remark @below {{param from within the matcher 42}} + // expected-remark @below 2 {{param from within the matcher 42}} transform.debug.emit_param_as_remark %param, "param from within the matcher" : !transform.param<i64> transform.yield %root, %param : !transform.any_op, !transform.param<i64> } diff --git a/mlir/test/Dialect/Transform/multi-arg-top-level-values.mlir b/mlir/test/Dialect/Transform/multi-arg-top-level-values.mlir index dcc1079267dc7c..b154f48e6940c4 100644 --- a/mlir/test/Dialect/Transform/multi-arg-top-level-values.mlir +++ b/mlir/test/Dialect/Transform/multi-arg-top-level-values.mlir @@ -2,10 +2,7 @@ // RUN: debug-bind-trailing-args=^test.some_returning_op,^test.some_other_returning_op})' \ // RUN: --split-input-file --verify-diagnostics -// Note that diagnostic checker will merge two diagnostics with the same message -// at the same location, so only check the remark once. -// -// expected-remark @below {{first extra}} +// expected-remark @below 2 {{first extra}} // expected-note @below {{value handle points to an op result #0}} // expected-note @below {{value handle points to an op result #1}} %0:2 = "test.some_returning_op"() : () -> (i32, i64) @@ -14,10 +11,7 @@ // expected-note @below {{value handle points to an op result #0}} %1 = "test.some_returning_op"() : () -> index -// Note that diagnostic checker will merge two diagnostics with the same message -// at the same location, so only check the remark once. -// -// expected-remark @below {{second extra}} +// expected-remark @below 2 {{second extra}} // expected-note @below {{value handle points to an op result #0}} // expected-note @below {{value handle points to an op result #1}} %2:2 = "test.some_other_returning_op"() : () -> (f32, f64) diff --git a/mlir/test/Dialect/Transform/ops-invalid.mlir b/mlir/test/Dialect/Transform/ops-invalid.mlir index 585736d30269e7..6ce9009d46cb2c 100644 --- a/mlir/test/Dialect/Transform/ops-invalid.mlir +++ b/mlir/test/Dialect/Transform/ops-invalid.mlir @@ -591,7 +591,7 @@ module attributes { transform.with_named_sequence } { // Note that printing a warning doesn't result in verification failures, so this // also checks for the IR being printed back. // CHECK-LABEL: transform.named_sequence @emit_warning_only - // expected-warning @below {{argument #0 is not consumed in the body but is marked as consume}} + // expected-warning @below 2 {{argument #0 is not consumed in the body but is marked as consume}} transform.named_sequence @emit_warning_only(%op: !transform.any_op {transform.consumed}) { transform.debug.emit_remark_at %op, "message" : !transform.any_op transform.yield diff --git a/mlir/test/Dialect/Transform/test-interpreter.mlir b/mlir/test/Dialect/Transform/test-interpreter.mlir index e05b7024e38762..d0bba4980e01be 100644 --- a/mlir/test/Dialect/Transform/test-interpreter.mlir +++ b/mlir/test/Dialect/Transform/test-interpreter.mlir @@ -105,7 +105,7 @@ func.func @foo() { return } -// expected-remark @below {{parent function}} +// expected-remark @below 2 {{parent function}} func.func @bar() { %0 = arith.constant 0 : i32 %1 = arith.constant 1 : i32 @@ -818,7 +818,7 @@ module attributes {transform.with_named_sequence} { transform.foreach %f : !transform.any_op { ^bb2(%arg2: !transform.any_op): %p = transform.num_associations %arg2 : (!transform.any_op) -> !transform.param<i64> - // expected-remark @below {{1}} + // expected-remark @below 2 {{1}} transform.debug.emit_param_as_remark %p : !transform.param<i64> transform.debug.emit_remark_at %arg2, "transform applied" : !transform.any_op } @@ -930,7 +930,7 @@ module attributes {transform.with_named_sequence} { %f = transform.structured.match ops{["arith.constant"]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.foreach %f : !transform.any_op { ^bb2(%arg2: !transform.any_op): - // expected-remark @below {{erasing}} + // expected-remark @below 4 {{erasing}} transform.test_emit_remark_and_erase_operand %arg2, "erasing" : !transform.any_op } transform.yield @@ -2349,9 +2349,9 @@ module attributes {transform.with_named_sequence} { // ----- func.func @get_parent_op() { - // expected-remark @below{{found test.foo parent}} + // expected-remark @below 2 {{found test.foo parent}} "test.foo"() ({ - // expected-remark @below{{direct parent}} + // expected-remark @below 2 {{direct parent}} "test.bar"() ({ "test.qux"() : () -> () "test.qux"() : () -> () diff --git a/mlir/test/IR/invalid-builtin-attributes.mlir b/mlir/test/IR/invalid-builtin-attributes.mlir index 2a64a6b697baa4..46efc7772cdaf8 100644 --- a/mlir/test/IR/invalid-builtin-attributes.mlir +++ b/mlir/test/IR/invalid-builtin-attributes.mlir @@ -615,7 +615,7 @@ func.func @duplicate_dictionary_attr_key() { // ----- -// expected-error@below {{expected attribute}} +// expected-error@below 2 {{expected attribute}} #attr = distinct[8]<attribute // ----- diff --git a/mlir/test/IR/test-verification-order.mlir b/mlir/test/IR/test-verification-order.mlir index d6d4c3acaf7e3b..208c85812e3457 100644 --- a/mlir/test/IR/test-verification-order.mlir +++ b/mlir/test/IR/test-verification-order.mlir @@ -45,9 +45,9 @@ func.func @verify_nested_isolated_above() { "test.verifiers"(%0) ({ // expected-remark@-1 {{success run of region verifier}} %1 = arith.constant 2 : i32 - // expected-remark@+1 {{success run of verifier}} + // expected-remark@+1 2 {{success run of verifier}} "test.verifiers"(%1) ({ - // expected-remark@-1 {{success run of region verifier}} + // expected-remark@-1 2 {{success run of region verifier}} %2 = arith.constant 3 : index }) : (i32) -> () }) : (i32) -> () >From a488a4847f911f289b3de40187495b8d644a5b9f Mon Sep 17 00:00:00 2001 From: Alex Richardson <[email protected]> Date: Wed, 28 Oct 2026 17:13:38 -0700 Subject: [PATCH 2/3] [nspr] update --- clang/test/CIR/IR/invalid-vtable.cir | 2 +- flang/test/Transforms/generic-loop-rewriting-todo.mlir | 2 +- mlir/test/Examples/transform/Ch1/invalidation-1.mlir | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/clang/test/CIR/IR/invalid-vtable.cir b/clang/test/CIR/IR/invalid-vtable.cir index f444a0ee5b539d..302e14cdd3abc3 100644 --- a/clang/test/CIR/IR/invalid-vtable.cir +++ b/clang/test/CIR/IR/invalid-vtable.cir @@ -60,7 +60,7 @@ module { !u64i = !cir.int<u, 64> !rec_anon_struct = !cir.struct<{data !cir.array<!u64i x 4>}> module { - // expected-error @below {{expected GlobalViewAttr or ConstPtrAttr}} + // expected-error @below 3 {{expected GlobalViewAttr or ConstPtrAttr}} cir.global external @_ZTV1S = #cir.vtable<{#cir.const_array<[#cir.int<1> : !u64i, #cir.int<1> : !u64i, #cir.int<3> : !u64i, #cir.int<4> : !u64i]> : !cir.array<!u64i x 4>}> : !rec_anon_struct align(8) cir.func private dso_local @_ZN1S3keyEv(%arg0: !cir.ptr<!rec_S>) cir.func private dso_local @_ZN1S6nonKeyEv(%arg0: !cir.ptr<!rec_S>) diff --git a/flang/test/Transforms/generic-loop-rewriting-todo.mlir b/flang/test/Transforms/generic-loop-rewriting-todo.mlir index 64094d61eb9a36..0b6b31feb4fb42 100644 --- a/flang/test/Transforms/generic-loop-rewriting-todo.mlir +++ b/flang/test/Transforms/generic-loop-rewriting-todo.mlir @@ -5,7 +5,7 @@ func.func @_QPloop_order() { %c10 = arith.constant 10 : i32 %c1 = arith.constant 1 : i32 - // expected-error@below {{not yet implemented: Unhandled clause order in omp.loop operation}} + // expected-error@below 2 {{not yet implemented: Unhandled clause order in omp.loop operation}} omp.loop order(reproducible:concurrent) { omp.loop_nest (%arg3) : i32 = (%c0) to (%c10) inclusive step (%c1) { omp.yield diff --git a/mlir/test/Examples/transform/Ch1/invalidation-1.mlir b/mlir/test/Examples/transform/Ch1/invalidation-1.mlir index 6f2257c360e07e..0579b6e8df0190 100644 --- a/mlir/test/Examples/transform/Ch1/invalidation-1.mlir +++ b/mlir/test/Examples/transform/Ch1/invalidation-1.mlir @@ -34,6 +34,7 @@ func.func @fc_relu(%lhs: tensor<512x512xf32>, %rhs: tensor<512x512xf32>, %bias: tensor<512x512xf32>, %output: tensor<512x512xf32>) -> tensor<512x512xf32> { // Matrix-matrix multiplication. + // expected-note @below {{nested payload op}} // expected-note @below {{payload op}} %matmul = linalg.matmul ins(%lhs, %rhs: tensor<512x512xf32>, tensor<512x512xf32>) outs(%output: tensor<512x512xf32>) -> tensor<512x512xf32> @@ -83,6 +84,7 @@ func.func @fc_relu(%lhs: tensor<512x512xf32>, %rhs: tensor<512x512xf32>, %bias: tensor<512x512xf32>, %output: tensor<512x512xf32>) -> tensor<512x512xf32> { // Matrix-matrix multiplication. + // expected-note @below {{nested payload op}} // expected-note @below {{payload op}} %matmul = linalg.matmul ins(%lhs, %rhs: tensor<512x512xf32>, tensor<512x512xf32>) outs(%output: tensor<512x512xf32>) -> tensor<512x512xf32> >From 41ad2f5f4854176dc79d013e4bfb4df27127a984 Mon Sep 17 00:00:00 2001 From: Alex Richardson <[email protected]> Date: Mon, 2 Nov 2026 22:10:59 -0800 Subject: [PATCH 3/3] [nspr] update --- mlir/test/Dialect/Transform/expensive-checks.mlir | 2 +- mlir/test/Examples/transform/Ch1/invalidation-1.mlir | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mlir/test/Dialect/Transform/expensive-checks.mlir b/mlir/test/Dialect/Transform/expensive-checks.mlir index 03d01ff679677c..3b7cd6d72b9d65 100644 --- a/mlir/test/Dialect/Transform/expensive-checks.mlir +++ b/mlir/test/Dialect/Transform/expensive-checks.mlir @@ -435,7 +435,7 @@ module attributes {transform.with_named_sequence} { // Consuming the same handle repeatedly in the region should trigger an error. module attributes {transform.with_named_sequence} { transform.named_sequence @__transform_main(%arg0: !transform.any_op) { - // expected-note @below {{payload op}} + // expected-note @below {{ancestor payload op}} // expected-note @below {{nested payload op}} // expected-note @below {{handle to invalidated ops}} %0 = transform.test_produce_self_handle_or_forward_operand : () -> !transform.any_op diff --git a/mlir/test/Examples/transform/Ch1/invalidation-1.mlir b/mlir/test/Examples/transform/Ch1/invalidation-1.mlir index 0579b6e8df0190..8a10b3512c38dd 100644 --- a/mlir/test/Examples/transform/Ch1/invalidation-1.mlir +++ b/mlir/test/Examples/transform/Ch1/invalidation-1.mlir @@ -34,8 +34,8 @@ func.func @fc_relu(%lhs: tensor<512x512xf32>, %rhs: tensor<512x512xf32>, %bias: tensor<512x512xf32>, %output: tensor<512x512xf32>) -> tensor<512x512xf32> { // Matrix-matrix multiplication. + // expected-note @below {{ancestor payload op}} // expected-note @below {{nested payload op}} - // expected-note @below {{payload op}} %matmul = linalg.matmul ins(%lhs, %rhs: tensor<512x512xf32>, tensor<512x512xf32>) outs(%output: tensor<512x512xf32>) -> tensor<512x512xf32> @@ -84,8 +84,8 @@ func.func @fc_relu(%lhs: tensor<512x512xf32>, %rhs: tensor<512x512xf32>, %bias: tensor<512x512xf32>, %output: tensor<512x512xf32>) -> tensor<512x512xf32> { // Matrix-matrix multiplication. + // expected-note @below {{ancestor payload op}} // expected-note @below {{nested payload op}} - // expected-note @below {{payload op}} %matmul = linalg.matmul ins(%lhs, %rhs: tensor<512x512xf32>, tensor<512x512xf32>) outs(%output: tensor<512x512xf32>) -> tensor<512x512xf32> _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
