diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.cpp index 3a77ce347b1c..84129edee375 100644 --- a/mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.cpp @@ -404,7 +404,7 @@ void LoopEmitter::categorizeIterators( spIters.push_back(it); } - std::stable_sort(spIters.begin(), spIters.end(), [](auto lhs, auto rhs) { + llvm::stable_sort(spIters, [](auto lhs, auto rhs) { // AffineUnRed > Affine > Slice > Trivial return static_cast(lhs->kind) > static_cast(rhs->kind); }); diff --git a/mlir/lib/IR/Diagnostics.cpp b/mlir/lib/IR/Diagnostics.cpp index 79697be2b45e..3a0f81d24033 100644 --- a/mlir/lib/IR/Diagnostics.cpp +++ b/mlir/lib/IR/Diagnostics.cpp @@ -979,7 +979,7 @@ struct ParallelDiagnosticHandlerImpl : public llvm::PrettyStackTraceEntry { // Stable sort all of the diagnostics that were emitted. This creates a // deterministic ordering for the diagnostics based upon which order id they // were emitted for. - std::stable_sort(diagnostics.begin(), diagnostics.end()); + llvm::stable_sort(diagnostics); // Emit each diagnostic to the context again. for (ThreadDiagnostic &diag : diagnostics) diff --git a/mlir/lib/Rewrite/ByteCode.cpp b/mlir/lib/Rewrite/ByteCode.cpp index 5939d0d00d32..ae3f22dec9f2 100644 --- a/mlir/lib/Rewrite/ByteCode.cpp +++ b/mlir/lib/Rewrite/ByteCode.cpp @@ -2346,10 +2346,10 @@ void PDLByteCode::match(Operation *op, PatternRewriter &rewriter, assert(succeeded(executeResult) && "unexpected matcher execution failure"); // Order the found matches by benefit. - std::stable_sort(matches.begin(), matches.end(), - [](const MatchResult &lhs, const MatchResult &rhs) { - return lhs.benefit > rhs.benefit; - }); + llvm::stable_sort(matches, + [](const MatchResult &lhs, const MatchResult &rhs) { + return lhs.benefit > rhs.benefit; + }); } LogicalResult PDLByteCode::rewrite(PatternRewriter &rewriter, diff --git a/mlir/lib/Rewrite/PatternApplicator.cpp b/mlir/lib/Rewrite/PatternApplicator.cpp index ea43f8a147d4..4a12183492fd 100644 --- a/mlir/lib/Rewrite/PatternApplicator.cpp +++ b/mlir/lib/Rewrite/PatternApplicator.cpp @@ -103,7 +103,7 @@ void PatternApplicator::applyCostModel(CostModel model) { // Sort patterns with highest benefit first, and remove those that are // impossible to match. - std::stable_sort(list.begin(), list.end(), cmp); + llvm::stable_sort(list, cmp); while (!list.empty() && benefits[list.back()].isImpossibleToMatch()) { LLVM_DEBUG(logImpossibleToMatch(*list.back())); list.pop_back(); diff --git a/mlir/lib/Transforms/Utils/CommutativityUtils.cpp b/mlir/lib/Transforms/Utils/CommutativityUtils.cpp index 5ba6e4747cb5..8b132b5e484b 100644 --- a/mlir/lib/Transforms/Utils/CommutativityUtils.cpp +++ b/mlir/lib/Transforms/Utils/CommutativityUtils.cpp @@ -297,8 +297,7 @@ public: } // Sort the operands. - std::stable_sort(commOperands.begin(), commOperands.end(), - commutativeOperandComparator); + llvm::stable_sort(commOperands, commutativeOperandComparator); SmallVector sortedOperands; for (const std::unique_ptr &commOperand : commOperands) sortedOperands.push_back(commOperand->operand); diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp index bd11bbe58a3f..02657b500ebf 100644 --- a/mlir/lib/Transforms/Utils/DialectConversion.cpp +++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp @@ -2520,19 +2520,19 @@ unsigned OperationLegalizer::applyCostModelToPatterns( return minDepth; // Sort the patterns by those likely to be the most beneficial. - std::stable_sort(patternsByDepth.begin(), patternsByDepth.end(), - [](const std::pair &lhs, - const std::pair &rhs) { - // First sort by the smaller pattern legalization - // depth. - if (lhs.second != rhs.second) - return lhs.second < rhs.second; + llvm::stable_sort(patternsByDepth, + [](const std::pair &lhs, + const std::pair &rhs) { + // First sort by the smaller pattern legalization + // depth. + if (lhs.second != rhs.second) + return lhs.second < rhs.second; - // Then sort by the larger pattern benefit. - auto lhsBenefit = lhs.first->getBenefit(); - auto rhsBenefit = rhs.first->getBenefit(); - return lhsBenefit > rhsBenefit; - }); + // Then sort by the larger pattern benefit. + auto lhsBenefit = lhs.first->getBenefit(); + auto rhsBenefit = rhs.first->getBenefit(); + return lhsBenefit > rhsBenefit; + }); // Update the legalization pattern to use the new sorted list. patterns.clear();