Files
RedBear-OS/local/recipes/dev/libclc/source/mlir/test/IR/dynamic.mlir
T
vasilito cb424d7448 build: static patch-sanity linter (shift-left the malformed-patch class)
verify-patch-sanity.py validates every active recipe .patch has internally-
consistent hunk line counts — catching the 'malformed patch at line N' failure
at commit/CI/preflight time instead of hours into a cook. This cycle hit that
class three times (qtwaylandscanner, sddm, xwayland), each only discovered when
cookbook tried to apply the patch.

Running it across the repo found 29 latent malformed patches (validated against
GNU patch: e.g. relibc/P3-sysv-ipc reproduces 'malformed patch at line 22').
They were harmless only because they sit in vendored recipes (baked, not re-
applied) — but would fail on any version-bump re-derivation. --fix recounts the
hunk headers (body untouched) and repaired all 29.

Wired into build-preflight.sh (Phase 1.0D) and redbear-ci.yml, with a unit test
(test-patch-sanity.sh). Skips archived/legacy trees and unvalidatable formats
(empty placeholders, bare-@@ git hunks).
2026-08-01 05:13:02 +03:00

142 lines
4.8 KiB
MLIR

// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -verify-diagnostics | FileCheck %s
// Verify that extensible dialects can register dynamic operations and types.
//===----------------------------------------------------------------------===//
// Dynamic type
//===----------------------------------------------------------------------===//
// CHECK-LABEL: func @succeededDynamicTypeVerifier
func.func @succeededDynamicTypeVerifier() {
// CHECK: %{{.*}} = "unregistered_op"() : () -> !test.dynamic_singleton
"unregistered_op"() : () -> !test.dynamic_singleton
// CHECK-NEXT: "unregistered_op"() : () -> !test.dynamic_pair<i32, f64>
"unregistered_op"() : () -> !test.dynamic_pair<i32, f64>
// CHECK-NEXT: %{{.*}} = "unregistered_op"() : () -> !test.dynamic_pair<!test.dynamic_pair<i32, f64>, !test.dynamic_singleton>
"unregistered_op"() : () -> !test.dynamic_pair<!test.dynamic_pair<i32, f64>, !test.dynamic_singleton>
return
}
// -----
func.func @failedDynamicTypeVerifier() {
// expected-error@+1 {{expected 0 type arguments, but had 1}}
"unregistered_op"() : () -> !test.dynamic_singleton<f64>
return
}
// -----
func.func @failedDynamicTypeVerifier2() {
// expected-error@+1 {{expected 2 type arguments, but had 1}}
"unregistered_op"() : () -> !test.dynamic_pair<f64>
return
}
// -----
// CHECK-LABEL: func @customTypeParserPrinter
func.func @customTypeParserPrinter() {
// CHECK: "unregistered_op"() : () -> !test.dynamic_custom_assembly_format<f32:f64>
"unregistered_op"() : () -> !test.dynamic_custom_assembly_format<f32 : f64>
return
}
// -----
//===----------------------------------------------------------------------===//
// Dynamic attribute
//===----------------------------------------------------------------------===//
// CHECK-LABEL: func @succeededDynamicAttributeVerifier
func.func @succeededDynamicAttributeVerifier() {
// CHECK: "unregistered_op"() {test_attr = #test.dynamic_singleton} : () -> ()
"unregistered_op"() {test_attr = #test.dynamic_singleton} : () -> ()
// CHECK-NEXT: "unregistered_op"() {test_attr = #test.dynamic_pair<3 : i32, 5 : i32>} : () -> ()
"unregistered_op"() {test_attr = #test.dynamic_pair<3 : i32, 5 : i32>} : () -> ()
// CHECK-NEXT: "unregistered_op"() {test_attr = #test.dynamic_pair<#test.dynamic_pair<3 : i32, 5 : i32>, f64>} : () -> ()
"unregistered_op"() {test_attr = #test.dynamic_pair<#test.dynamic_pair<3 : i32, 5 : i32>, f64>} : () -> ()
return
}
// -----
func.func @failedDynamicAttributeVerifier() {
// expected-error@+1 {{expected 0 attribute arguments, but had 1}}
"unregistered_op"() {test_attr = #test.dynamic_singleton<f64>} : () -> ()
return
}
// -----
func.func @failedDynamicAttributeVerifier2() {
// expected-error@+1 {{expected 2 attribute arguments, but had 1}}
"unregistered_op"() {test_attr = #test.dynamic_pair<f64>} : () -> ()
return
}
// -----
// CHECK-LABEL: func @customAttributeParserPrinter
func.func @customAttributeParserPrinter() {
// CHECK: "unregistered_op"() {test_attr = #test.dynamic_custom_assembly_format<f32:f64>} : () -> ()
"unregistered_op"() {test_attr = #test.dynamic_custom_assembly_format<f32:f64>} : () -> ()
return
}
//===----------------------------------------------------------------------===//
// Dynamic op
//===----------------------------------------------------------------------===//
// -----
// CHECK-LABEL: func @succeededDynamicOpVerifier
func.func @succeededDynamicOpVerifier(%a: f32) {
// CHECK: "test.dynamic_generic"() : () -> ()
// CHECK-NEXT: %{{.*}} = "test.dynamic_generic"(%{{.*}}) : (f32) -> f64
// CHECK-NEXT: %{{.*}}:2 = "test.dynamic_one_operand_two_results"(%{{.*}}) : (f32) -> (f64, f64)
"test.dynamic_generic"() : () -> ()
"test.dynamic_generic"(%a) : (f32) -> f64
"test.dynamic_one_operand_two_results"(%a) : (f32) -> (f64, f64)
return
}
// -----
func.func @failedDynamicOpVerifier() {
// expected-error@+1 {{expected 1 operand, but had 0}}
"test.dynamic_one_operand_two_results"() : () -> (f64, f64)
return
}
// -----
func.func @failedDynamicOpVerifier2(%a: f32) {
// expected-error@+1 {{expected 2 results, but had 0}}
"test.dynamic_one_operand_two_results"(%a) : (f32) -> ()
return
}
// -----
// CHECK-LABEL: func @customOpParserPrinter
func.func @customOpParserPrinter() {
// CHECK: test.dynamic_custom_parser_printer custom_keyword
test.dynamic_custom_parser_printer custom_keyword
return
}
//===----------------------------------------------------------------------===//
// Dynamic dialect
//===----------------------------------------------------------------------===//
// -----
// Check that the verifier of a dynamic operation in a dynamic dialect
// can fail. This shows that the dialect is correctly registered.
func.func @failedDynamicDialectOpVerifier() {
// expected-error@+1 {{expected a single result, no operands and no regions}}
"test_dyn.one_result"() : () -> ()
return
}