diff --git a/mlir/lib/IR/BuiltinAttributes.cpp b/mlir/lib/IR/BuiltinAttributes.cpp index a7b1a6c1da1405..8ef7c267418461 100644 --- a/mlir/lib/IR/BuiltinAttributes.cpp +++ b/mlir/lib/IR/BuiltinAttributes.cpp @@ -79,11 +79,9 @@ static bool dictionaryAttrSort(ArrayRef value, storage.assign(value.begin(), value.end()); // Check to see they are sorted already. bool isSorted = llvm::is_sorted(value); - if (!isSorted) { - // If not, do a general sort. + // If not, do a general sort. + if (!isSorted) llvm::array_pod_sort(storage.begin(), storage.end()); - value = storage; - } return !isSorted; } return false;