[llvm] r318487 - [PredicateInfo] Add comment about why we require stable sort

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


Author: mgrang
Date: Thu Nov 16 16:43:24 2017
New Revision: 318487

URL: http://llvm.org/viewvc/llvm-project?rev=318487&view=rev
Log:
[PredicateInfo] Add comment about why we require stable sort

Modified:
    llvm/trunk/lib/Transforms/Utils/PredicateInfo.cpp

Modified: llvm/trunk/lib/Transforms/Utils/PredicateInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PredicateInfo.cpp?rev=318487&r1=318486&r2=318487&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/PredicateInfo.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/PredicateInfo.cpp Thu Nov 16 16:43:24 2017
@@ -611,6 +611,11 @@ void PredicateInfo::renameUses(SmallPtrS
     }
 
     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<ValueDFS, 8> RenameStack;
     // For each use, sorted into dfs order, push values and replaces uses with




More information about the llvm-commits mailing list