HomePhabricator

[RISCV] Optimize "dominant element" BUILD_VECTORs

Authored by frasercrmck on Mar 15 2021, 8:52 AM.

Description

[RISCV] Optimize "dominant element" BUILD_VECTORs

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.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D98700

Details

Committed
frasercrmckMar 17 2021, 3:09 AM
Reviewer
craig.topper
Differential Revision
D98700: [RISCV] Optimize "dominant element" BUILD_VECTORs
Parents
rG967b64beb4bf: [AMDGPU] Split dot2-insts feature
Branches
Unknown
Tags
Unknown