Need to outline the code for finding common vectors in insertelement
instructions into a separate function for future patches. It also
improves the process by adding some extra checks for early exit and
fixes a bug where it always finds the match because of erroneous compare
of the same values.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/test/Transforms/SLPVectorizer/X86/cmp_commute.ll | ||
---|---|---|
2–3 | looks like you need to add --check-prefixes=CHECK,SSE + --check-prefixes=CHECK,AVX |
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
5460–5461 | If this better? if (auto *VU = dyn_cast_or_null<InsertElementInst>(EU.User)) { |
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
5392 | Could you fix the comment. I guess it meant to say something like: "Go through *the vector operand* of insertelement instructions..." | |
5398 | Just curious, why do we need to check for for a single use except for VU and V? Is this related to the bug you mentioned in the patch summary? |
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
5398 | It is an early exit (which can be considered as a bugfix but not one mentioned in the description). Insertelements with multiple uses are not the part of the buildvector, they can only be used as an initial element for the buildvector sequence. We have a similar check in findBuildAggregate_rec function (requires only a single use for the insertelement instruction). |
Could you fix the comment. I guess it meant to say something like: "Go through *the vector operand* of insertelement instructions..."