[llvm] r187267 - SLP Vectorier: Don't vectorize really short chains because they are already handled by the SelectionDAG store-vectorizer, which does a better job in deciding when to vectorize.
Nadav Rotem
nrotem at apple.com
Fri Jul 26 16:07:56 PDT 2013
Author: nadav
Date: Fri Jul 26 18:07:55 2013
New Revision: 187267
URL: http://llvm.org/viewvc/llvm-project?rev=187267&view=rev
Log:
SLP Vectorier: Don't vectorize really short chains because they are already handled by the SelectionDAG store-vectorizer, which does a better job in deciding when to vectorize.
Modified:
llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/trunk/test/Transforms/SLPVectorizer/X86/reduction2.ll
Modified: llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp?rev=187267&r1=187266&r2=187267&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp Fri Jul 26 18:07:55 2013
@@ -898,8 +898,12 @@ int BoUpSLP::getTreeCost() {
DEBUG(dbgs() << "SLP: Calculating cost for tree of size " <<
VectorizableTree.size() << ".\n");
- if (!VectorizableTree.size()) {
- assert(!ExternalUses.size() && "We should not have any external users");
+ // Don't vectorize tiny trees. Small load/store chains or consecutive stores
+ // of constants will be vectoried in SelectionDAG in MergeConsecutiveStores.
+ if (VectorizableTree.size() < 3) {
+ if (!VectorizableTree.size()) {
+ assert(!ExternalUses.size() && "We should not have any external users");
+ }
return 0;
}
Modified: llvm/trunk/test/Transforms/SLPVectorizer/X86/reduction2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SLPVectorizer/X86/reduction2.ll?rev=187267&r1=187266&r2=187267&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SLPVectorizer/X86/reduction2.ll (original)
+++ llvm/trunk/test/Transforms/SLPVectorizer/X86/reduction2.ll Fri Jul 26 18:07:55 2013
@@ -16,11 +16,13 @@ define double @foo(double* nocapture %D)
%3 = getelementptr inbounds double* %D, i32 %2
%4 = load double* %3, align 4
%A4 = fmul double %4, %4
+ %A42 = fmul double %A4, %A4
%5 = or i32 %2, 1
%6 = getelementptr inbounds double* %D, i32 %5
%7 = load double* %6, align 4
%A7 = fmul double %7, %7
- %8 = fadd double %A4, %A7
+ %A72 = fmul double %A7, %A7
+ %8 = fadd double %A42, %A72
%9 = fadd double %sum.01, %8
%10 = add nsw i32 %i.02, 1
%exitcond = icmp eq i32 %10, 100
More information about the llvm-commits
mailing list