Page MenuHomePhabricator

[InstCombine] Add more complex folds for extractelement + stepvector

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



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:


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

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


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.

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.