Page MenuHomePhabricator

[mlir] Add support for detecting single use callables in the Inliner.
ClosedPublic

Authored by rriddle on Mar 2 2020, 12:14 PM.

Details

Summary

This is somewhat complex(annoying) as it involves directly tracking the uses within each of the callgraph nodes, and updating them as needed during inlining. The benefit of this is that we can have a more exact cost model, enable inlining some otherwise non-inlinable cases, and also ensure that newly dead callables are properly disposed of.

Diff Detail

Event Timeline

rriddle created this revision.Mar 2 2020, 12:14 PM

gentle ping.

mehdi_amini accepted this revision.Mar 14 2020, 12:18 PM
mehdi_amini added inline comments.
mlir/lib/Transforms/Inliner.cpp
192

I don't quite get the !op->getBlock()?'
(top-level module isn't hidden but isn't in a block)

245

Nit: if you move this above the if you can use it in the if condition (and the if block becomes a one liner)

This revision is now accepted and ready to land.Mar 14 2020, 12:18 PM
rriddle updated this revision to Diff 251154.Mar 18 2020, 1:03 PM
rriddle marked 3 inline comments as done.

Resolve comments

rriddle added inline comments.Mar 18 2020, 1:09 PM
mlir/lib/Transforms/Inliner.cpp
192

Renamed to allSymUsesVisibile to make it clear. It means that the uses are hidden from other operations, i.e. can't be referenced. It essentially means that we can assume that all symbol uses are visible to the use list.

This revision was automatically updated to reflect the committed changes.