This is an archive of the discontinued LLVM Phabricator instance.

[mlir][analysis] Add an analysis for preserving symbol tables
ClosedPublic

Authored by Mogball on Dec 8 2022, 12:24 PM.

Details

Summary

This patch adds a SymbolTableAnalysis that can be used with the
analysis manager. It contains a symbol table collection. This analysis
allows symbol tables to be preserved across passes so that they do not
need to be recomputed. The analysis assumes it remains valid because
most transformations automatically keep symbol tables up-to-date using
its insert and erase methods.

Diff Detail

Event Timeline

Mogball created this revision.Dec 8 2022, 12:24 PM
Mogball requested review of this revision.Dec 8 2022, 12:24 PM
jpienaar added inline comments.
mlir/include/mlir/Analysis/SymbolTableAnalysis.h
44

OOC is there a way to still invalidate the analysis manually given this? Or would it remain valid analysis always?

Mogball marked an inline comment as done.Dec 9 2022, 9:22 AM
Mogball added inline comments.
mlir/include/mlir/Analysis/SymbolTableAnalysis.h
44

I don't think there's an API for invalidating analyses, but you can always reinitialize it.

rriddle accepted this revision.Dec 20 2022, 10:31 PM

LGTM, this is desperately needed.

mlir/include/mlir/Analysis/SymbolTableAnalysis.h
44

This is slightly concerning-ish, given that you won't be able to know when this actually gets invalidated by a pass. Is it a problem to just explicitly say that this gets preserved in the various passes that we need to?

This revision is now accepted and ready to land.Dec 20 2022, 10:31 PM
Mogball marked an inline comment as done.Jan 8 2023, 1:13 PM
Mogball added inline comments.
mlir/include/mlir/Analysis/SymbolTableAnalysis.h
44

On the surface, it's a little annoying to have to explicitly mark the analysis as preserved for every single pass, but it also creates a composability issue: if this analysis were downstream, for example, any upstream pass will always invalidate the analysis: canonicalization, cse, etc. That requires the analysis to be upstreamed, which is problematic.

This revision was landed with ongoing or failed builds.Jan 8 2023, 1:16 PM
This revision was automatically updated to reflect the committed changes.