This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][Presburger] refactor subtraction to be non-recursive
ClosedPublic

Authored by arjunp on Apr 6 2022, 1:18 PM.

Details

Summary

Subtraction was previously implemented recursively. This refactors it to be
non-recursive to avoid issues with potential stack overflows.

Diff Detail

Event Timeline

arjunp created this revision.Apr 6 2022, 1:18 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 6 2022, 1:18 PM
arjunp requested review of this revision.Apr 6 2022, 1:18 PM
Groverkss added inline comments.Apr 7 2022, 4:05 AM
mlir/lib/Analysis/Presburger/PresburgerRelation.cpp
185

Can you call it something other than "local variables" to prevent confusion with "IdKind::Local variables"?

185

Also, don't you have 5 local variables.

199
200–201

This seems like a broken sentence.

231–232

This comment needs to be updated.

244–245

Why change this to auto?

346

This continue is redundant right?

arjunp updated this revision to Diff 421189.Apr 7 2022, 6:41 AM
arjunp marked 7 inline comments as done.

Address comments.

arjunp added a comment.Apr 7 2022, 6:42 AM

Thanks for the review.

mlir/lib/Analysis/Presburger/PresburgerRelation.cpp
346

Yes but I prefer to keep it, it seems more consistent with thinking of "recurse" as "increment level and continue". If for some reason someone adds another block below, this block should still work as a "recurse".

Groverkss accepted this revision.Apr 7 2022, 7:01 AM

LGTM.

This revision is now accepted and ready to land.Apr 7 2022, 7:01 AM
This revision was landed with ongoing or failed builds.Apr 7 2022, 7:20 AM
This revision was automatically updated to reflect the committed changes.