<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 2, 2015 at 12:39 PM, Benjamin Kramer <span dir="ltr"><<a href="mailto:benny.kra@gmail.com" target="_blank">benny.kra@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Mon, Mar 2, 2015 at 8:32 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
><br>
><br>
> On Mon, Mar 2, 2015 at 3:57 AM, Benjamin Kramer <<a href="mailto:benny.kra@googlemail.com">benny.kra@googlemail.com</a>><br>
> wrote:<br>
>><br>
>> Author: d0k<br>
>> Date: Mon Mar 2 05:57:06 2015<br>
>> New Revision: 230949<br>
>><br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=230949&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=230949&view=rev</a><br>
>> Log:<br>
>> Replace loop with equivalent ArrayRef function. NFC.<br>
>><br>
>> Modified:<br>
>> cfe/trunk/lib/CodeGen/TargetInfo.cpp<br>
>><br>
>> Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=230949&r1=230948&r2=230949&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=230949&r1=230948&r2=230949&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)<br>
>> +++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Mon Mar 2 05:57:06 2015<br>
>> @@ -6131,12 +6131,7 @@ private:<br>
>><br>
>> // Check if Ty is a usable substitute for the coercion type.<br>
>> bool isUsableType(llvm::StructType *Ty) const {<br>
>> - if (Ty->getNumElements() != Elems.size())<br>
>> - return false;<br>
>> - for (unsigned i = 0, e = Elems.size(); i != e; ++i)<br>
>> - if (Elems[i] != Ty->getElementType(i))<br>
>> - return false;<br>
>> - return true;<br>
>> + return llvm::makeArrayRef(Elems) == Ty->elements();<br>
><br>
><br>
> Shouldn't this work without the makeArrayRef call? (the RHS is already an<br>
> ArrayRef, and the LHS can be implicitly converted to one)<br>
<br>
</div></div>Nope, apparently implicit conversion isn't that aggressive<br>
<br>
include/llvm/ADT/ArrayRef.h:329:15: note: candidate template ignored:<br>
could not match 'ArrayRef' against 'SmallVector'<br></blockquote><div><br>Oh, because templates. :( That's unfortunate. 'spose that'd require templating the comparison, having two (one for the ArrayRef LHS, one for ArrayRef on the RHS) & SFINAE'ng on implicit conversion to the respective ArrayRef. Blah.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
- Ben<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
>><br>
>> }<br>
>><br>
>> // Get the coercion type as a literal struct type.<br>
>><br>
>><br>
>> _______________________________________________<br>
>> cfe-commits mailing list<br>
>> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
><br>
><br>
</div></div></blockquote></div><br></div></div>