<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">LGTM. <div><br><div><div><div><div>On Apr 28, 2014, at 5:42 PM, yijiang <<a href="mailto:yjiang@apple.com">yjiang@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=us-ascii"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hi, </div><div><br></div>The original slp vectorizer will give up if the BB already has vectorized store. Now if we add SLP vectorization to LTO passes, we may have more opportunities in the same BB during LTO so when we see a vectorized store, we will just ignore it and try to collect other candidates. We observe 2.2% improvement on spec2000 eon under -O3 -lto  (We need to enable slp-vectorizer first in LTO).<div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Index: lib/Transforms/Vectorize/SLPVectorizer.cpp</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">===================================================================</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">--- lib/Transforms/Vectorize/SLPVectorizer.cpp<span class="Apple-tab-span" style="white-space:pre">      </span>(revision 207367)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+++ lib/Transforms/Vectorize/SLPVectorizer.cpp<span class="Apple-tab-span" style="white-space:pre">  </span>(working copy)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">@@ -2116,7 +2116,7 @@</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">     // Check that the pointer points to scalars.</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">     Type *Ty = SI->getValueOperand()->getType();</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">     if (Ty->isAggregateType() || Ty->isVectorTy())</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">-      return 0;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+      continue;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"> <br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">     // Find the base pointer.</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">     Value *Ptr = GetUnderlyingObject(SI->getPointerOperand(), DL);</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Index: test/Transforms/SLPVectorizer/X86/continue_vectorizing.ll</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">===================================================================</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">--- test/Transforms/SLPVectorizer/X86/continue_vectorizing.ll<span class="Apple-tab-span" style="white-space:pre">  </span>(revision 0)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+++ test/Transforms/SLPVectorizer/X86/continue_vectorizing.ll<span class="Apple-tab-span" style="white-space:pre">        </span>(working copy)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">@@ -0,0 +1,31 @@</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+; RUN: opt < %s -basicaa -slp-vectorizer -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+target triple = "x86_64-apple-macosx10.8.0"</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+; We will keep trying to vectorize the basic block even we already find vectorized store.</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+; CHECK: test1</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+; CHECK: store <2 x double></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+; CHECK: ret</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+define void @test1(double* %a, double* %b, double* %c, double* %d) {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+entry:</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+  %i0 = load double* %a, align 8</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+  %i1 = load double* %b, align 8</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+  %mul = fmul double %i0, %i1</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+  %arrayidx3 = getelementptr inbounds double* %a, i64 1</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+  %i3 = load double* %arrayidx3, align 8</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+  %arrayidx4 = getelementptr inbounds double* %b, i64 1</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+  %i4 = load double* %arrayidx4, align 8</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+  %mul5 = fmul double %i3, %i4</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+  store double %mul, double* %c, align 8</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+  %arrayidx5 = getelementptr inbounds double* %c, i64 1</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+  store double %mul5, double* %arrayidx5, align 8</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+  %0 = bitcast double* %a to <4 x i32>*</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+  %1 = load <4 x i32>* %0, align 8</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+  %2 = bitcast double* %b to <4 x i32>*</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+  %3 = load <4 x i32>* %2, align 8</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+  %4 = mul <4 x i32> %1, %3</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+  %5 = bitcast double* %d to <4 x i32>*</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+  store <4 x i32> %4, <4 x i32>* %5, align 8</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+  ret void</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">+}</div></div><div><br></div></div>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br></blockquote></div><br></div></div></div></body></html>