This can happen for e.g. func.func
with no references and some attribute alias in the attributes or in return types.
Reproducing example:
// test.mlir
func.func @test() attributes {amap = affine_map<(d0, d1)[s0] -> (d0, d0 + d1 + s0 floordiv 2)>, bmap = affine_map<(d0, d1) -> (d0, d1)>} {
return
}
generate-test-checks.py
can be run as follows on this input:
mlir-opt test.mlir | ./mlir/utils/generate-test-checks.py
producing the following output:
// ...
// CHECK: #[[$ATTR_0:.+]] = affine_map<(d0, d1)[s0] -> (d0, d0 + d1 + s0 floordiv 2)>
// CHECK: #[[$ATTR_1:.+]] = affine_map<(d0, d1) -> (d0, d1)>
// CHECK-LABEL: func.func @test() attributes {amap = #map, bmap = #map1} {
// CHECK: return
// CHECK: }
See how the attribute aliases in the CHECK-LABEL
line do not use the CHECK variables assigned to them.
As CHECK-LABEL
lines may not contain variable references, the expected output for this case should in my opinion include an extra line break before the first variable reference:
// ...
// CHECK: #[[$ATTR_0:.+]] = affine_map<(d0, d1)[s0] -> (d0, d0 + d1 + s0 floordiv 2)>
// CHECK: #[[$ATTR_1:.+]] = affine_map<(d0, d1) -> (d0, d1)>
// CHECK-LABEL: func.func @test() attributes {amap =
// CHECK-SAME: #[[$ATTR_0]], bmap = #[[$ATTR_1]]} {
// CHECK: return
// CHECK: }