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

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 22 06:46:29 PDT 2021


ABataev created this revision.
ABataev added reviewers: RKSimon, spatel, sdesmalen.
Herald added a subscriber: hiraditya.
ABataev requested review of this revision.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101061

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


Index: llvm/test/Transforms/SLPVectorizer/X86/remark_extract_broadcast.ll
===================================================================
--- llvm/test/Transforms/SLPVectorizer/X86/remark_extract_broadcast.ll
+++ llvm/test/Transforms/SLPVectorizer/X86/remark_extract_broadcast.ll
@@ -45,7 +45,7 @@
 ; 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'
 
Index: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -4266,6 +4266,8 @@
   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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101061.339608.patch
Type: text/x-patch
Size: 1139 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210422/72f77d02/attachment.bin>


More information about the llvm-commits mailing list