When invoking `-test-bytecode-roundtrip=test-dialect-version=X.Y` on a module that contains no test dialect operations, the reader type callback in `runTest0` called `reader.getDialectVersion<test::TestDialect>()` and then immediately asserted that it succeeded. However, if the test dialect was never referenced in the bytecode (because no test dialect types appear in the module), the dialect's version information is not stored in the bytecode, so `getDialectVersion` legitimately returns failure. When the test dialect version is unavailable in the bytecode being read, the module contains no test dialect types, so no "funky"-group overrides are needed and the callback can safely skip by returning `success()`. A regression test is added with a module that has no test dialect ops, exercising the `test-dialect-version=2.0` path that previously crashed. Fixes #128321 Fixes #128325 Assisted-by: Claude Code
28 lines
1.2 KiB
MLIR
28 lines
1.2 KiB
MLIR
// RUN: mlir-opt %s --test-bytecode-roundtrip="test-dialect-version=1.2" -verify-diagnostics | FileCheck %s --check-prefix=VERSION_1_2
|
|
// RUN: mlir-opt %s --test-bytecode-roundtrip="test-dialect-version=2.0" -verify-diagnostics | FileCheck %s --check-prefix=VERSION_2_0
|
|
// RUN: mlir-opt %s --split-input-file --test-bytecode-roundtrip="test-dialect-version=2.0" -verify-diagnostics | FileCheck %s --check-prefix=NO_TEST_DIALECT
|
|
|
|
func.func @base_test(%arg0 : i32) -> f32 {
|
|
%0 = "test.addi"(%arg0, %arg0) : (i32, i32) -> i32
|
|
%1 = "test.cast"(%0) : (i32) -> f32
|
|
return %1 : f32
|
|
}
|
|
|
|
// VERSION_1_2: Overriding IntegerType encoding...
|
|
// VERSION_1_2: Overriding parsing of IntegerType encoding...
|
|
|
|
// VERSION_2_0-NOT: Overriding IntegerType encoding...
|
|
// VERSION_2_0-NOT: Overriding parsing of IntegerType encoding...
|
|
|
|
// -----
|
|
|
|
// Regression test for https://github.com/llvm/llvm-project/issues/128321:
|
|
// test-bytecode-roundtrip must not crash when the test dialect is absent from
|
|
// the module (i.e., no test dialect types are present in the bytecode).
|
|
|
|
// NO_TEST_DIALECT-NOT: Overriding IntegerType encoding...
|
|
// NO_TEST_DIALECT: func.func @no_test_dialect_ops
|
|
func.func @no_test_dialect_ops() {
|
|
return
|
|
}
|