This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] Add unit test for tblgen Op build methods
ClosedPublic

Authored by jurahul on Jul 17 2020, 3:45 PM.

Details

Summary
  • Initiate the unit test with a test that tests various variants of build() methods generated for ops with variadic operands and results.
  • The intent is to migrate unit .td tests in mlir/test/mlir-tblgen that check for generated C++ code to these unit tests which test both that the generated code compiles and also is functionally correct.

Diff Detail

Event Timeline

jurahul created this revision.Jul 17 2020, 3:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 17 2020, 3:45 PM
jurahul updated this revision to Diff 278927.Jul 17 2020, 4:19 PM

Fix clamg-tidy warnings

jpienaar accepted this revision.Jul 23 2020, 9:58 AM
jpienaar added inline comments.
mlir/unittests/TableGen/OpBuildGen.cpp
15

clang-tidy: warning: #includes are not sorted properly [llvm-include-order]

155

I couldn't quite follow the matrix being formed here

{single variadic arg} x {single variadic result, multiple variadic results, non variadic result} ?

I think you have a reason for this configuration, but it isn't clear just looking at the code why (for example) multiple variadic args need not be tested.

Perhaps a comment would help there.

This revision is now accepted and ready to land.Jul 23 2020, 9:58 AM
jurahul updated this revision to Diff 281284.Jul 28 2020, 10:30 AM

Address review comment

I have added a comment explaining why I am testing these 3 combinations in particulat:

I think you have a reason for this configuration, but it isn't clear just looking at the code why (for example) multiple variadic args need not be tested.

In general, I'd expect that this test evolves to test all possible build methods, including for multiple variadic args, but it's not being done in this change.

This revision was landed with ongoing or failed builds.Jul 28 2020, 3:44 PM
This revision was automatically updated to reflect the committed changes.