<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jul 9, 2017 at 7:35 PM, Mehdi AMINI via Phabricator <span dir="ltr"><<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.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">mehdi_amini added a comment.<br>
<span><br>
In <a href="https://reviews.llvm.org/D35148#803251" rel="noreferrer" target="_blank">https://reviews.llvm.org/D3514<wbr>8#803251</a>, @tejohnson wrote:<br>
<br>
> In <a href="https://reviews.llvm.org/D35148#803193" rel="noreferrer" target="_blank">https://reviews.llvm.org/D3514<wbr>8#803193</a>, @mehdi_amini wrote:<br>
><br>
> > When we used an std::map originally it was because we needed the ordering. Have you checked that we don't iterate on any instance of this map?<br>
><br>
><br>
> From <a href="http://llvm.org/docs/ProgrammersManual.html#llvm-adt-densemap-h" rel="noreferrer" target="_blank">http://llvm.org/docs/Programme<wbr>rsManual.html#llvm-adt-<wbr>densemap-h</a> it doesn't appear that iteration order is an issue for DenseMap.<br>
<br>
<br>
</span>As long as keys aren't pointers...<br>
(But just as every hash_map right?)<br></blockquote><div><br></div><div>Right.</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">
<span><br>
> StringMap on the other hand does not have a deterministic iteration ordering, and I recall using a std::map somewhere instead of a StringMap for that reason.<br>
<br>
</span>Really? I'm pretty sure the order is deterministic, but just like any hash_map (including DenseMap): the order of insertion and the hash function are determining the resulting order.<br></blockquote><div><br></div><div>According to the end of <a href="http://llvm.org/docs/ProgrammersManual.html#llvm-adt-stringmap-h">http://llvm.org/docs/ProgrammersManual.html#llvm-adt-stringmap-h</a> the iteration order is non-deterministic.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span><br>
> Note the index itself still uses a std::map, for other reasons (documented at the declaration). We also still use a std::map where we write out the individual index files for the backends in the distributed backend case. In any case from what I can tell, we typically query this map, rather than iterate. The only place I see an iteration is when we are computing imports for a module, so I suppose that could affect the debug output ordering, but does that matter (if iteration order is even non-deterministic for DenseMap, and from what I can tell from the LLVM doc linked above it isn't).<br>
<br>
</span>OK!<br>
<br>
<br>
<a href="https://reviews.llvm.org/D35148" rel="noreferrer" target="_blank">https://reviews.llvm.org/D3514<wbr>8</a><br>
<br>
<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail-m_-2897639449245781825gmail_signature"><span style="font-family:Times;font-size:medium"><table cellspacing="0" cellpadding="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top:2px solid rgb(213,15,37)">Teresa Johnson |</td><td nowrap style="border-top:2px solid rgb(51,105,232)"> Software Engineer |</td><td nowrap style="border-top:2px solid rgb(0,153,57)"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td nowrap style="border-top:2px solid rgb(238,178,17)"> <a href="tel:(408)%20460-2413" value="+14084602413" target="_blank">408-460-2413</a></td></tr></tbody></table></span></div>
</div></div>