<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jun 23, 2018 at 11:48 AM, Duncan P. N. Exon Smith via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><div class="gmail-h5"><br><div><br><blockquote type="cite"><div>On Jun 23, 2018, at 11:35, Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>> wrote:</div><br class="gmail-m_-2142564770918012710Apple-interchange-newline"><div><div style="word-wrap:break-word"><br><div><br><blockquote type="cite"><div>On Jun 23, 2018, at 11:27, Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>> wrote:</div><br class="gmail-m_-2142564770918012710Apple-interchange-newline"><div><div style="word-wrap:break-word"><div><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><div><div style="word-wrap:break-word"><div><div>The patch LGTM, but why would someone actually have a SmallVector with N = 0?  Isn’t that a vector?</div></div></div></div></blockquote><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">It's a vector that can be passed as a SmallVectorImpl parameter.  But yeah, mostly misguided.</div></div></div><br class="gmail-m_-2142564770918012710Apple-interchange-newline"></div></blockquote><br></div><div>There's another explanation given in llvm/include/llvm/ADT/<wbr>IndexedMap.h:</div><div>```</div>template <typename T, <wbr>typename ToIndexT = identity<unsigned>><br>  class IndexedMap {<br>    using IndexT = typename ToIndexT::argument_<wbr>type;<br>    // Prefer SmallVector with zero inline storage over std::vector. IndexedMaps<br>    // can grow very large and SmallVector grows more efficiently as long as T<br>    // is trivially copyable.<br>    using StorageT = SmallVector<T, 0>;<br><br>```</div></div></blockquote></div><br></div></div><div>And another explanation in r266909, along the same lines:</div><div><br></div><div>    IR: Use SmallVector instead of std::vector of TrackingMDRef<br>    <br>    Don't use std::vector<TrackingMDRef>, since (at least in some versions<br>    of libc++) std::vector apparently copies values on grow operations<br>    instead of moving them.  Found this when I was temporarily deleting the<br>    copy constructor for TrackingMDRef to investigate a performance<br>    bottleneck.<br></div><br><div><br></div></div></blockquote><div><br></div><div>See also <a href="https://reviews.llvm.org/rL175906">https://reviews.llvm.org/rL175906</a></div><div>It seems that a POD SmallVector can use realloc(3) to grow, which can just twiddle page tables for large POD vectors.</div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div></div></div><br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div></div>