[llvm] 18c61fc - [SLP]Skip undefs trying to find perfect/shuffled tree entries matching.

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 22 08:59:49 PDT 2021


Author: Alexey Bataev
Date: 2021-04-22T08:59:07-07:00
New Revision: 18c61fc498c764d71b4d89444406230f2c34c6bd

URL: https://github.com/llvm/llvm-project/commit/18c61fc498c764d71b4d89444406230f2c34c6bd
DIFF: https://github.com/llvm/llvm-project/commit/18c61fc498c764d71b4d89444406230f2c34c6bd.diff

LOG: [SLP]Skip undefs trying to find perfect/shuffled tree entries matching.

We can skip check for undefs trying to find perfect/shuffled tree
entries matching, they can be ignored completely improving the final
cost/vectorization results.

Differential Revision: https://reviews.llvm.org/D101061

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
    llvm/test/Transforms/SLPVectorizer/X86/remark_extract_broadcast.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index a54a0edd2fd4..2eb5b8d0a17b 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -4308,6 +4308,8 @@ BoUpSLP::isGatherShuffledEntry(const TreeEntry *TE, SmallVectorImpl<int> &Mask,
   int NumShuffles = 0;
   for (int I = 0, E = TE->Scalars.size(); I < E; ++I) {
     Value *V = TE->Scalars[I];
+    if (isa<UndefValue>(V))
+      continue;
     const TreeEntry *VTE = getTreeEntry(V);
     if (!VTE) {
       // Check if it is used in one of the gathered entries.

diff  --git a/llvm/test/Transforms/SLPVectorizer/X86/remark_extract_broadcast.ll b/llvm/test/Transforms/SLPVectorizer/X86/remark_extract_broadcast.ll
index c54b6823ace0..8376def0afb5 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/remark_extract_broadcast.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/remark_extract_broadcast.ll
@@ -45,7 +45,7 @@ define void @fextr(i16* %ptr) {
 ; YAML-NEXT: Function:        fextr
 ; YAML-NEXT: Args:
 ; YAML-NEXT:   - String:          'Stores SLP vectorized with cost '
-; YAML-NEXT:   - Cost:            '1'
+; YAML-NEXT:   - Cost:            '-1'
 ; YAML-NEXT:   - String:          ' and with tree size '
 ; YAML-NEXT:   - TreeSize:        '4'
 


        


More information about the llvm-commits mailing list