<div dir="ltr">Could you just add a comment above the stable sort saying:<div>"We require a stable sort because we do not bother to try to assign an order to the operands the uses represent. Thus, two uses in the same instruction do not have a strict sort order currently and will be considered equal.</div><div>We could get rid of the stable sort by creating one if we wanted"</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 14, 2017 at 10:22 AM, Mandeep Singh Grang 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This revision was automatically updated to reflect the committed changes.<br>
Closed by commit rL318165: [PredicateInfo] Stable sort ValueDFS to remove non-deterministic ordering (authored by mgrang).<br>
<br>
Changed prior to commit:<br>
  <a href="https://reviews.llvm.org/D39630?vs=121612&id=122869#toc" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D39630?vs=121612&id=122869#toc</a><br>
<span class=""><br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="https://reviews.llvm.org/D39630" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D39630</a><br>
<br>
Files:<br>
</span>  llvm/trunk/lib/Transforms/<wbr>Utils/PredicateInfo.cpp<br>
<br>
<br>
Index: llvm/trunk/lib/Transforms/<wbr>Utils/PredicateInfo.cpp<br>
==============================<wbr>==============================<wbr>=======<br>
--- llvm/trunk/lib/Transforms/<wbr>Utils/PredicateInfo.cpp<br>
+++ llvm/trunk/lib/Transforms/<wbr>Utils/PredicateInfo.cpp<br>
<span class="">@@ -611,7 +611,7 @@<br>
     }<br>
<br>
     convertUsesToDFSOrdered(Op, OrderedUses);<br>
</span>-    std::sort(OrderedUses.begin(), OrderedUses.end(), Compare);<br>
<div class="HOEnZb"><div class="h5">+    std::stable_sort(OrderedUses.<wbr>begin(), OrderedUses.end(), Compare);<br>
     SmallVector<ValueDFS, 8> RenameStack;<br>
     // For each use, sorted into dfs order, push values and replaces uses with<br>
     // top of stack, which will represent the reaching def.<br>
<br>
<br>
</div></div></blockquote></div><br></div>