[Mlir-commits] [mlir] 41760a6 - [mlir] Make Value's constructor constexpr. NFCI.

Benjamin Kramer llvmlistbot at llvm.org
Tue Jan 4 12:08:56 PST 2022


Author: Benjamin Kramer
Date: 2022-01-04T21:04:13+01:00
New Revision: 41760a6b40c1f14e0622aea4a2ee4b4a93c40ec1

URL: https://github.com/llvm/llvm-project/commit/41760a6b40c1f14e0622aea4a2ee4b4a93c40ec1
DIFF: https://github.com/llvm/llvm-project/commit/41760a6b40c1f14e0622aea4a2ee4b4a93c40ec1.diff

LOG: [mlir] Make Value's constructor constexpr. NFCI.

This allows clang to flag unused Values in more cases, so remove them.

Added: 
    

Modified: 
    mlir/include/mlir/IR/Value.h
    mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp
    mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
    mlir/lib/Dialect/Vector/VectorMultiDimReductionTransforms.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/Value.h b/mlir/include/mlir/IR/Value.h
index ed1f8ea96d01a..65f5b8cb1eab9 100644
--- a/mlir/include/mlir/IR/Value.h
+++ b/mlir/include/mlir/IR/Value.h
@@ -83,9 +83,7 @@ class alignas(8) ValueImpl : public IRObjectWithUseList<OpOperand> {
 /// an Operation(in the case of an OpResult).
 class Value {
 public:
-  Value(detail::ValueImpl *impl = nullptr) : impl(impl) {}
-  Value(const Value &) = default;
-  Value &operator=(const Value &) = default;
+  constexpr Value(detail::ValueImpl *impl = nullptr) : impl(impl) {}
 
   template <typename U>
   bool isa() const {

diff  --git a/mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp b/mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp
index b9c4dda9d6497..ff8e1bbaf04f3 100644
--- a/mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp
+++ b/mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp
@@ -830,7 +830,6 @@ void PatternLowering::generateOperationResultTypeRewriter(
   // Look for an operation that was replaced by `op`. The result types will be
   // inferred from the results that were replaced.
   Block *rewriterBlock = op->getBlock();
-  Value replacedOp;
   for (OpOperand &use : op.op().getUses()) {
     // Check that the use corresponds to a ReplaceOp and that it is the
     // replacement value, not the operation being replaced.

diff  --git a/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
index 6568633e477d5..1bdad563f4c8d 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
@@ -1624,7 +1624,6 @@ static void genResult(Merger &merger, CodeGen &codegen,
                       PatternRewriter &rewriter, linalg::GenericOp op) {
   OpOperand *lhs = op.getOutputOperand(0);
   Type resType = lhs->get().getType();
-  Value result;
   if (getSparseTensorEncoding(resType)) {
     // The sparse tensor rematerializes from the original sparse tensor's
     // underlying sparse storage format.

diff  --git a/mlir/lib/Dialect/Vector/VectorMultiDimReductionTransforms.cpp b/mlir/lib/Dialect/Vector/VectorMultiDimReductionTransforms.cpp
index 92daab5e8b8f1..74777b53a8ccd 100644
--- a/mlir/lib/Dialect/Vector/VectorMultiDimReductionTransforms.cpp
+++ b/mlir/lib/Dialect/Vector/VectorMultiDimReductionTransforms.cpp
@@ -237,7 +237,6 @@ struct TwoDimMultiReductionToElementWise
     if (!elementType.isIntOrIndexOrFloat())
       return failure();
 
-    Value condition;
     Value result =
         rewriter.create<vector::ExtractOp>(loc, multiReductionOp.source(), 0)
             .getResult();


        


More information about the Mlir-commits mailing list