[Mlir-commits] [mlir] 0aa97ad - [mlir] Change generate-test-checks.py to `%[[V:.*]]` style

Sean Silva llvmlistbot at llvm.org
Wed May 13 14:50:35 PDT 2020


Author: Sean Silva
Date: 2020-05-13T14:50:14-07:00
New Revision: 0aa97ad5c8a6153de1479e50fcbe03a6a425e193

URL: https://github.com/llvm/llvm-project/commit/0aa97ad5c8a6153de1479e50fcbe03a6a425e193
DIFF: https://github.com/llvm/llvm-project/commit/0aa97ad5c8a6153de1479e50fcbe03a6a425e193.diff

LOG: [mlir] Change generate-test-checks.py to `%[[V:.*]]` style

Summary:
This style seems to be the preferred style lately as it plays better
with op syntaxes that include `[` and `]`.

Input:
```
module {
  func @f(%arg0 : i32) -> i32 {
    %0 = addi %arg0, %arg0 : i32
    %1 = muli %arg0, %0 : i32
    return %1 : i32
  }
}
```

New output:

```
// NOTE: Assertions have been autogenerated by utils/generate-test-checks.py
// CHECK:       module {

// CHECK-LABEL:   func @f(
// CHECK-SAME:            %[[VAL_0:.*]] : i32) -> i32 {
// CHECK:           %[[VAL_1:.*]] = addi %[[VAL_0]], %[[VAL_0]] : i32
// CHECK:           %[[VAL_2:.*]] = muli %[[VAL_0]], %[[VAL_1]] : i32
// CHECK:           return %[[VAL_2]] : i32
// CHECK:         }
// CHECK:       }
```

Old output:
```
// NOTE: Assertions have been autogenerated by utils/generate-test-checks.py
// CHECK:       module {

// CHECK-LABEL:   func @f(
// CHECK-SAME:            [[VAL_0:%.*]] : i32) -> i32 {
// CHECK:           [[VAL_1:%.*]] = addi [[VAL_0]], [[VAL_0]] : i32
// CHECK:           [[VAL_2:%.*]] = muli [[VAL_0]], [[VAL_1]] : i32
// CHECK:           return [[VAL_2]] : i32
// CHECK:         }
// CHECK:       }
```

Differential Revision: https://reviews.llvm.org/D79836

Added: 
    

Modified: 
    mlir/utils/generate-test-checks.py

Removed: 
    


################################################################################
diff  --git a/mlir/utils/generate-test-checks.py b/mlir/utils/generate-test-checks.py
index 6dc40c797e28..dbfcbd52091a 100755
--- a/mlir/utils/generate-test-checks.py
+++ b/mlir/utils/generate-test-checks.py
@@ -75,11 +75,11 @@ def process_line(line_chunks, variable_namer):
 
     # If one exists, then output the existing name.
     if variable is not None:
-      output_line += '[[' + variable + ']]'
+      output_line += '%[[' + variable + ']]'
     else:
       # Otherwise, generate a new variable.
       variable = variable_namer.generate_name(ssa_name)
-      output_line += '[[' + variable + ':%.*]]'
+      output_line += '%[[' + variable + ':.*]]'
 
     # Append the non named group.
     output_line += chunk[len(ssa_name):]


        


More information about the Mlir-commits mailing list