This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by silvas on May 12 2020, 8:22 PM.

Details

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

Diff Detail

Event Timeline

silvas created this revision.May 12 2020, 8:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 12 2020, 8:22 PM
ftynse added a subscriber: ftynse.May 13 2020, 2:07 AM

I prefer this style because it makes clear what's value and what's something else when also pattern-matching named attributes for example.

ftynse accepted this revision.May 13 2020, 2:07 AM
This revision is now accepted and ready to land.May 13 2020, 2:07 AM

On my end, the biggest benefit I see is when captured values are used to index.
FileCheck does not like [[[ and so one must resort to heavy escaping sequences.
[%[[ works much better.

nicolasvasilache accepted this revision.May 13 2020, 6:21 AM
This revision was automatically updated to reflect the committed changes.