mirror of
https://github.com/intel/llvm.git
synced 2026-02-01 17:07:36 +08:00
This patch updates generate-test-checks.py to preserve original SSA
names (capitalized) when generating LIT variable names for function
arguments (i.e. for `CHECK-SAME` lines). This improves readability and
helps maintain consistency between the input MLIR and the expected
FileCheck/LIT output.
For example, given the following function:
```mlir
func.func @example(
%input: memref<4x6x3xf32>,
%filter: memref<1x3x8xf32>,
%output: memref<4x2x8xf32>) {
linalg.conv_1d_nwc_wcf
{dilations = dense<1> : tensor<1xi64>, strides = dense<3> : tensor<1xi64>}
ins(%input, %filter : memref<4x6x3xf32>, memref<1x3x8xf32>)
outs(%output : memref<4x2x8xf32>)
return
}
```
The generated output becomes:
```mlir
// CHECK-LABEL: func.func @conv1d_nwc_4x2x8_memref(
// CHECK-SAME: %[[INPUT:.*]]: memref<4x6x3xf32>,
// CHECK-SAME: %[[FILTER:.*]]: memref<1x3x8xf32>,
// CHECK-SAME: %[[OUTPUT:.*]]: memref<4x2x8xf32>) {
// CHECK: linalg.conv_1d_nwc_wcf
// CHECK: {dilations = dense<1> : tensor<1xi64>, strides = dense<3> : tensor<1xi64>}
// CHECK: ins(%[[INPUT]], %[[FILTER]] : memref<4x6x3xf32>, memref<1x3x8xf32>)
// CHECK: outs(%[[OUTPUT]] : memref<4x2x8xf32>)
// CHECK: return
// CHECK: }
```
By contrast, the current version of the script would generate:
```mlir
// CHECK-LABEL: func.func @conv1d_nwc_4x2x8_memref(
// CHECK-SAME: %[[VAL_0:.*]]: memref<4x6x3xf32>,
// CHECK-SAME: %[[VAL_1:.*]]: memref<1x3x8xf32>,
// CHECK-SAME: %[[VAL_2:.*]]: memref<4x2x8xf32>) {
// CHECK: linalg.conv_1d_nwc_wcf
// CHECK: {dilations = dense<1> : tensor<1xi64>, strides = dense<3> : tensor<1xi64>}
// CHECK: ins(%[[VAL_0]], %[[VAL_1]] : memref<4x6x3xf32>, memref<1x3x8xf32>)
// CHECK: outs(%[[VAL_2]] : memref<4x2x8xf32>)
// CHECK: return
// CHECK: }
```