This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][MemRef] Nested allocation scope inlining
ClosedPublic

Authored by wsmoses on Mar 17 2022, 11:54 PM.

Details

Summary

If a stack allocation is within a nested allocation scope
don't count that as an allocation of the outer allocation scope
that would prevent inlining.

Diff Detail

Event Timeline

wsmoses created this revision.Mar 17 2022, 11:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 17 2022, 11:54 PM
wsmoses requested review of this revision.Mar 17 2022, 11:54 PM

@wsmoses Looks like you missed my comments here: https://reviews.llvm.org/D121845 -- before merging it.

ftynse accepted this revision.Mar 18 2022, 2:39 AM
ftynse added inline comments.
mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
317–332

Would it make sense to switch the walk order to preorder (template argument) and check alloc->hasTrait<OpTrait::AutomaticAllocationScope>() + skip instead?

In any case, please do something with the formatting here, e.g., put alloc->getParentWithTrait into a variable.

329–330

Nit: fold nested ifs?

This revision is now accepted and ready to land.Mar 18 2022, 2:39 AM
wsmoses updated this revision to Diff 416527.Mar 18 2022, 9:37 AM

Address comments and fix formatting

wsmoses marked 2 inline comments as done.Mar 18 2022, 9:38 AM
This revision was automatically updated to reflect the committed changes.