This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][DAGCombine] Add performBuildVectorCombine 'extract_elt ~> anyext'
ClosedPublic

Authored by peterwaller-arm on Jul 28 2022, 4:10 AM.

Details

Summary

A build vector of two extracted elements is equivalent to an extract
subvector where the inner vector is any-extended to the
extract_vector_elt VT, because extract_vector_elt has the effect of an
any-extend.

(build_vector (extract_elt_i16_to_i32 vec Idx+0) (extract_elt_i16_to_i32 vec Idx+1))
=> (extract_subvector (anyext_i16_to_i32 vec) Idx)

Depends on D130697

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptJul 28 2022, 4:10 AM
peterwaller-arm published this revision for review.Jul 28 2022, 4:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 28 2022, 4:15 AM
  • Check that the extract_vector_elt operand is constant.
  • Add check for type legality.

Apply a hammer to ensure we don't produce invalid code.

paulwalker-arm accepted this revision.Jul 28 2022, 7:31 AM
paulwalker-arm added inline comments.
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
16070

EXTRACT_SUBVECTOR has more stringent requires for it's index operand than EXTRACT_VECTOR_ELEMENT so you'll be better reconstructing it via getVectorIdxConstant.

This revision is now accepted and ready to land.Jul 28 2022, 7:31 AM
  • Use getVectorIdxConstant.
This revision was landed with ongoing or failed builds.Jul 29 2022, 1:51 AM
This revision was automatically updated to reflect the committed changes.