[PATCH] D32533: [SLPVectorizer] Limit the number of block chain instructions to max register size

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 26 10:32:21 PDT 2017


anna added a comment.

Thanks Matt. Looking at the SLP vectorizer code, I agree with what you've said.

Just to summarize, SLP vectorizer computes with the max possible vector length in the IR for GEPs and PHIs. However, the physical vector register size is used in the cost calculation, and vectorization is done only if its profitable. I've verified that vectorizing stores, geps and phis use this cost threshold to decide if vectorization is profitable. The downside to how the cost model is used in SLP vectorizer is that we may miss out on vectorizing geps and phis because we chose the widest possible vector and if it's unprofitable (because target's physical register size is small), we just wont vectorize.

I think the right fix from a profitability standpoint (i.e. vectorizing more geps and phis) is to do the same thing we do for store-rooted trees: try from max VF = target's physical vector reg width upto min VF, and stop when we find something profitable. The issue might be a higher compile time. >From correctness standpoint, SLP code is doing the right thing.


https://reviews.llvm.org/D32533





More information about the llvm-commits mailing list