From 7454098a9ed46ca5ad310bf3ec9347eb08eba007 Mon Sep 17 00:00:00 2001 From: Michael Maitland Date: Fri, 30 May 2025 00:39:45 -0400 Subject: [mlir][Value] Add getNumUses, hasNUses, and hasNUsesOrMore to Value (#142084) We already have hasOneUse. Like llvm::Value we provide helper methods to query the number of uses of a Value. Add unittests for Value, because that was missing. --------- Co-authored-by: Michael Maitland --- mlir/lib/Bytecode/Reader/BytecodeReader.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'mlir/lib/Bytecode/Reader/BytecodeReader.cpp') diff --git a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp index 1052946..44458d0 100644 --- a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp +++ b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp @@ -1993,8 +1993,7 @@ LogicalResult BytecodeReader::Impl::sortUseListOrder(Value value) { UseListOrderStorage customOrder = valueToUseListMap.at(value.getAsOpaquePointer()); SmallVector shuffle = std::move(customOrder.indices); - uint64_t numUses = - std::distance(value.getUses().begin(), value.getUses().end()); + uint64_t numUses = value.getNumUses(); // If the encoding was a pair of indices `(src, dst)` for every permutation, // reconstruct the shuffle vector for every use. Initialize the shuffle vector -- cgit v1.1