[PATCH] D102675: [SLP] Fix "gathering" of vector values
Anton Afanasyev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 18 02:05:24 PDT 2021
anton-afanasyev created this revision.
anton-afanasyev added reviewers: ABataev, vdmitrie.
Herald added a subscriber: hiraditya.
anton-afanasyev requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
For rare exceptional case vector tree node (insertelements for now only)
is marked as `NeedToGather`, this case is processed by patch. Follow-up
of D98714 <https://reviews.llvm.org/D98714> to fix bug reported here https://reviews.llvm.org/D98714#2764135.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D102675
Files:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Index: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -3690,6 +3690,9 @@
TTI->getShuffleCost(TargetTransformInfo::SK_Broadcast, VecTy, None,
0);
}
+ // No cost for "gathering" already vector value
+ if (isa<FixedVectorType>(VL[0]->getType()))
+ return 0;
if (E->getOpcode() == Instruction::ExtractElement &&
allSameType(VL) && allSameBlock(VL)) {
SmallVector<int> Mask;
@@ -4591,6 +4594,9 @@
Value *BoUpSLP::gather(ArrayRef<Value *> VL) {
Value *Val0 =
isa<StoreInst>(VL[0]) ? cast<StoreInst>(VL[0])->getValueOperand() : VL[0];
+ // "Gathering" of vector values is already done
+ if (isa<FixedVectorType>(Val0->getType()))
+ return Val0;
FixedVectorType *VecTy = FixedVectorType::get(Val0->getType(), VL.size());
Value *Vec = PoisonValue::get(VecTy);
unsigned InsIndex = 0;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102675.346078.patch
Type: text/x-patch
Size: 1060 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210518/76bf91b3/attachment.bin>
More information about the llvm-commits
mailing list