This is an archive of the discontinued LLVM Phabricator instance.

[mlir][arith] Extend `floordivsi` expansion
ClosedPublic

Authored by awarzynski on Mar 23 2023, 10:48 AM.

Details

Summary

This patch extends createConst so that it can generate constant
vectors (it already generates scalars). This allows the expansion of
arith.floordivsi operating on vectors.

While arith.floordivsi is my main motivation for this change, this
patch should allow other Arith ops to be extended in vector cases too.

Diff Detail

Event Timeline

awarzynski created this revision.Mar 23 2023, 10:48 AM
awarzynski requested review of this revision.Mar 23 2023, 10:48 AM
dcaballe added inline comments.Mar 23 2023, 11:07 AM
mlir/lib/Dialect/Arith/Transforms/ExpandOps.cpp
29

mlir::getElementTypeOrSelf(type) should help here

40

we can create a vector constant here instead of a broadcast by passing a vector type to the arith::ConstantOp

Address Diego's comments

dcaballe accepted this revision.Mar 23 2023, 7:19 PM

LGTM! Just a minor comment that you can fix before landing.

mlir/lib/Dialect/Arith/Transforms/ExpandOps.cpp
32

dyn_cast_or_null -> dyn_cast, type can't be null, right?

This revision is now accepted and ready to land.Mar 23 2023, 7:19 PM
This revision was landed with ongoing or failed builds.Mar 24 2023, 1:49 AM
This revision was automatically updated to reflect the committed changes.