[LoopVectorize] Add support for scalable vectorization of invariant stores
authorDavid Sherwood <david.sherwood@arm.com>
Thu, 17 Jun 2021 08:48:30 +0000 (09:48 +0100)
committerDavid Sherwood <david.sherwood@arm.com>
Tue, 29 Jun 2021 10:56:09 +0000 (11:56 +0100)
commit303b6d5e981947cff7e12626669c1fbeef046f18
tree167d12cab83e164857411c0c14befc82f02b545a
parent293064222a013055cda9240647110f5bcf8e1f31
[LoopVectorize] Add support for scalable vectorization of invariant stores

Previously in setCostBasedWideningDecision if we encountered an
invariant store we just assumed that we could scalarize the store
and called getUniformMemOpCost to get the associated cost.
However, for scalable vectors this is not an option because it is
not currently possibly to scalarize the store. At the moment we
crash in VPReplicateRecipe::execute when trying to scalarize the
store.

Therefore, I have changed setCostBasedWideningDecision so that if
we are storing a scalable vector out to a uniform address and the
target supports scatter instructions, then we should use those
instead.

Tests have been added here:

  Transforms/LoopVectorize/AArch64/sve-inv-store.ll

Differential Revision: https://reviews.llvm.org/D104624
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/AArch64/sve-inv-store.ll [new file with mode: 0644]