This is an archive of the discontinued LLVM Phabricator instance.

[VectorCombine][SVE] Do not fold bitcast shuffle for scalable type.
ClosedPublic

Authored by huihuiz on Sep 1 2020, 5:56 PM.

Details

Summary

First, shuffle cost for scalable type is not known for scalable type;
Second, we cannot reason if the narrowed shuffle mask for scalable type
is a splat or not.

E.g., Bitcast splat vector from type <vscale x 4 x i32> to <vscale x 8 x i16>
will involve narrowing shuffle mask <vscale x 4 x i32> zeroinitializer to
<vscale x 8 x i32> with element sequence of <0, 1, 0, 1, ...>, which cannot be
reasoned if it's a valid splat or not.

Diff Detail

Unit TestsFailed

Event Timeline

huihuiz created this revision.Sep 1 2020, 5:56 PM
huihuiz requested review of this revision.Sep 1 2020, 5:56 PM
spatel added inline comments.Sep 2 2020, 5:58 AM
llvm/lib/Transforms/Vectorize/VectorCombine.cpp
440

Change to dyn_cast<FixedVectorType> above this instead of adding isa<> checks?

442–443

Move this comment to up to the point that we are excluding ScalableVectorType.

spatel added inline comments.Sep 2 2020, 5:59 AM
llvm/lib/Transforms/Vectorize/VectorCombine.cpp
442–443

(or remove if it is not possible)

huihuiz updated this revision to Diff 289518.Sep 2 2020, 11:08 AM
huihuiz marked 2 inline comments as done.

Thanks Sanjay for the review!
Addressed review comments.

spatel accepted this revision.Sep 2 2020, 1:30 PM

LGTM

This revision is now accepted and ready to land.Sep 2 2020, 1:30 PM
This revision was landed with ongoing or failed builds.Sep 2 2020, 3:02 PM
This revision was automatically updated to reflect the committed changes.