This is an archive of the discontinued LLVM Phabricator instance.

[mlir][vector] Fold shape_cast of broadcast with same element count
ClosedPublic

Authored by antiagainst on Aug 14 2023, 3:49 PM.

Details

Summary

For such cases we can generate a shape cast to simplify the IR.

Diff Detail

Event Timeline

antiagainst created this revision.Aug 14 2023, 3:49 PM
Herald added a project: Restricted Project. · View Herald Transcript
antiagainst requested review of this revision.Aug 14 2023, 3:49 PM
hanchung accepted this revision.Aug 15 2023, 10:45 AM

LGTM, thanks!

mlir/lib/Dialect/Vector/IR/VectorOps.cpp
4794–4802

[optional] I prefer early-return because that usually saves us some level of indents; returning success() is more common to me. E.g.,

This revision is now accepted and ready to land.Aug 15 2023, 10:45 AM
antiagainst marked an inline comment as done.Aug 15 2023, 11:25 AM
antiagainst added inline comments.
mlir/lib/Dialect/Vector/IR/VectorOps.cpp
4794–4802

We have two cases here; it's a bit hard to organize them as early returns for both. So I'd just keep the existing way for consistency between the two.

This revision was automatically updated to reflect the committed changes.
antiagainst marked an inline comment as done.
hanchung added inline comments.Aug 16 2023, 11:01 AM
mlir/lib/Dialect/Vector/IR/VectorOps.cpp
4794–4802

SG, thanks!