From 36117cc46388d677359f1180bd536f80d0c5fe97 Mon Sep 17 00:00:00 2001 From: serge-sans-paille Date: Tue, 10 Jan 2023 11:49:15 +0100 Subject: [PATCH] [llvm] Declare llvm::makeArrayRef as obsolete Also cleans up a few remaining references. This is the final commit for the series started by https://reviews.llvm.org/D140896 --- llvm/include/llvm/ADT/ArrayRef.h | 30 +++++++++++++++------- .../SPIRV/Transforms/SPIRVWebGPUTransforms.cpp | 2 +- .../Dialect/Transform/IR/TransformInterfaces.cpp | 2 +- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/llvm/include/llvm/ADT/ArrayRef.h b/llvm/include/llvm/ADT/ArrayRef.h index 793fffa..f2f761a 100644 --- a/llvm/include/llvm/ADT/ArrayRef.h +++ b/llvm/include/llvm/ADT/ArrayRef.h @@ -491,10 +491,10 @@ namespace llvm { template ArrayRef(const std::array &Vec) -> ArrayRef; - /// Deduction guide to construct an ArrayRef from an ArrayRef (no-op) (const) + /// Deduction guide to construct an ArrayRef from an ArrayRef (const) template ArrayRef(const ArrayRef &Vec) -> ArrayRef; - /// Deduction guide to construct an ArrayRef from an ArrayRef (no-op) + /// Deduction guide to construct an ArrayRef from an ArrayRef template ArrayRef(ArrayRef &Vec) -> ArrayRef; /// Deduction guide to construct an ArrayRef from a C array. @@ -505,59 +505,71 @@ namespace llvm { /// @name ArrayRef Convenience constructors /// @{ /// Construct an ArrayRef from a single element. - template + template + LLVM_DEPRECATED("Use deduction guide instead", "ArrayRef") ArrayRef makeArrayRef(const T &OneElt) { return OneElt; } /// Construct an ArrayRef from a pointer and length. - template + template + LLVM_DEPRECATED("Use deduction guide instead", "ArrayRef") ArrayRef makeArrayRef(const T *data, size_t length) { return ArrayRef(data, length); } /// Construct an ArrayRef from a range. - template + template + LLVM_DEPRECATED("Use deduction guide instead", "ArrayRef") ArrayRef makeArrayRef(const T *begin, const T *end) { return ArrayRef(begin, end); } /// Construct an ArrayRef from a SmallVector. template + LLVM_DEPRECATED("Use deduction guide instead", "ArrayRef") ArrayRef makeArrayRef(const SmallVectorImpl &Vec) { return Vec; } /// Construct an ArrayRef from a SmallVector. template + LLVM_DEPRECATED("Use deduction guide instead", "ArrayRef") ArrayRef makeArrayRef(const SmallVector &Vec) { return Vec; } /// Construct an ArrayRef from a std::vector. - template + template + LLVM_DEPRECATED("Use deduction guide instead", "ArrayRef") ArrayRef makeArrayRef(const std::vector &Vec) { return Vec; } /// Construct an ArrayRef from a std::array. template + LLVM_DEPRECATED("Use deduction guide instead", "ArrayRef") ArrayRef makeArrayRef(const std::array &Arr) { return Arr; } /// Construct an ArrayRef from an ArrayRef (no-op) (const) - template ArrayRef makeArrayRef(const ArrayRef &Vec) { + template + LLVM_DEPRECATED("Use deduction guide instead", "ArrayRef") + ArrayRef makeArrayRef(const ArrayRef &Vec) { return Vec; } /// Construct an ArrayRef from an ArrayRef (no-op) - template ArrayRef &makeArrayRef(ArrayRef &Vec) { + template + LLVM_DEPRECATED("Use deduction guide instead", "ArrayRef") + ArrayRef &makeArrayRef(ArrayRef &Vec) { return Vec; } /// Construct an ArrayRef from a C array. - template + template + LLVM_DEPRECATED("Use deduction guide instead", "ArrayRef") ArrayRef makeArrayRef(const T (&Arr)[N]) { return ArrayRef(Arr); } diff --git a/mlir/lib/Dialect/SPIRV/Transforms/SPIRVWebGPUTransforms.cpp b/mlir/lib/Dialect/SPIRV/Transforms/SPIRVWebGPUTransforms.cpp index 1ed71db..0d4bff8 100644 --- a/mlir/lib/Dialect/SPIRV/Transforms/SPIRVWebGPUTransforms.cpp +++ b/mlir/lib/Dialect/SPIRV/Transforms/SPIRVWebGPUTransforms.cpp @@ -130,7 +130,7 @@ Value lowerExtendedMultiplication(Operation *mulOp, PatternRewriter &rewriter, Value high = combineDigits(resultDigits[2], resultDigits[3]); return rewriter.create( - loc, mulOp->getResultTypes().front(), llvm::makeArrayRef({low, high})); + loc, mulOp->getResultTypes().front(), llvm::ArrayRef({low, high})); } //===----------------------------------------------------------------------===// diff --git a/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp b/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp index b8a4ee7..929a534 100644 --- a/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp +++ b/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp @@ -394,7 +394,7 @@ void transform::TransformResults::setParams( assert(paramSegments[position].data() == nullptr && "params already set"); size_t start = this->params.size(); llvm::append_range(this->params, params); - paramSegments[position] = makeArrayRef(this->params).drop_front(start); + paramSegments[position] = ArrayRef(this->params).drop_front(start); } ArrayRef -- 2.7.4