This is an archive of the discontinued LLVM Phabricator instance.

[mlir][LLVM] Make `SplitIntegerStores` capable of splitting vectors as well
ClosedPublic

Authored by zero9178 on Jul 6 2023, 2:02 AM.

Details

Summary

The original plan was to turn this into its own pattern, but one of the difficulties was deeming when splitting the vector is required.
SplitIntegerStores essentially already did that by checking for field overlap.
Therefore, it was renamed to SplitStores and extended to splitting stores with values of vector and integer type.

The vector splitting is done in a simple manner by simply using extractelement to get each vector element. Subsequent pattern applications are responsible for further cleaning up the output and making it type-consistent.

Worst case, if the code cannot be transformed into a type-consistent form (due to e.g. the code explicitly doing partial writes to elements or similar), we might needlessly do a vector split.

Diff Detail

Event Timeline

zero9178 created this revision.Jul 6 2023, 2:02 AM
Herald added a reviewer: dcaballe. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
zero9178 requested review of this revision.Jul 6 2023, 2:02 AM
gysit added inline comments.Jul 6 2023, 2:30 AM
mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td
44

nit: should we rename to max-vector-split-size since this may be used for loads as well at some point.

mlir/include/mlir/Dialect/LLVMIR/Transforms/TypeConsistency.h
64–66

ultra nit: unsigned int -> unsigned.

mlir/lib/Dialect/LLVMIR/Transforms/TypeConsistency.cpp
544

Would it make sense to put the handling of the vector and and the struct case below into separate function to make this function a little smaller?

zero9178 updated this revision to Diff 537686.Jul 6 2023, 6:02 AM
zero9178 marked 3 inline comments as done.
  • Address review comments
  • Add test and capability for vector store to also work on an offset
gysit accepted this revision.Jul 6 2023, 6:30 AM

Nice LGTM!

This revision is now accepted and ready to land.Jul 6 2023, 6:30 AM
zero9178 updated this revision to Diff 537694.Jul 6 2023, 6:39 AM

clang-format

This revision was landed with ongoing or failed builds.Jul 6 2023, 6:55 AM
This revision was automatically updated to reflect the committed changes.