<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div></div><div><br></div><div><br><div><div>On Sep 2, 2014, at 12:03 PM, Arnold Schwaighofer <<a href="mailto:aschwaighofer@apple.com">aschwaighofer@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=utf-8"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">The test case has trailing whitespaces.<div class=""><br class=""></div><div class="">Note, that the ExternalUse created during vectorizing the tree won’t participate in the cost estimate. I am not sure that fixing this would be worth the added complexity.</div><div class=""><br class=""></div><div class="">Otherwise, LGTM.</div><div class=""><br class=""></div><div class="">Thanks!</div><div class=""><br class=""></div><div class=""><br class=""><div class=""><div><blockquote type="cite" class=""><div class="">On Aug 29, 2014, at 2:02 PM, Yi Jiang <<a href="mailto:yjiang@apple.com" class="">yjiang@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi, <br class=""><br class="">This patch is for radar 18144665 which is exposed by Machael Z's commit.  We will get an assertion if enabling the vectorization of GEP with multiple-uses on this case:<br class=""><br class=""><span style="font-family: Menlo; font-size: 11px;" class="">fn2() {</span><br class=""><span style="font-family: Menlo; font-size: 11px;" class="">  a[11] = a + 11;</span><br class=""><span style="font-family: Menlo; font-size: 11px;" class="">  a[12] = a + 56;</span><br class=""><span style="font-family: Menlo; font-size: 11px;" class="">}</span><br class=""><br class="">The reason of this bug is that our current framework assumes that all 
in-tree scalars will eventually become vectors so all in-tree uses do 
not need extract. However, it is not the case for vector instructions 
that has scalar operands; the scalar operands will remain scalar and we 
still need the extract.  For example in this test case:<br class=""><br class="">  %0 = load i64** @a, align 8, !tbaa !1<br class="">  %add.ptr1 = getelementptr inbounds i64* %0, i64 56      // A<br class="">  %add.ptr = getelementptr inbounds i64* %0, i64 11        // B<br class="">  %1 = insertelement <2 x i64*> undef, i64* %0, i32 0<br class="">  %2 = insertelement <2 x i64*> %1, i64* %0, i32 1<br class="">  %3 = getelementptr <2 x i64*> %2, <2 x i64> <i64 11, i64 56>   // C: Vectorized Value<br class="">  %4 = ptrtoint <2 x i64*> %3 to <2 x i64><br class="">  %arrayidx2 = getelementptr inbounds i64* %0, i64 12<br class="">  %5 = bitcast i64* %add.ptr to <2 x i64>*    //  D<br class="">  store <2 x i64> %4, <2 x i64>* %5, align 8, !tbaa !5<br class="">  ret i32 undef<br class=""><br class="">Now Our framework vectorizes A and B to C. add.ptr(A) is used by D as 
the pointer operand. Although it is in-tree uses, we still need to 
extract this value from C.<br class=""><br class="">So here is my proposal in my patch to solve this:<br class="">1) When we build ExternalUses List, we need to find out if the in-tree 
use needs extract instead of ignoring all of them. It will help us to 
make the cost model right.<br class="">2) When we vectorize load and store, currently we will generate bitcast 
to transfer pointer operand. Now we need to add this bitcast to 
ExternalUses List and tell the SLP-vectorizer to extract the value. <br class=""><br class="">By applying this patch, we can re-enable the vectorization of GEP with multiple-uses. Any comment is appreciated. <br class=""> <br class=""><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""></div></div></blockquote></div></div>
<span id="cid:12998AB5-B99A-4C9C-BBE2-C915F6D5DD28@apple.com"><18144665.patch></span><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""></div>
_______________________________________________<br class="">llvm-commits mailing list<br class=""><a href="mailto:llvm-commits@cs.uiuc.edu" class="">llvm-commits@cs.uiuc.edu</a><br class=""><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br class=""></div></blockquote></div><br class=""></div></div></div></blockquote></div><br></div></body></html>