Apply clang-tidy fixes for llvm-qualified-auto to MLIR (NFC)
authorMehdi Amini <joker.eph@gmail.com>
Mon, 7 Mar 2022 10:12:38 +0000 (10:12 +0000)
committerMehdi Amini <joker.eph@gmail.com>
Mon, 7 Mar 2022 10:41:44 +0000 (10:41 +0000)
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
mlir/lib/Dialect/Linalg/Transforms/SparseTensorRewriting.cpp
mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp

index 19c8f4d..d4e46f7 100644 (file)
@@ -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)) {
index 597b9b3..72d4994 100644 (file)
@@ -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())
index a50cac9..0bd293f 100644 (file)
@@ -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();