[PATCH] D23169: [LV] Unify vector and scalar maps

Matthew Simpson via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 18 11:30:15 PDT 2016


mssimpso updated this revision to Diff 68578.
mssimpso marked 13 inline comments as done.
mssimpso added a comment.

Addressed comments from Adam and Michael.

This revision changes the ValueMap interface to more closely align with the spirit of Adam's comments. In particular, the init{Vector, Scalar} interface has been changed to accept a reference to {Vector, Scalar}Parts, which are then moved over to the actual map entries. Also, getVectorValue in InnerLoopVectorizer has been modified to return a constant reference.

Taking VectorizeBlockInLoop as an example, instead of getting an empty map entry with WidenMap.get() at the top of the function, we now just allocate a temporary VectorParts. Once we assign all the VectorParts entries, we then move the VectorParts to the map with initVector. So whenever we actually map a value, we use init{Vector, Scalar}. Also, because we no longer eagerly create empty mappings, eraseVector is no longer needed.

Most of the changes required to use initVector and the constant reference version of getVectorValue are fairly mechanical. One exception was interleaved accesses, where I had to reorder the code such that we didn't require mutable entries. In a few other cases, we still actually do need to change the mapped entries, and I've left getVector in ValueMap for this, which returns a non-constant reference. These cases include the "fix-up" operations that happen after the first phase of widening (i.e., type truncation and the second widening phase for recurrences).

All the other minor comments have been addressed as well. Thanks!


https://reviews.llvm.org/D23169

Files:
  lib/Transforms/Vectorize/LoopVectorize.cpp
  test/Transforms/LoopVectorize/AArch64/arbitrary-induction-step.ll
  test/Transforms/LoopVectorize/X86/scatter_crash.ll
  test/Transforms/LoopVectorize/if-pred-stores.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23169.68578.patch
Type: text/x-patch
Size: 53212 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160818/da45a3f0/attachment.bin>


More information about the llvm-commits mailing list