This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Support buffer hoisting on allocas
ClosedPublic

Authored by tpopp on May 18 2021, 3:12 AM.

Details

Summary

This adds support for hoisting allocas in both BufferHoisting and
BufferLoopHoisting.

Diff Detail

Event Timeline

tpopp created this revision.May 18 2021, 3:12 AM
tpopp requested review of this revision.May 18 2021, 3:12 AM
herhut added inline comments.May 18 2021, 6:37 AM
mlir/test/Transforms/buffer-hoisting.mlir
555 ↗(On Diff #346091)

For the non-loop case, why would the allocation be hoisted? The reason this is done is to avoid copies but alloca allocated memrefs are never copied anyway, as they have implicit lifetimes.

tpopp added inline comments.May 21 2021, 12:16 AM
mlir/test/Transforms/buffer-hoisting.mlir
555 ↗(On Diff #346091)

This happened practically because the hoisting code is shared and I was assuming it might also hoist during unstructured control flow loops. As that is not the case, I'll add details to the subclassed portions to only work on Allocs for this case.

tpopp updated this revision to Diff 347645.May 25 2021, 5:19 AM

Remove hoisting of allocas in non-loop cases.

akuegel accepted this revision.May 25 2021, 5:23 AM
This revision is now accepted and ready to land.May 25 2021, 5:23 AM
This revision was landed with ongoing or failed builds.May 25 2021, 5:50 AM
This revision was automatically updated to reflect the committed changes.