This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Optimize "dominant element" BUILD_VECTORs
ClosedPublic

Authored by frasercrmck on Mar 16 2021, 5:54 AM.

Details

Summary

This patch adds an optimization path for BUILD_VECTOR nodes where the
majority of the elements are identical. These can be splatted, with the
remaining elements patched up with INSERT_VECTOR_ELTs. The threshold can
be tweaked as required - it is currently conservative. Undef elements
are disregarded when judging the dominance of a particular element. This
allows them to be covered by the splat value.

In addition, vectors of 2 elements are always optimized to a splat (for
the upper element) and an insert at element zero.

This optimization is disabled when optimizing for size.

Diff Detail

Unit TestsFailed

Event Timeline

frasercrmck created this revision.Mar 16 2021, 5:54 AM
frasercrmck requested review of this revision.Mar 16 2021, 5:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 16 2021, 5:54 AM
This revision is now accepted and ready to land.Mar 16 2021, 9:12 AM
This revision was landed with ongoing or failed builds.Mar 17 2021, 3:15 AM
This revision was automatically updated to reflect the committed changes.