[PATCH] D99719: [SLP] Better estimate cost of no-op extracts on target vectors.
Alexey Bataev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 1 12:54:17 PDT 2021
ABataev added inline comments.
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:3457-3459
+InstructionCost
+BoUpSLP::computeExtractCostForPermuteSingleSrc(ArrayRef<Value *> VL,
+ FixedVectorType *VecTy) {
----------------
Can you make it static local?
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:3462-3464
+ // Compute the number of number of elements per vector register for
+ // VecTy. If that is not possible, because the number of parts for VecTy
+ // is unknown, the number of elements.
----------------
Is this possible? Or better to make it an assert?
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:3481-3485
+ ExtractElementInst *CurrentExtract = cast<ExtractElementInst>(V);
+ auto *IO = cast<ConstantInt>(CurrentExtract->getIndexOperand());
+ ExtractElementInst *PrevExtract = cast<ExtractElementInst>(VL[Idx - 1]);
+ unsigned PrevIdx =
+ cast<ConstantInt>(PrevExtract->getIndexOperand())->getZExtValue();
----------------
Use `*getExtractIndex(cast<Instruction>(V));` to get the indeces
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:3508-3509
+ unsigned StartIdx = Idx - EltsPerVector + 1;
+ Optional<TargetTransformInfo::ShuffleKind> ShuffleKind =
+ isShuffle({&VL[StartIdx], VL.size() - StartIdx}, Mask);
+ assert(ShuffleKind && "Shuffle kind should always be computable");
----------------
1.
```
Optional<TargetTransformInfo::ShuffleKind> ShuffleKind = isShuffle(VL.slice(StartIdx, std::min(EltsPerVector, VL.size() - StartIdx)), Mask);
```
2. Can we skip this call? Just `TargetTransformInfo::SK_PermuteSingleSrc` and `None` as a `Mask`?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99719/new/
https://reviews.llvm.org/D99719
More information about the llvm-commits
mailing list