Skip to content

Commit d74e42a

Browse files
committed
[SLP]Attempt to vectorize long stores, if short one failed.
We can try to vectorize long store sequences, if short ones were unsuccessful because of the non-profitable vectorization. It should not increase compile time significantly (stores are sorted already, complexity is n x log n), but vectorize extra code. Metric: size..text Program size..text results results0 diff test-suite :: External/SPEC/CINT2006/400.perlbench/400.perlbench.test 1088012.00 1088236.00 0.0% test-suite :: SingleSource/UnitTests/matrix-types-spec.test 480396.00 480476.00 0.0% test-suite :: External/SPEC/CINT2017rate/525.x264_r/525.x264_r.test 664613.00 664661.00 0.0% test-suite :: External/SPEC/CINT2017speed/625.x264_s/625.x264_s.test 664613.00 664661.00 0.0% test-suite :: External/SPEC/CFP2017rate/510.parest_r/510.parest_r.test 2041105.00 2040961.00 -0.0% test-suite :: MultiSource/Applications/JM/lencod/lencod.test 836563.00 836387.00 -0.0% test-suite :: MultiSource/Benchmarks/7zip/7zip-benchmark.test 1035100.00 1032140.00 -0.3% In all benchmarks extra code gets vectorized Reviewers: RKSimon Reviewed By: RKSimon Pull Request: #88563
1 parent ace3bd0 commit d74e42a

File tree

4 files changed

+327
-131
lines changed

4 files changed

+327
-131
lines changed

llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,15 @@ struct SLPVectorizerPass : public PassInfoMixin<SLPVectorizerPass> {
153153
/// a vectorization chain.
154154
bool vectorizeChainsInBlock(BasicBlock *BB, slpvectorizer::BoUpSLP &R);
155155

156-
bool vectorizeStoreChain(ArrayRef<Value *> Chain, slpvectorizer::BoUpSLP &R,
157-
unsigned Idx, unsigned MinVF);
158-
159-
bool vectorizeStores(ArrayRef<StoreInst *> Stores, slpvectorizer::BoUpSLP &R);
156+
std::optional<bool> vectorizeStoreChain(ArrayRef<Value *> Chain,
157+
slpvectorizer::BoUpSLP &R,
158+
unsigned Idx, unsigned MinVF,
159+
unsigned &Size);
160+
161+
bool vectorizeStores(
162+
ArrayRef<StoreInst *> Stores, slpvectorizer::BoUpSLP &R,
163+
DenseSet<std::tuple<Value *, Value *, Value *, Value *, unsigned>>
164+
&Visited);
160165

161166
/// The store instructions in a basic block organized by base pointer.
162167
StoreListMap Stores;

0 commit comments

Comments
 (0)