This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] Simplify division extraction unit testing.
ClosedPublic

Authored by pashu123 on Dec 6 2021, 5:02 AM.

Details

Summary

The new getLocalReprs function also outputs dividends and
denominators and hence the CheckDivisionRepresentation fn is
modified to take the newer getLocalReprs function into account.

Signed-off-by: Prashant Kumar <pk5561@gmail.com>

Diff Detail

Event Timeline

pashu123 created this revision.Dec 6 2021, 5:02 AM
pashu123 requested review of this revision.Dec 6 2021, 5:02 AM
pashu123 updated this revision to Diff 392028.Dec 6 2021, 5:05 AM

Clang format.

pashu123 updated this revision to Diff 392029.Dec 6 2021, 5:06 AM

Removing unnecessary changes.

Groverkss requested changes to this revision.Dec 6 2021, 5:24 AM

Thank you for this simplification!

Could you change the revision title to better reflect the changes? Something like [MLIR] Simplify division extraction unit testing maybe?

mlir/unittests/Analysis/AffineStructuresTest.cpp
653–654

Please use camelBack for variables (https://mlir.llvm.org/getting_started/DeveloperGuide/)

653–666

I think you can remove this. We don't need to check repr at all. Checking dividends and denominators is enough.

655–657

I don't think you need to extract the inequalities here (repr).

655–659

These asserts should be at top of the function body.

656–659

You can replace this with EXPECT_EQ(trueDividends == dividends).

661–663

You can replace this with EXPECT_EQ(trueDenominators == denominators).

This revision now requires changes to proceed.Dec 6 2021, 5:24 AM
Groverkss added inline comments.Dec 6 2021, 5:26 AM
mlir/unittests/Analysis/AffineStructuresTest.cpp
653–654

I think expectedDividends, expectedDenominators is a better name. Also, doc comment for this function needs to be updated with this.

pashu123 added inline comments.Dec 6 2021, 7:32 AM
mlir/unittests/Analysis/AffineStructuresTest.cpp
661–663

I think it's EXPECT_TRUE(...), EXPECT_EQ macro expects two arguments.

pashu123 updated this revision to Diff 392062.Dec 6 2021, 7:43 AM

Addressing Groverkss comments.

pashu123 retitled this revision from Update the `getLocalReprs` fn in `CheckDivisionRepresentation` to [MLIR] Simplify division extraction unit testing..Dec 6 2021, 7:47 AM
pashu123 marked an inline comment as done.
pashu123 added inline comments.
mlir/unittests/Analysis/AffineStructuresTest.cpp
655–659

The size asserts can only happen after passing the variables through getLocalRepr fn.

pashu123 updated this revision to Diff 392066.Dec 6 2021, 7:55 AM

Renaming variable names in comments.

Groverkss added inline comments.Dec 6 2021, 7:59 AM
mlir/unittests/Analysis/AffineStructuresTest.cpp
662–666

Since this is a test, we can get rid of these asserts also. EXPECT_TRUE below will catch this.

667–672
pashu123 updated this revision to Diff 392095.Dec 6 2021, 9:06 AM

Removing asserts.

pashu123 marked 6 inline comments as done.Dec 6 2021, 9:07 AM
Groverkss accepted this revision.Dec 6 2021, 2:30 PM

LGTM. Thank you!

This revision is now accepted and ready to land.Dec 6 2021, 2:30 PM
This revision was automatically updated to reflect the committed changes.