This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][Presburger] Add getDomainSet, getRangeSet to IntegerRelation
ClosedPublic

Authored by Groverkss on May 24 2022, 1:56 PM.

Details

Summary

This patch adds support for obtaining a set corresponding to the domain/range
of the relation.

Diff Detail

Event Timeline

Groverkss created this revision.May 24 2022, 1:56 PM
Groverkss requested review of this revision.May 24 2022, 1:56 PM
ftynse added inline comments.May 25 2022, 5:20 AM
mlir/include/mlir/Analysis/Presburger/IntegerRelation.h
657

Should this be marked explicit? Given this can assert, it sounds preferable for the user to explicitly request the conversion rather than have it fire in some implicit conversion sequence.

mlir/lib/Analysis/Presburger/IntegerRelation.cpp
2089

Looks like you only need to provide IntegerPolyhedron(IntegerRelation &&) for this, so why not do it immediately rather than leaving a todo?

2090–2091

Doing return IntegerPolyhedron(copyRel); (or return IntegerPolyhedron(std::move(copyRel)); will guarantee copy/move elision in C++17. Naming the value will not, although the compiler is likely to figure it out on its own.

Groverkss updated this revision to Diff 431972.May 25 2022, 6:57 AM
Groverkss marked 3 inline comments as done.
  • Make IntegerPolyhedron constructor from IntegerRelation explicit.
  • Add move constructor for IntegerPolyhedron and use it.
ftynse accepted this revision.May 25 2022, 7:01 AM
This revision is now accepted and ready to land.May 25 2022, 7:01 AM
This revision was landed with ongoing or failed builds.May 25 2022, 7:06 AM
This revision was automatically updated to reflect the committed changes.