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

Sean Silva via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 12 20:29:07 PDT 2020


silvas created this revision.
silvas added a reviewer: nicolasvasilache.
Herald added subscribers: llvm-commits, Kayjukh, frgossen, grosul1, Joonsoo, stephenneuendorffer, liufengdb, lucyrfox, mgester, arpith-jacob, antiagainst, shauheen, jpienaar, rriddle, mehdi_amini.
Herald added a project: LLVM.

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:       }


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79836

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


Index: mlir/utils/generate-test-checks.py
===================================================================
--- mlir/utils/generate-test-checks.py
+++ mlir/utils/generate-test-checks.py
@@ -75,11 +75,11 @@
 
     # 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):]


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79836.263597.patch
Type: text/x-patch
Size: 674 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200513/52707a0c/attachment.bin>


More information about the llvm-commits mailing list