This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add pass to privatize symbols unless excluded.
ClosedPublic

Authored by jpienaar on Feb 1 2022, 6:35 PM.

Details

Summary

Simple pass that changes all symbols to private unless symbol is excluded (and
in which case there is no change to symbol's visibility).

Diff Detail

Event Timeline

jpienaar created this revision.Feb 1 2022, 6:35 PM
jpienaar requested review of this revision.Feb 1 2022, 6:35 PM

Looks too specialized and a bit trivial of a task to justify a pass. But otherwise LGTM.

mlir/test/Transforms/test-symbol-privatize.mlir
2

Don't need -allow-unregistered...

jpienaar updated this revision to Diff 405144.Feb 1 2022, 8:41 PM
jpienaar marked an inline comment as done.

Removed unneeded allow unregistered dialects.

mehdi_amini accepted this revision.Feb 1 2022, 9:57 PM
mehdi_amini added inline comments.
mlir/lib/Transforms/SymbolPrivatize.cpp
42

I would limit this to the current level of nesting and not walk recursively.

This revision is now accepted and ready to land.Feb 1 2022, 9:57 PM
rriddle accepted this revision.Feb 1 2022, 10:02 PM

This is essentially the MLIR equivalent of LLVM's Internalize pass, so seems fine as an initial implementation of that. We may grow an interface or something to help drive this though, but that can come later.

mlir/include/mlir/Transforms/Passes.td
220

? Slightly more explicit.

mlir/lib/Transforms/SymbolPrivatize.cpp
22
42

Drop the mlir::

42

re: Mehdi's comment

It would also be good to include this in the documentation.

jpienaar updated this revision to Diff 405863.Feb 3 2022, 8:10 PM
jpienaar marked 5 inline comments as done.

Addressed comments (made explicit, avoided recursing, updated pass doc)

This revision was landed with ongoing or failed builds.Feb 3 2022, 8:21 PM
This revision was automatically updated to reflect the committed changes.