This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Optimize floating-point "dominant value" BUILD_VECTORs
ClosedPublic

Authored by frasercrmck on Jul 28 2021, 7:41 AM.

Details

Summary

This patch aims to improve the performance of BUILD_VECTORs which are
identified as containing a dominant element. Given that most
floating-point constants themselves require a load from the constant
pool, it was possible for the optimization to actually increase the
number of individual loads on small vectors. The exception is the zero
constant -- +0.0 -- which can be materialized efficiently.

While this optimization could do with a proper cost model to weigh the
benfits of a single vector load vs. the manipulation of individual
elements -- even for integer vectors which often require several
instructions to materialize -- without a concrete RVV implementation to
work with any heuristic is likely to be both more obtuse and inaccurate.

Until then, this patch fixes at least one known obvious deficiency.

Diff Detail

Event Timeline

frasercrmck created this revision.Jul 28 2021, 7:41 AM
frasercrmck requested review of this revision.Jul 28 2021, 7:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 28 2021, 7:41 AM
This revision is now accepted and ready to land.Jul 28 2021, 10:32 AM

Cheers! Do you or the person who reported this need the fix in LLVM 13?