This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][presburger] normalize divisionrepr
ClosedPublic

Authored by gilsaia on Apr 1 2023, 10:46 AM.

Details

Summary

Added a simple normalize function to divisionrepr and added a simple unittest.
Added a normalizediv call to divisionrepr's removeDuplicateDivs function, which now eliminates divs that are consistent after gcd's normalize

Diff Detail

Event Timeline

gilsaia created this revision.Apr 1 2023, 10:46 AM
gilsaia requested review of this revision.Apr 1 2023, 10:46 AM
gilsaia retitled this revision from feat:normalize divisionrepr to [MLIR][presburger] normalize divisionrepr.Apr 1 2023, 10:53 AM
gilsaia edited the summary of this revision. (Show Details)
gilsaia added reviewers: Groverkss, arjunp, bondhugula.
Groverkss requested changes to this revision.Apr 2 2023, 2:55 AM

Thank you for the patch! I added some comments to get started.

mlir/include/mlir/Analysis/Presburger/Utils.h
159

Please add documentation for this method.

mlir/lib/Analysis/Presburger/Utils.cpp
434

I don't think this solves this TODO. That is a separate issue. That TODO refers to cases when divisionA = divisionB + constant. I would not delete that TODO.

477

I prefer writing this loop like this:

for (unsigned i = 0, e = getNumDivs(); i < e; ++i)

That is the preferred method of writing loops when the end condition does not change throughout the loop

478
483

You can drop the return here.

mlir/unittests/Analysis/Presburger/CMakeLists.txt
13

I would name this file UtilsTest.cpp maybe.

This revision now requires changes to proceed.Apr 2 2023, 2:55 AM
gilsaia edited the summary of this revision. (Show Details)Apr 2 2023, 3:08 AM
gilsaia edited the summary of this revision. (Show Details)Apr 2 2023, 3:14 AM
gilsaia updated this revision to Diff 510332.Apr 2 2023, 3:36 AM

Add comments,change formatting and naming

gilsaia marked 6 inline comments as done.Apr 8 2023, 12:56 AM
Groverkss added inline comments.Apr 10 2023, 6:51 AM
mlir/include/mlir/Analysis/Presburger/Utils.h
160

I don't think you need to mention "other than 1". That just makes it confusing.

gilsaia updated this revision to Diff 512143.Apr 10 2023, 7:46 AM

change comment

gilsaia marked an inline comment as done.Apr 10 2023, 7:46 AM
This revision is now accepted and ready to land.Apr 18 2023, 8:47 AM
This revision was automatically updated to reflect the committed changes.