This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][Presburger] Inequality Typing in coalesce
ClosedPublic

Authored by webmiche on Feb 16 2022, 2:03 AM.

Details

Summary

This patch adds typing of inequalities to the simplex. This is a cental part of the coalesce algorithm and will be heavily used in later coalesce patches. Currently, only the three most basic types are supported with more to be introduced when they are needed.

Diff Detail

Event Timeline

webmiche created this revision.Feb 16 2022, 2:03 AM
webmiche requested review of this revision.Feb 16 2022, 2:03 AM
Groverkss added inline comments.Feb 16 2022, 2:52 AM
mlir/include/mlir/Analysis/Presburger/Simplex.h
560–566
mlir/lib/Analysis/Presburger/PresburgerSet.cpp
421–449

Could you write a comment here on what it's doing? I don't exactly understand what it is doing.

427–429

Use lowerCamelCase for variables, please.

435–441

You can remove the curly braces here.

webmiche updated this revision to Diff 409189.Feb 16 2022, 3:07 AM

address review comments

webmiche marked 4 inline comments as done.Feb 16 2022, 3:08 AM
Groverkss retitled this revision from [MLIR] Inequality Typing in coalesce to [MLIR][Presburger] Inequality Typing in coalesce.Feb 16 2022, 3:26 AM
arjunp added inline comments.Feb 16 2022, 1:28 PM
mlir/include/mlir/Analysis/Presburger/Simplex.h
491

I think it might be best to move this down right above ineqType

566

You should be able to drop this here

566

Maybe rename to findIneqType. Function names should represent doing something

mlir/lib/Analysis/Presburger/PresburgerSet.cpp
421

As far as I can see, this doesn't change the functionality, but reimplements it in a different way to setup the rest of the coalesce patches? If so, I would leave it out for this patch.

421–429

Please capitalize starts of sentences and end them with full stops

422–426

I would suggest early exiting if it becomes false at any point

423–433

Is there a specific reason for using l as the iterator when k is unused?

mlir/lib/Analysis/Presburger/Simplex.cpp
1591

I would just omit all the "if it exists" stuff. If it doesn't exist, it's plus/minus infinity and people can figure out whether that's >= or <= 0. This would make the whole doc much more understandable

1593
1594
1597

Describe why the other case corresponds to the description of what "separate" means above

webmiche updated this revision to Diff 410158.EditedFeb 20 2022, 7:42 AM

I removed everything concerning looping strategy in coalesce. This is reduced purely to everything that concerns introducing inequality types.

webmiche marked 7 inline comments as done.Feb 20 2022, 7:43 AM
arjunp added inline comments.Feb 20 2022, 8:06 AM
mlir/lib/Analysis/Presburger/Simplex.cpp
1615
1619–1623

Write "the inequality" instead of "coeffs"

webmiche updated this revision to Diff 410159.Feb 20 2022, 9:36 AM

addressed remaining comments

webmiche marked 2 inline comments as done.Feb 20 2022, 9:36 AM
arjunp accepted this revision.Feb 20 2022, 9:42 AM

LGTM!

This revision is now accepted and ready to land.Feb 20 2022, 9:42 AM
This revision was automatically updated to reflect the committed changes.