[Mlir-commits] [mlir] dffc487 - [mlir] Mark OpState::removeAttr() deprecated.

Christian Sigg llvmlistbot at llvm.org
Fri Feb 26 03:04:50 PST 2021


Author: Christian Sigg
Date: 2021-02-26T12:04:41+01:00
New Revision: dffc487b07d9a50f8c65eccb9241f72af3486c79

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

LOG: [mlir] Mark OpState::removeAttr() deprecated.

Fix call sites.

The method will be removed 2 weeks later.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D97530

Added: 
    

Modified: 
    mlir/include/mlir/IR/OpDefinition.h
    mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
    mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
    mlir/lib/Dialect/Linalg/Transforms/CodegenStrategy.cpp
    mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
    mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp
    mlir/test/lib/Transforms/TestConvVectorization.cpp
    mlir/test/lib/Transforms/TestLinalgTransforms.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/OpDefinition.h b/mlir/include/mlir/IR/OpDefinition.h
index 8bd5bb524913..bfddcea950f2 100644
--- a/mlir/include/mlir/IR/OpDefinition.h
+++ b/mlir/include/mlir/IR/OpDefinition.h
@@ -132,8 +132,14 @@ class OpState {
   /// Remove the attribute with the specified name if it exists. Return the
   /// attribute that was erased, or nullptr if there was no attribute with such
   /// name.
-  Attribute removeAttr(Identifier name) { return state->removeAttr(name); }
-  Attribute removeAttr(StringRef name) {
+  LLVM_ATTRIBUTE_DEPRECATED(
+      Attribute removeAttr(Identifier name),
+      "Use Operation::removeAttr() instead (replace '.' with '->').") {
+    return state->removeAttr(name);
+  }
+  LLVM_ATTRIBUTE_DEPRECATED(
+      Attribute removeAttr(StringRef name),
+      "Use Operation::removeAttr() instead (replace '.' with '->').") {
     return state->removeAttr(Identifier::get(name, getContext()));
   }
 

diff  --git a/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp b/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
index 224d890118a7..8c421c9052a6 100644
--- a/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
+++ b/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
@@ -1547,8 +1547,8 @@ void mlir::encodeBindAttribute(ModuleOp module) {
         if (failed(SymbolTable::replaceAllSymbolUses(op, name, spvModule)))
           op.emitError("unable to replace all symbol uses for ") << name;
         SymbolTable::setSymbolName(op, name);
-        op.removeAttr(kDescriptorSet);
-        op.removeAttr(kBinding);
+        op->removeAttr(kDescriptorSet);
+        op->removeAttr(kBinding);
       }
     });
   }

diff  --git a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
index e789b013cb92..e72119545001 100644
--- a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
+++ b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
@@ -701,7 +701,7 @@ void GPUFuncOp::setType(FunctionType newType) {
 
   SmallVector<char, 16> nameBuf;
   for (int i = newType.getNumInputs(), e = oldType.getNumInputs(); i < e; i++)
-    removeAttr(getArgAttrName(i, nameBuf));
+    (*this)->removeAttr(getArgAttrName(i, nameBuf));
 
   (*this)->setAttr(getTypeAttrName(), TypeAttr::get(newType));
 }

diff  --git a/mlir/lib/Dialect/Linalg/Transforms/CodegenStrategy.cpp b/mlir/lib/Dialect/Linalg/Transforms/CodegenStrategy.cpp
index c35d288e44d1..cd7b481aea44 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/CodegenStrategy.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/CodegenStrategy.cpp
@@ -103,6 +103,6 @@ void mlir::linalg::CodegenStrategy::transform(FuncOp func) const {
 
   // Ensure we drop the marker in the end.
   func.walk([](LinalgOp op) {
-    op.removeAttr(LinalgTransforms::kLinalgTransformMarker);
+    op->removeAttr(LinalgTransforms::kLinalgTransformMarker);
   });
 }

diff  --git a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
index fdad9d879927..938cb86ee8c4 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
@@ -596,7 +596,7 @@ static void applyTilingToLoopPatterns(LinalgTilingLoopType loopType,
       funcOp, getLinalgTilingCanonicalizationPatterns(ctx));
   // Drop the marker.
   funcOp.walk([](LinalgOp op) {
-    op.removeAttr(LinalgTransforms::kLinalgTransformMarker);
+    op->removeAttr(LinalgTransforms::kLinalgTransformMarker);
   });
 }
 

diff  --git a/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp b/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp
index 4ce29b4a8397..d96892b480b2 100644
--- a/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp
+++ b/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp
@@ -139,7 +139,7 @@ static LogicalResult lowerEntryPointABIAttr(spirv::FuncOp funcOp,
   SmallVector<int32_t, 3> localSize(localSizeAttr.getValues<int32_t>());
   builder.create<spirv::ExecutionModeOp>(
       funcOp.getLoc(), funcOp, spirv::ExecutionMode::LocalSize, localSize);
-  funcOp.removeAttr(entryPointAttrName);
+  funcOp->removeAttr(entryPointAttrName);
   return success();
 }
 

diff  --git a/mlir/test/lib/Transforms/TestConvVectorization.cpp b/mlir/test/lib/Transforms/TestConvVectorization.cpp
index 61ede8197cff..089b0c27a0e0 100644
--- a/mlir/test/lib/Transforms/TestConvVectorization.cpp
+++ b/mlir/test/lib/Transforms/TestConvVectorization.cpp
@@ -119,7 +119,7 @@ void TestConvVectorization::runOnOperation() {
 
   // Ensure we drop the marker in the end.
   module.walk([](linalg::LinalgOp op) {
-    op.removeAttr(linalg::LinalgTransforms::kLinalgTransformMarker);
+    op->removeAttr(linalg::LinalgTransforms::kLinalgTransformMarker);
   });
 }
 

diff  --git a/mlir/test/lib/Transforms/TestLinalgTransforms.cpp b/mlir/test/lib/Transforms/TestLinalgTransforms.cpp
index a492d496af51..ccdcf2b9bdf8 100644
--- a/mlir/test/lib/Transforms/TestLinalgTransforms.cpp
+++ b/mlir/test/lib/Transforms/TestLinalgTransforms.cpp
@@ -228,7 +228,7 @@ static void applyPatterns(FuncOp funcOp) {
 
   // Drop the marker.
   funcOp.walk([](LinalgOp op) {
-    op.removeAttr(LinalgTransforms::kLinalgTransformMarker);
+    op->removeAttr(LinalgTransforms::kLinalgTransformMarker);
   });
 }
 
@@ -532,7 +532,7 @@ static void applyTileAndPadPattern(FuncOp funcOp) {
 void TestLinalgTransforms::runOnFunction() {
   auto lambda = [&](void *) {
     getFunction().walk([](LinalgOp op) {
-      op.removeAttr(LinalgTransforms::kLinalgTransformMarker);
+      op->removeAttr(LinalgTransforms::kLinalgTransformMarker);
     });
   };
   std::unique_ptr<void, decltype(lambda)> cleanupGuard{(void *)1, lambda};


        


More information about the Mlir-commits mailing list