[PATCH] D99719: [SLP] Better estimate cost of no-op extracts on target vectors.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 1 13:14:22 PDT 2021


fhahn marked an inline comment as done.
fhahn added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:3457-3459
+InstructionCost
+BoUpSLP::computeExtractCostForPermuteSingleSrc(ArrayRef<Value *> VL,
+                                               FixedVectorType *VecTy) {
----------------
ABataev wrote:
> Can you make it static local?
Yes, originally I was still using areAllUsesVectorized, but I removed that now, as it does not really fit logically any more. This impacted 2 X86 tests, but I think it is the patch working as expected.


================
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.
----------------
ABataev wrote:
> Is this possible? Or better to make it an assert?
Unfortunately that can happen when compiling without a specific target and there's a test that tiggers an assert otherwise.


================
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");
----------------
ABataev wrote:
> 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`?
Done, much simple now!


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