Make SLPVectorize to recognize homogeneous aggregates like
{<2 x float>, <2 x float>}, {{float, float}, {float, float}},
[2 x {float, float}] and so on.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Continuation of https://reviews.llvm.org/D70068. I've merged findBuildVector() and findBuildAggregate() to one findBuildAggregate() function making it recursive to recognize multidimensional aggregates. Aggregates required to be homogeneous.
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
3104 | cast<SequentialType> |
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
3104 | Yes, thanks. |
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
2418 | Why is this commented out? |
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
2418 | Oops, mistakenly updated it last time. Fixing. |
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
6964 | OK, that's acceptable for now but we should be enabling this for non-const indices as well in a future patch. getVectorInstrCost recognizes the 'all bits set' insert/extract index argument as a non-constant index (which on most targets has a high cost). @spatel is currently looking at this on x86 as part of PR43605 |
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
6964 | I was wondering about that -1 setting too. It's confusing because of the the way the cost model is organized with abstract class, concrete class, overrides, etc. But there is this documentation comment in TargetTransformInfo.h: /// \return The expected cost of vector Insert and Extract. /// Use -1 to indicate that there is no information on the index value. int getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index = -1) const; |
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
6942–6946 | Just a minor comment: Well, this function does not check for homogeneity, this is done by canMapToVector(), so the "homogeneous" in the comment is a bit misleading. It looks like this function can actually handle heterogeneous types just fine, as long as they get accepted by canMapToVector(). |
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
6942–6946 | Ok, I've removed this misleading word. |
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
632–635 | Homogeneous |
Homogeneous