<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;">Matt, <div><br></div><div>I looked at the test case again and I think that there is a possible solution. If we start vectorizing the tree and use the insert_element instructions as roots then we would be able to vectorize this code. At the moment the insert_element instructions are handled outside of the buildTree method, so they interfere with the tree-construction. </div><div><br></div><div>Thanks,</div><div>Nadav</div><div><br><div><div>On Sep 10, 2013, at 1:51 PM, Nadav Rotem <<a href="mailto:nrotem@apple.com">nrotem@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br>On Sep 10, 2013, at 1:18 PM, Matt Arsenault <<a href="mailto:arsenm2@gmail.com">arsenm2@gmail.com</a>> wrote:<br><br><blockquote type="cite"><br>On Sep 10, 2013, at 12:26 , Nadav Rotem <<a href="mailto:nrotem@apple.com">nrotem@apple.com</a>> wrote:<br><br><blockquote type="cite">Hi Matt,<span class="Apple-converted-space"> </span><br><br>I am sorry I missed your first email. Thanks for working on this.<span class="Apple-converted-space"> </span><br><br><blockquote type="cite">When the elements are extracted from a select, do the select on the extracted scalars from the input.<br><br></blockquote><br>I am not sure that this is always profitable or that it should be done in InstCombine. It is hard to know at IR-level (during inst-combine) if it is better to extract twice and perform a single select or if it is better to perform an vector select and extract once. I think that this kind of decision should be made in SelectionDAG.<span class="Apple-converted-space"> </span><br></blockquote><br>I was following your suggestion from the case I asked about here: <a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-August/065033.html">http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-August/065033.html</a><br><br>My first thought was to do this for the scalar select on vectors case, which I think would more universally be better. I wasn't sure about the vselect case. Would it make sense to always do only the scalar case here?<br><br></blockquote><br>I am sorry for not being clear.  In that email I meant that some basic vectorization or vectorization cleanups (such as getting rid of insert-extract sequences) can be done in InstCombine. This should only be viewed as canonicalization. In your patch you are scalarizing the code in preparation for the SLP-vectorizer to handle the scalar code. I don’t think that this is a good approach because the SLP-vectorizer may miss some patterns. I think that the best approach for handling the problem that you described in the email from August is to improve the SLP-vectorizer.<span class="Apple-converted-space"> </span><br><br>Your test case is very important because this is a very common pattern in graphics code.  One of the limitations of the SLP-vectorizer is that it has to honor scheduling constraints because it does not operate on a DAG (for compile time reasons). Unfortunately I don’t have a good solution for this problem right now.<span class="Apple-converted-space"> </span><br><br>Thanks,<br>Nadav<br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></div></blockquote></div><br></div></body></html>