[PATCH] D39630: [PredicateInfo] Stable sort ValueDFS to remove non-deterministic ordering

Grang, Mandeep Singh via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 16 16:45:16 PST 2017


Comment added here: https://reviews.llvm.org/rL318487

--Mandeep


On 11/14/2017 12:25 PM, Daniel Berlin wrote:
> Could you just add a comment above the stable sort saying:
> "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.
> We could get rid of the stable sort by creating one if we wanted"
>
>
> On Tue, Nov 14, 2017 at 10:22 AM, Mandeep Singh Grang via Phabricator 
> <reviews at reviews.llvm.org <mailto:reviews at reviews.llvm.org>> wrote:
>
>     This revision was automatically updated to reflect the committed
>     changes.
>     Closed by commit rL318165: [PredicateInfo] Stable sort ValueDFS to
>     remove non-deterministic ordering (authored by mgrang).
>
>     Changed prior to commit:
>     https://reviews.llvm.org/D39630?vs=121612&id=122869#toc
>     <https://reviews.llvm.org/D39630?vs=121612&id=122869#toc>
>
>     Repository:
>       rL LLVM
>
>     https://reviews.llvm.org/D39630 <https://reviews.llvm.org/D39630>
>
>     Files:
>       llvm/trunk/lib/Transforms/Utils/PredicateInfo.cpp
>
>
>     Index: llvm/trunk/lib/Transforms/Utils/PredicateInfo.cpp
>     ===================================================================
>     --- llvm/trunk/lib/Transforms/Utils/PredicateInfo.cpp
>     +++ llvm/trunk/lib/Transforms/Utils/PredicateInfo.cpp
>     @@ -611,7 +611,7 @@
>          }
>
>          convertUsesToDFSOrdered(Op, OrderedUses);
>     -    std::sort(OrderedUses.begin(), OrderedUses.end(), Compare);
>     +    std::stable_sort(OrderedUses.begin(), OrderedUses.end(),
>     Compare);
>          SmallVector<ValueDFS, 8> RenameStack;
>          // For each use, sorted into dfs order, push values and
>     replaces uses with
>          // top of stack, which will represent the reaching def.
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171116/c93913d2/attachment.html>


More information about the llvm-commits mailing list