This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Analysis] Introduce LoopInfo in mlir
ClosedPublic

Authored by Dinistro on Mar 31 2023, 6:33 AM.

Details

Summary

This commit introduces an instantiation of LLVM's LoopInfo for CFGs in
MLIR. To test the LoopInfo, a test pass is added the checks the analysis
results for a set of CFGs.

Diff Detail

Event Timeline

Dinistro created this revision.Mar 31 2023, 6:33 AM
Dinistro requested review of this revision.Mar 31 2023, 6:33 AM
Dinistro added inline comments.Mar 31 2023, 6:40 AM
mlir/include/mlir/Analysis/LoopInfo.h
30

I'm not sure if we should move these traits to `mlir/IR/RegionGraphTraits.h" file.

ftynse added inline comments.Apr 5 2023, 2:47 AM
mlir/include/mlir/Analysis/LoopInfo.h
1

Nit: I'm confused by how this is an analysis for regions, maybe for region bodies?

30

Yep, it already has specializations for non-const versions.

65

Please call this something like BlockLoop or CFGLoop, MLIR has many other kinds of loops and we don't want these things to be confused. Also provide documentation for all top-level entities.

mlir/lib/Analysis/LoopInfo.cpp
13

Nit: no need to prefix with ::mlir:: within MLIR's proper code base.

mlir/test/lib/Analysis/TestLoopInfo.cpp
45

Nit: check that the region is not empty and error out gracefully so there's no assertion on unexpected IR.

Dinistro updated this revision to Diff 511057.Apr 5 2023, 5:14 AM
Dinistro marked 5 inline comments as done.

Renamed to CFGLoopInfo and addressed additional reviewer comments.

ftynse accepted this revision.Apr 5 2023, 5:20 AM
This revision is now accepted and ready to land.Apr 5 2023, 5:20 AM
This revision was automatically updated to reflect the committed changes.