[llvm] [SLP][REVEC] Make ShuffleCostEstimator and ShuffleInstructionBuilder can vectorize vector instructions. (PR #99606)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 6 03:19:34 PDT 2024


================
@@ -8271,6 +8286,27 @@ class BoUpSLP::ShuffleCostEstimator : public BaseShuffleAnalysis {
   /// to move most of the long shuffles cost estimation to TTI.
   bool SameNodesEstimated = true;
 
+  /// V is expected to be a vectorized value.
+  /// When REVEC is disabled, there is no difference between VF and
+  /// VNumElements.
+  /// When REVEC is enabled, VF is VNumElements / ScalarTyNumElements.
+  /// e.g., if ScalarTy is <4 x Ty> and V1 is <8 x Ty>, 2 is returned instead
+  /// of 8.
+  unsigned getVF(Value *V) {
+    assert(V != nullptr && "V cannot be nullptr");
+    assert(isa<FixedVectorType>(V->getType()) &&
+           "V does not have FixedVectorType");
+    assert(ScalarTy != nullptr && "ScalarTy cannot be nullptr");
----------------
alexey-bataev wrote:

```suggestion
    assert(ScalarTy && "ScalarTy cannot be nullptr");
```


https://github.com/llvm/llvm-project/pull/99606


More information about the llvm-commits mailing list