This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][Presburger] Make constructors from PresburgerSpace explicit
ClosedPublic

Authored by Groverkss on Apr 2 2022, 5:23 AM.

Details

Summary

This patch makes constructors of IntegerRelation, IntegerPolyhedron,
PresburgerRelation, PresburgerSet from PresburgerSpace explicit. This
prevents bugs like:

void fun(IntegerRelation a, IntegerRelation b) {
  IntegerPolyhedron c = a.intersect(b);
}

Here, a.intersect(b) will return IntegerRelation, which will be implicitly
converted to PresburgerSpace and will use the PresburgerSpace constructor
for IntegerPolyhedron. Leading to loss of any constraints in the intersection
of a and b. After this patch, this will give a compile error.

Diff Detail

Event Timeline

Groverkss created this revision.Apr 2 2022, 5:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 2 2022, 5:23 AM
Groverkss requested review of this revision.Apr 2 2022, 5:23 AM
arjunp accepted this revision.Apr 2 2022, 5:42 AM
arjunp edited the summary of this revision. (Show Details)

LGTM

This revision is now accepted and ready to land.Apr 2 2022, 5:42 AM