Skip to content

Commit 8fc82e1

Browse files
committed
[MLIR] Restore dropped error message to fix test failures from PR llvm#160331
PR llvm#160331 introduced a mistake that removed the error message for generate-runtime-verification pass, leading to two test failures during `check-mlir` build. This patch restores the missing error message, resolving the failures. Verified locally. Fixes post-merge regression from: llvm#160331
1 parent c3aa158 commit 8fc82e1

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

mlir/lib/Transforms/GenerateRuntimeVerification.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ class DefaultErrMsgGenerator {
5151
stream << "ERROR: Runtime op verification failed\n";
5252
if (vLevel == 1) {
5353
op->print(stream, state);
54-
stream << "\n";
54+
stream << "\n^ " << msg;
55+
stream << "\nLocation: ";
56+
} else{
57+
stream << "^\nLocation: ";
5558
}
56-
stream << "^\nLocation: ";
5759
op->getLoc().print(stream);
5860
return buffer;
5961
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// RUN: mlir-opt %s -generate-runtime-verification \
2+
// RUN: -expand-strided-metadata \
3+
// RUN: -test-cf-assert \
4+
// RUN: -convert-to-llvm | \
5+
// RUN: mlir-runner -e main -entry-point-result=void \
6+
// RUN: -shared-libs=%mlir_runner_utils 2>&1 | \
7+
// RUN: FileCheck %s
8+
9+
// RUN: mlir-opt %s -generate-runtime-verification \
10+
// RUN: -expand-strided-metadata \
11+
// RUN: -test-cf-assert \
12+
// RUN: -convert-to-llvm="allow-pattern-rollback=0" \
13+
// RUN: -reconcile-unrealized-casts | \
14+
// RUN: mlir-runner -e main -entry-point-result=void \
15+
// RUN: -shared-libs=%mlir_runner_utils 2>&1 | \
16+
// RUN: FileCheck %s
17+
18+
func.func @main() {
19+
%c4 = arith.constant 4 : index
20+
%alloca = memref.alloca() : memref<1xf32>
21+
22+
// CHECK: ERROR: Runtime op verification failed
23+
// CHECK-NEXT: "memref.dim"(%{{.*}}, %{{.*}}) : (memref<1xf32>, index) -> index
24+
// CHECK-NEXT: ^ index is out of bounds
25+
// CHECK-NEXT: Location: loc({{.*}})
26+
%dim = memref.dim %alloca, %c4 : memref<1xf32>
27+
28+
return
29+
}

0 commit comments

Comments
 (0)