[PredicateInfo] Add comment about why we require stable sort
authorMandeep Singh Grang <mgrang@codeaurora.org>
Fri, 17 Nov 2017 00:43:24 +0000 (00:43 +0000)
committerMandeep Singh Grang <mgrang@codeaurora.org>
Fri, 17 Nov 2017 00:43:24 +0000 (00:43 +0000)
llvm-svn: 318487

llvm/lib/Transforms/Utils/PredicateInfo.cpp

index 7751b6e..d47be6e 100644 (file)
@@ -611,6 +611,11 @@ void PredicateInfo::renameUses(SmallPtrSetImpl<Value *> &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<ValueDFS, 8> RenameStack;
     // For each use, sorted into dfs order, push values and replaces uses with