[Mlir-commits] [mlir] cfdf974 - Apply clang-tidy fixes for llvm-qualified-auto to MLIR (NFC)

Mehdi Amini llvmlistbot at llvm.org
Mon Mar 7 02:42:02 PST 2022


Author: Mehdi Amini
Date: 2022-03-07T10:41:44Z
New Revision: cfdf9747bf0eb12d30fdfcf9e90ab77899e17b82

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

LOG: Apply clang-tidy fixes for llvm-qualified-auto to MLIR (NFC)

Added: 
    

Modified: 
    mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
    mlir/lib/Dialect/Linalg/Transforms/SparseTensorRewriting.cpp
    mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
index 19c8f4d0934ae..d4e46f7619d72 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
@@ -873,7 +873,7 @@ static void populateMap(GenericOp genericOp, ArrayRef<OpOperand *> operands,
     // Get the `sourceShape` of the `sourceType`. If the operand is a result of
     // `tensor.cast` operation and source of the cast operation has a static
     // shape, then assign it to the `sourceShape`.
-    auto parentOp = src.getDefiningOp();
+    auto *parentOp = src.getDefiningOp();
     ArrayRef<int64_t> sourceShape = sourceType.getShape();
     if (parentOp) {
       if (auto castOp = dyn_cast<tensor::CastOp>(parentOp)) {

diff  --git a/mlir/lib/Dialect/Linalg/Transforms/SparseTensorRewriting.cpp b/mlir/lib/Dialect/Linalg/Transforms/SparseTensorRewriting.cpp
index 597b9b38e1b71..72d4994829631 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/SparseTensorRewriting.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/SparseTensorRewriting.cpp
@@ -52,7 +52,7 @@ static bool isEmptyInit(OpOperand *op) {
 // Helper to detect sampling operation.
 static bool isSampling(GenericOp op) {
   auto yieldOp = cast<linalg::YieldOp>(op.region().front().getTerminator());
-  if (auto def = yieldOp.getOperand(0).getDefiningOp()) {
+  if (auto *def = yieldOp.getOperand(0).getDefiningOp()) {
     if (isa<arith::MulFOp>(def) || isa<arith::MulIOp>(def)) {
       // Both scalar input arguments used exactly once.
       Value s1 = op.getBlock()->getArgument(0);
@@ -68,7 +68,7 @@ static bool isSampling(GenericOp op) {
 static bool isMulChain(Value val, Value x) {
   if (auto arg = val.dyn_cast<BlockArgument>())
     return arg != x;
-  if (auto def = val.getDefiningOp()) {
+  if (auto *def = val.getDefiningOp()) {
     if (isa<arith::MulFOp>(def) || isa<arith::MulIOp>(def))
       return isMulChain(def->getOperand(0), x) &&
              isMulChain(def->getOperand(1), x);
@@ -79,7 +79,7 @@ static bool isMulChain(Value val, Value x) {
 // Helper to detect x = x + <multiplications>.
 static bool isSumOfMul(GenericOp op) {
   auto yieldOp = cast<linalg::YieldOp>(op.region().front().getTerminator());
-  if (auto def = yieldOp.getOperand(0).getDefiningOp()) {
+  if (auto *def = yieldOp.getOperand(0).getDefiningOp()) {
     if (isa<arith::AddFOp>(def) || isa<arith::AddIOp>(def)) {
       Value x = op.getBlock()->getArguments().back();
       return (def->getOperand(0) == x && isMulChain(def->getOperand(1), x)) ||
@@ -165,8 +165,8 @@ struct FuseSparseMultiplyOverAdd : public OpRewritePattern<GenericOp> {
     addArg(mapper, fusedBlock, consBlock.getArgument(1 - other));
     addArg(mapper, fusedBlock, prodBlock.getArgument(num - 1));
     // Clone bodies of the producer and consumer in new evaluation order.
-    auto acc = prodBlock.getTerminator()->getOperand(0).getDefiningOp();
-    auto sampler = consBlock.getTerminator()->getOperand(0).getDefiningOp();
+    auto *acc = prodBlock.getTerminator()->getOperand(0).getDefiningOp();
+    auto *sampler = consBlock.getTerminator()->getOperand(0).getDefiningOp();
     rewriter.setInsertionPointToStart(fusedBlock);
     Value last;
     for (auto &op : prodBlock.without_terminator())

diff  --git a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
index a50cac90e602c..0bd293f1da06f 100644
--- a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
+++ b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
@@ -403,8 +403,8 @@ struct AllocaScopeHoister : public OpRewritePattern<AllocaScopeOp> {
     if (toHoist.empty())
       return failure();
     rewriter.setInsertionPoint(lastParentWithoutScope);
-    for (auto op : toHoist) {
-      auto cloned = rewriter.clone(*op);
+    for (auto *op : toHoist) {
+      auto *cloned = rewriter.clone(*op);
       rewriter.replaceOp(op, cloned->getResults());
     }
     return success();


        


More information about the Mlir-commits mailing list