From e6bb66357c37fc12ede53cbb289ba632d0ba8944 Mon Sep 17 00:00:00 2001 From: Mandeep Singh Grang Date: Fri, 17 Nov 2017 00:43:24 +0000 Subject: [PredicateInfo] Add comment about why we require stable sort llvm-svn: 318487 --- llvm/lib/Transforms/Utils/PredicateInfo.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'llvm/lib/Transforms') diff --git a/llvm/lib/Transforms/Utils/PredicateInfo.cpp b/llvm/lib/Transforms/Utils/PredicateInfo.cpp index 7751b6e1340..d47be6ea566 100644 --- a/llvm/lib/Transforms/Utils/PredicateInfo.cpp +++ b/llvm/lib/Transforms/Utils/PredicateInfo.cpp @@ -611,6 +611,11 @@ void PredicateInfo::renameUses(SmallPtrSetImpl &OpSet) { } convertUsesToDFSOrdered(Op, OrderedUses); + // Here 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. std::stable_sort(OrderedUses.begin(), OrderedUses.end(), Compare); SmallVector RenameStack; // For each use, sorted into dfs order, push values and replaces uses with -- cgit v1.2.3