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

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 12:25:12 PST 2017


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> 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
>
> Repository:
>   rL LLVM
>
> 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/20171114/272e8812/attachment.html>


More information about the llvm-commits mailing list