[PATCH] D93967: [SLP]Need shrink the load vector after reordering.
Alexey Bataev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 4 05:40:50 PST 2021
ABataev updated this revision to Diff 314368.
ABataev added a comment.
Removed outdated comment.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93967/new/
https://reviews.llvm.org/D93967
Files:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Transforms/SLPVectorizer/X86/shrink_after_reorder.ll
Index: llvm/test/Transforms/SLPVectorizer/X86/shrink_after_reorder.ll
===================================================================
--- llvm/test/Transforms/SLPVectorizer/X86/shrink_after_reorder.ll
+++ llvm/test/Transforms/SLPVectorizer/X86/shrink_after_reorder.ll
@@ -10,7 +10,8 @@
; CHECK-NEXT: [[TMP1:%.*]] = load <2 x i32>, <2 x i32>* [[TMP0]], align 8
; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> poison, <4 x i32> <i32 1, i32 0, i32 1, i32 0>
; CHECK-NEXT: [[TMP27:%.*]] = getelementptr inbounds i32, i32* [[PTR1:%.*]], i32 3
-; CHECK-NEXT: [[TMP2:%.*]] = add nsw <2 x i32> [[TMP1]], <i32 -1, i32 -1>
+; CHECK-NEXT: [[SHRINK_SHUFFLE:%.*]] = shufflevector <4 x i32> [[SHUFFLE]], <4 x i32> poison, <2 x i32> <i32 0, i32 1>
+; CHECK-NEXT: [[TMP2:%.*]] = add nsw <2 x i32> [[SHRINK_SHUFFLE]], <i32 -1, i32 -1>
; CHECK-NEXT: [[SHUFFLE1:%.*]] = shufflevector <2 x i32> [[TMP2]], <2 x i32> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
; CHECK-NEXT: [[TMP34:%.*]] = getelementptr inbounds i32, i32* [[PTR1]], i32 4
; CHECK-NEXT: [[TMP40:%.*]] = getelementptr inbounds i32, i32* [[PTR1]], i32 5
Index: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -4262,18 +4262,13 @@
if (E->isSame(VL)) {
Value *V = vectorizeTree(E);
if (VL.size() == E->Scalars.size() && !E->ReuseShuffleIndices.empty()) {
- // We need to get the vectorized value but without shuffle.
- if (auto *SV = dyn_cast<ShuffleVectorInst>(V)) {
- V = SV->getOperand(0);
- } else {
- // Reshuffle to get only unique values.
- SmallVector<int, 4> UniqueIdxs;
- SmallSet<int, 4> UsedIdxs;
- for (int Idx : E->ReuseShuffleIndices)
- if (UsedIdxs.insert(Idx).second)
- UniqueIdxs.emplace_back(Idx);
- V = Builder.CreateShuffleVector(V, UniqueIdxs);
- }
+ // Reshuffle to get only unique values.
+ SmallVector<int, 4> UniqueIdxs;
+ SmallSet<int, 4> UsedIdxs;
+ for (int Idx : E->ReuseShuffleIndices)
+ if (UsedIdxs.insert(Idx).second)
+ UniqueIdxs.emplace_back(Idx);
+ V = Builder.CreateShuffleVector(V, UniqueIdxs, "shrink.shuffle");
}
return V;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93967.314368.patch
Type: text/x-patch
Size: 2499 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210104/74e5934c/attachment.bin>
More information about the llvm-commits
mailing list