This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Add more complex folds for extractelement + stepvector
ClosedPublic

Authored by david-arm on Jul 20 2021, 6:18 AM.

Details

Summary

I have updated cheapToScalarize to also consider the case when
extracting lanes from a stepvector intrinsic. This required removing
the existing 'bool IsConstantExtractIndex' and passing in the actual
index as a Value instead. We do this because we need to know if the
index is <= known minimum number of elements returned by the stepvector
intrinsic. Effectively, when extracting lane X from a stepvector we
know the value returned is also X.

New tests added here:

Transforms/InstCombine/vscale_extractelement.ll

Diff Detail

Event Timeline

david-arm created this revision.Jul 20 2021, 6:18 AM
david-arm requested review of this revision.Jul 20 2021, 6:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 20 2021, 6:18 AM
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
54–55

Do you need to update this comment, it still refers to IsConstantExtractIndex.

68

Does this condition neaten with match syntax like match(V, m_Intrinsic<Intrinsic::experimental_stepvector>())?

david-arm updated this revision to Diff 362690.Jul 29 2021, 2:40 AM
  • Addressed review comments
david-arm marked 2 inline comments as done.Jul 29 2021, 2:41 AM
david-arm added inline comments.
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
68

Great suggestion, thanks @peterwaller-arm!

This revision is now accepted and ready to land.Aug 9 2021, 6:23 AM
This revision was automatically updated to reflect the committed changes.
david-arm marked an inline comment as done.