This is an archive of the discontinued LLVM Phabricator instance.

[mlir][spirv] Add RewriteInserts pass.
ClosedPublic

Authored by denis13 on Jun 19 2020, 8:14 AM.

Details

Summary

Add a pass to rewrite sequential chains of spirv::CompositeInsert
operations into spirv::CompositeConstruct operations.

Diff Detail

Event Timeline

denis13 created this revision.Jun 19 2020, 8:14 AM

Could this be conveyed as a simple canonicalization pattern on spv.CompositeInsert instead?

mlir/lib/Dialect/SPIRV/Transforms/RewriteInsertsPass.cpp
73

How is this valid? The operation is required to be use_empty on destructure, otherwise it will assert. Seems like you want to iterate in reverse(llvm::reverse).

83

nit: Please remove user names from todos.

100

nit: getDefiningOp<spirv::CompositeInsertOp>()

denis13 marked an inline comment as done.Jun 19 2020, 11:55 AM
denis13 added inline comments.
mlir/lib/Dialect/SPIRV/Transforms/RewriteInsertsPass.cpp
73

Got your point, thanks.

antiagainst accepted this revision.Jun 26 2020, 6:48 AM

Awesome!

This revision is now accepted and ready to land.Jun 26 2020, 6:48 AM
This revision was automatically updated to reflect the committed changes.