-
Notifications
You must be signed in to change notification settings - Fork 13.7k
[Dialect] Migrate away from PointerUnion::{is,get} (NFC) #122568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Dialect] Migrate away from PointerUnion::{is,get} (NFC) #122568
Conversation
Note that PointerUnion::{is,get} have been soft deprecated in PointerUnion.h: // FIXME: Replace the uses of is(), get() and dyn_cast() with // isa<T>, cast<T> and the llvm::dyn_cast<T>
@llvm/pr-subscribers-mlir-llvm @llvm/pr-subscribers-mlir-async Author: Kazu Hirata (kazutakahirata) ChangesNote that PointerUnion::{is,get} have been soft deprecated in // FIXME: Replace the uses of is(), get() and dyn_cast() with Full diff: https://github.com/llvm/llvm-project/pull/122568.diff 10 Files Affected:
diff --git a/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td b/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
index 33b67921752346..a08f5d6e714ef3 100644
--- a/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
+++ b/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
@@ -256,7 +256,7 @@ def Async_CallOp : Async_Op<"call",
/// Set the callee for this operation.
void setCalleeFromCallable(CallInterfaceCallable callee) {
- (*this)->setAttr("callee", callee.get<SymbolRefAttr>());
+ (*this)->setAttr("callee", cast<SymbolRefAttr>(callee));
}
}];
diff --git a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
index 744a0dc4770e60..b16f5a8619fe7b 100644
--- a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
+++ b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
@@ -580,7 +580,7 @@ def EmitC_CallOp : EmitC_Op<"call",
/// Set the callee for this operation.
void setCalleeFromCallable(CallInterfaceCallable callee) {
- (*this)->setAttr("callee", callee.get<SymbolRefAttr>());
+ (*this)->setAttr("callee", cast<SymbolRefAttr>(callee));
}
}];
diff --git a/mlir/include/mlir/Dialect/Func/IR/FuncOps.td b/mlir/include/mlir/Dialect/Func/IR/FuncOps.td
index 211201802b08ce..4da0efcb13ddf5 100644
--- a/mlir/include/mlir/Dialect/Func/IR/FuncOps.td
+++ b/mlir/include/mlir/Dialect/Func/IR/FuncOps.td
@@ -97,7 +97,7 @@ def CallOp : Func_Op<"call",
/// Set the callee for this operation.
void setCalleeFromCallable(CallInterfaceCallable callee) {
- (*this)->setAttr("callee", callee.get<SymbolRefAttr>());
+ (*this)->setAttr("callee", cast<SymbolRefAttr>(callee));
}
}];
@@ -168,7 +168,7 @@ def CallIndirectOp : Func_Op<"call_indirect", [
/// Set the callee for this operation.
void setCalleeFromCallable(CallInterfaceCallable callee) {
- setOperand(0, callee.get<Value>());
+ setOperand(0, cast<Value>(callee));
}
}];
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
index a3aa53b1fcb851..b2281536aa40b6 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
@@ -339,7 +339,7 @@ def LLVM_GEPOp : LLVM_Op<"getelementptr", [Pure,
indices.push_back(value);
else
indices.push_back(
- builder.getInt32(valueOrAttr.get<IntegerAttr>().getInt()));
+ builder.getInt32(cast<IntegerAttr>(valueOrAttr).getInt()));
}
Type baseElementType = op.getElemType();
llvm::Type *elementType = moduleTranslation.convertType(baseElementType);
diff --git a/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td b/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
index 1eebddca3df4de..77ed6b322451e1 100644
--- a/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
+++ b/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
@@ -899,7 +899,7 @@ def IncludeOp : TransformDialectOp<"include",
}
void setCalleeFromCallable(::mlir::CallInterfaceCallable callee) {
- setTargetAttr(callee.get<SymbolRefAttr>());
+ setTargetAttr(cast<SymbolRefAttr>(callee));
}
::mlir::Operation::operand_range getArgOperands() {
diff --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
index b45829bcf6d2ca..aa2c2041f411f7 100644
--- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -5069,7 +5069,7 @@ static OpFoldResult computeProduct(Location loc, OpBuilder &builder,
if (maybeConst) {
result = result * builder.getAffineConstantExpr(*maybeConst);
} else {
- dynamicPart.push_back(term.get<Value>());
+ dynamicPart.push_back(cast<Value>(term));
result = result * builder.getAffineSymbolExpr(nDynamic++);
}
}
diff --git a/mlir/test/lib/Dialect/Affine/TestReifyValueBounds.cpp b/mlir/test/lib/Dialect/Affine/TestReifyValueBounds.cpp
index 2c954ffc4acef9..891b3bab8629d3 100644
--- a/mlir/test/lib/Dialect/Affine/TestReifyValueBounds.cpp
+++ b/mlir/test/lib/Dialect/Affine/TestReifyValueBounds.cpp
@@ -150,7 +150,7 @@ static LogicalResult testReifyValueBounds(FunctionOpInterface funcOp,
return WalkResult::skip();
}
Value constOp = rewriter.create<arith::ConstantIndexOp>(
- op->getLoc(), cast<IntegerAttr>(reified->get<Attribute>()).getInt());
+ op->getLoc(), cast<IntegerAttr>(cast<Attribute>(*reified)).getInt());
rewriter.replaceOp(op, constOp);
return WalkResult::skip();
});
diff --git a/mlir/test/lib/Dialect/Test/TestOpDefs.cpp b/mlir/test/lib/Dialect/Test/TestOpDefs.cpp
index b268e549b93ab6..c6be26d0a44d9a 100644
--- a/mlir/test/lib/Dialect/Test/TestOpDefs.cpp
+++ b/mlir/test/lib/Dialect/Test/TestOpDefs.cpp
@@ -1098,7 +1098,7 @@ CallInterfaceCallable TestCallAndStoreOp::getCallableForCallee() {
}
void TestCallAndStoreOp::setCalleeFromCallable(CallInterfaceCallable callee) {
- setCalleeAttr(callee.get<SymbolRefAttr>());
+ setCalleeAttr(cast<SymbolRefAttr>(callee));
}
Operation::operand_range TestCallAndStoreOp::getArgOperands() {
@@ -1117,7 +1117,7 @@ CallInterfaceCallable TestCallOnDeviceOp::getCallableForCallee() {
}
void TestCallOnDeviceOp::setCalleeFromCallable(CallInterfaceCallable callee) {
- setCalleeAttr(callee.get<SymbolRefAttr>());
+ setCalleeAttr(cast<SymbolRefAttr>(callee));
}
Operation::operand_range TestCallOnDeviceOp::getArgOperands() {
diff --git a/mlir/test/lib/Dialect/Test/TestOps.td b/mlir/test/lib/Dialect/Test/TestOps.td
index bafab155eb9d57..0b1f22b3ee9323 100644
--- a/mlir/test/lib/Dialect/Test/TestOps.td
+++ b/mlir/test/lib/Dialect/Test/TestOps.td
@@ -566,7 +566,7 @@ def ConversionCallOp : TEST_Op<"conversion_call_op",
}
void $cppClass::setCalleeFromCallable(::mlir::CallInterfaceCallable callee) {
- (*this)->setAttr("callee", callee.get<SymbolRefAttr>());
+ (*this)->setAttr("callee", cast<SymbolRefAttr>(callee));
}
}];
}
diff --git a/mlir/test/lib/Dialect/Test/TestTypes.cpp b/mlir/test/lib/Dialect/Test/TestTypes.cpp
index 6e31bb71d04d80..b822e019e09d24 100644
--- a/mlir/test/lib/Dialect/Test/TestTypes.cpp
+++ b/mlir/test/lib/Dialect/Test/TestTypes.cpp
@@ -295,8 +295,9 @@ TestTypeWithLayoutType::verifyEntries(DataLayoutEntryListRef params,
for (DataLayoutEntryInterface entry : params) {
// This is for testing purposes only, so assert well-formedness.
assert(entry.isTypeEntry() && "unexpected identifier entry");
- assert(llvm::isa<TestTypeWithLayoutType>(entry.getKey().get<Type>()) &&
- "wrong type passed in");
+ assert(
+ llvm::isa<TestTypeWithLayoutType>(llvm::cast<Type>(entry.getKey())) &&
+ "wrong type passed in");
auto array = llvm::dyn_cast<ArrayAttr>(entry.getValue());
assert(array && array.getValue().size() == 2 &&
"expected array of two elements");
|
@llvm/pr-subscribers-mlir Author: Kazu Hirata (kazutakahirata) ChangesNote that PointerUnion::{is,get} have been soft deprecated in // FIXME: Replace the uses of is(), get() and dyn_cast() with Full diff: https://github.com/llvm/llvm-project/pull/122568.diff 10 Files Affected:
diff --git a/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td b/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
index 33b67921752346..a08f5d6e714ef3 100644
--- a/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
+++ b/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
@@ -256,7 +256,7 @@ def Async_CallOp : Async_Op<"call",
/// Set the callee for this operation.
void setCalleeFromCallable(CallInterfaceCallable callee) {
- (*this)->setAttr("callee", callee.get<SymbolRefAttr>());
+ (*this)->setAttr("callee", cast<SymbolRefAttr>(callee));
}
}];
diff --git a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
index 744a0dc4770e60..b16f5a8619fe7b 100644
--- a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
+++ b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
@@ -580,7 +580,7 @@ def EmitC_CallOp : EmitC_Op<"call",
/// Set the callee for this operation.
void setCalleeFromCallable(CallInterfaceCallable callee) {
- (*this)->setAttr("callee", callee.get<SymbolRefAttr>());
+ (*this)->setAttr("callee", cast<SymbolRefAttr>(callee));
}
}];
diff --git a/mlir/include/mlir/Dialect/Func/IR/FuncOps.td b/mlir/include/mlir/Dialect/Func/IR/FuncOps.td
index 211201802b08ce..4da0efcb13ddf5 100644
--- a/mlir/include/mlir/Dialect/Func/IR/FuncOps.td
+++ b/mlir/include/mlir/Dialect/Func/IR/FuncOps.td
@@ -97,7 +97,7 @@ def CallOp : Func_Op<"call",
/// Set the callee for this operation.
void setCalleeFromCallable(CallInterfaceCallable callee) {
- (*this)->setAttr("callee", callee.get<SymbolRefAttr>());
+ (*this)->setAttr("callee", cast<SymbolRefAttr>(callee));
}
}];
@@ -168,7 +168,7 @@ def CallIndirectOp : Func_Op<"call_indirect", [
/// Set the callee for this operation.
void setCalleeFromCallable(CallInterfaceCallable callee) {
- setOperand(0, callee.get<Value>());
+ setOperand(0, cast<Value>(callee));
}
}];
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
index a3aa53b1fcb851..b2281536aa40b6 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
@@ -339,7 +339,7 @@ def LLVM_GEPOp : LLVM_Op<"getelementptr", [Pure,
indices.push_back(value);
else
indices.push_back(
- builder.getInt32(valueOrAttr.get<IntegerAttr>().getInt()));
+ builder.getInt32(cast<IntegerAttr>(valueOrAttr).getInt()));
}
Type baseElementType = op.getElemType();
llvm::Type *elementType = moduleTranslation.convertType(baseElementType);
diff --git a/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td b/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
index 1eebddca3df4de..77ed6b322451e1 100644
--- a/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
+++ b/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
@@ -899,7 +899,7 @@ def IncludeOp : TransformDialectOp<"include",
}
void setCalleeFromCallable(::mlir::CallInterfaceCallable callee) {
- setTargetAttr(callee.get<SymbolRefAttr>());
+ setTargetAttr(cast<SymbolRefAttr>(callee));
}
::mlir::Operation::operand_range getArgOperands() {
diff --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
index b45829bcf6d2ca..aa2c2041f411f7 100644
--- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -5069,7 +5069,7 @@ static OpFoldResult computeProduct(Location loc, OpBuilder &builder,
if (maybeConst) {
result = result * builder.getAffineConstantExpr(*maybeConst);
} else {
- dynamicPart.push_back(term.get<Value>());
+ dynamicPart.push_back(cast<Value>(term));
result = result * builder.getAffineSymbolExpr(nDynamic++);
}
}
diff --git a/mlir/test/lib/Dialect/Affine/TestReifyValueBounds.cpp b/mlir/test/lib/Dialect/Affine/TestReifyValueBounds.cpp
index 2c954ffc4acef9..891b3bab8629d3 100644
--- a/mlir/test/lib/Dialect/Affine/TestReifyValueBounds.cpp
+++ b/mlir/test/lib/Dialect/Affine/TestReifyValueBounds.cpp
@@ -150,7 +150,7 @@ static LogicalResult testReifyValueBounds(FunctionOpInterface funcOp,
return WalkResult::skip();
}
Value constOp = rewriter.create<arith::ConstantIndexOp>(
- op->getLoc(), cast<IntegerAttr>(reified->get<Attribute>()).getInt());
+ op->getLoc(), cast<IntegerAttr>(cast<Attribute>(*reified)).getInt());
rewriter.replaceOp(op, constOp);
return WalkResult::skip();
});
diff --git a/mlir/test/lib/Dialect/Test/TestOpDefs.cpp b/mlir/test/lib/Dialect/Test/TestOpDefs.cpp
index b268e549b93ab6..c6be26d0a44d9a 100644
--- a/mlir/test/lib/Dialect/Test/TestOpDefs.cpp
+++ b/mlir/test/lib/Dialect/Test/TestOpDefs.cpp
@@ -1098,7 +1098,7 @@ CallInterfaceCallable TestCallAndStoreOp::getCallableForCallee() {
}
void TestCallAndStoreOp::setCalleeFromCallable(CallInterfaceCallable callee) {
- setCalleeAttr(callee.get<SymbolRefAttr>());
+ setCalleeAttr(cast<SymbolRefAttr>(callee));
}
Operation::operand_range TestCallAndStoreOp::getArgOperands() {
@@ -1117,7 +1117,7 @@ CallInterfaceCallable TestCallOnDeviceOp::getCallableForCallee() {
}
void TestCallOnDeviceOp::setCalleeFromCallable(CallInterfaceCallable callee) {
- setCalleeAttr(callee.get<SymbolRefAttr>());
+ setCalleeAttr(cast<SymbolRefAttr>(callee));
}
Operation::operand_range TestCallOnDeviceOp::getArgOperands() {
diff --git a/mlir/test/lib/Dialect/Test/TestOps.td b/mlir/test/lib/Dialect/Test/TestOps.td
index bafab155eb9d57..0b1f22b3ee9323 100644
--- a/mlir/test/lib/Dialect/Test/TestOps.td
+++ b/mlir/test/lib/Dialect/Test/TestOps.td
@@ -566,7 +566,7 @@ def ConversionCallOp : TEST_Op<"conversion_call_op",
}
void $cppClass::setCalleeFromCallable(::mlir::CallInterfaceCallable callee) {
- (*this)->setAttr("callee", callee.get<SymbolRefAttr>());
+ (*this)->setAttr("callee", cast<SymbolRefAttr>(callee));
}
}];
}
diff --git a/mlir/test/lib/Dialect/Test/TestTypes.cpp b/mlir/test/lib/Dialect/Test/TestTypes.cpp
index 6e31bb71d04d80..b822e019e09d24 100644
--- a/mlir/test/lib/Dialect/Test/TestTypes.cpp
+++ b/mlir/test/lib/Dialect/Test/TestTypes.cpp
@@ -295,8 +295,9 @@ TestTypeWithLayoutType::verifyEntries(DataLayoutEntryListRef params,
for (DataLayoutEntryInterface entry : params) {
// This is for testing purposes only, so assert well-formedness.
assert(entry.isTypeEntry() && "unexpected identifier entry");
- assert(llvm::isa<TestTypeWithLayoutType>(entry.getKey().get<Type>()) &&
- "wrong type passed in");
+ assert(
+ llvm::isa<TestTypeWithLayoutType>(llvm::cast<Type>(entry.getKey())) &&
+ "wrong type passed in");
auto array = llvm::dyn_cast<ArrayAttr>(entry.getValue());
assert(array && array.getValue().size() == 2 &&
"expected array of two elements");
|
@llvm/pr-subscribers-mlir-emitc Author: Kazu Hirata (kazutakahirata) ChangesNote that PointerUnion::{is,get} have been soft deprecated in // FIXME: Replace the uses of is(), get() and dyn_cast() with Full diff: https://github.com/llvm/llvm-project/pull/122568.diff 10 Files Affected:
diff --git a/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td b/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
index 33b67921752346..a08f5d6e714ef3 100644
--- a/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
+++ b/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
@@ -256,7 +256,7 @@ def Async_CallOp : Async_Op<"call",
/// Set the callee for this operation.
void setCalleeFromCallable(CallInterfaceCallable callee) {
- (*this)->setAttr("callee", callee.get<SymbolRefAttr>());
+ (*this)->setAttr("callee", cast<SymbolRefAttr>(callee));
}
}];
diff --git a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
index 744a0dc4770e60..b16f5a8619fe7b 100644
--- a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
+++ b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
@@ -580,7 +580,7 @@ def EmitC_CallOp : EmitC_Op<"call",
/// Set the callee for this operation.
void setCalleeFromCallable(CallInterfaceCallable callee) {
- (*this)->setAttr("callee", callee.get<SymbolRefAttr>());
+ (*this)->setAttr("callee", cast<SymbolRefAttr>(callee));
}
}];
diff --git a/mlir/include/mlir/Dialect/Func/IR/FuncOps.td b/mlir/include/mlir/Dialect/Func/IR/FuncOps.td
index 211201802b08ce..4da0efcb13ddf5 100644
--- a/mlir/include/mlir/Dialect/Func/IR/FuncOps.td
+++ b/mlir/include/mlir/Dialect/Func/IR/FuncOps.td
@@ -97,7 +97,7 @@ def CallOp : Func_Op<"call",
/// Set the callee for this operation.
void setCalleeFromCallable(CallInterfaceCallable callee) {
- (*this)->setAttr("callee", callee.get<SymbolRefAttr>());
+ (*this)->setAttr("callee", cast<SymbolRefAttr>(callee));
}
}];
@@ -168,7 +168,7 @@ def CallIndirectOp : Func_Op<"call_indirect", [
/// Set the callee for this operation.
void setCalleeFromCallable(CallInterfaceCallable callee) {
- setOperand(0, callee.get<Value>());
+ setOperand(0, cast<Value>(callee));
}
}];
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
index a3aa53b1fcb851..b2281536aa40b6 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
@@ -339,7 +339,7 @@ def LLVM_GEPOp : LLVM_Op<"getelementptr", [Pure,
indices.push_back(value);
else
indices.push_back(
- builder.getInt32(valueOrAttr.get<IntegerAttr>().getInt()));
+ builder.getInt32(cast<IntegerAttr>(valueOrAttr).getInt()));
}
Type baseElementType = op.getElemType();
llvm::Type *elementType = moduleTranslation.convertType(baseElementType);
diff --git a/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td b/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
index 1eebddca3df4de..77ed6b322451e1 100644
--- a/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
+++ b/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
@@ -899,7 +899,7 @@ def IncludeOp : TransformDialectOp<"include",
}
void setCalleeFromCallable(::mlir::CallInterfaceCallable callee) {
- setTargetAttr(callee.get<SymbolRefAttr>());
+ setTargetAttr(cast<SymbolRefAttr>(callee));
}
::mlir::Operation::operand_range getArgOperands() {
diff --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
index b45829bcf6d2ca..aa2c2041f411f7 100644
--- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -5069,7 +5069,7 @@ static OpFoldResult computeProduct(Location loc, OpBuilder &builder,
if (maybeConst) {
result = result * builder.getAffineConstantExpr(*maybeConst);
} else {
- dynamicPart.push_back(term.get<Value>());
+ dynamicPart.push_back(cast<Value>(term));
result = result * builder.getAffineSymbolExpr(nDynamic++);
}
}
diff --git a/mlir/test/lib/Dialect/Affine/TestReifyValueBounds.cpp b/mlir/test/lib/Dialect/Affine/TestReifyValueBounds.cpp
index 2c954ffc4acef9..891b3bab8629d3 100644
--- a/mlir/test/lib/Dialect/Affine/TestReifyValueBounds.cpp
+++ b/mlir/test/lib/Dialect/Affine/TestReifyValueBounds.cpp
@@ -150,7 +150,7 @@ static LogicalResult testReifyValueBounds(FunctionOpInterface funcOp,
return WalkResult::skip();
}
Value constOp = rewriter.create<arith::ConstantIndexOp>(
- op->getLoc(), cast<IntegerAttr>(reified->get<Attribute>()).getInt());
+ op->getLoc(), cast<IntegerAttr>(cast<Attribute>(*reified)).getInt());
rewriter.replaceOp(op, constOp);
return WalkResult::skip();
});
diff --git a/mlir/test/lib/Dialect/Test/TestOpDefs.cpp b/mlir/test/lib/Dialect/Test/TestOpDefs.cpp
index b268e549b93ab6..c6be26d0a44d9a 100644
--- a/mlir/test/lib/Dialect/Test/TestOpDefs.cpp
+++ b/mlir/test/lib/Dialect/Test/TestOpDefs.cpp
@@ -1098,7 +1098,7 @@ CallInterfaceCallable TestCallAndStoreOp::getCallableForCallee() {
}
void TestCallAndStoreOp::setCalleeFromCallable(CallInterfaceCallable callee) {
- setCalleeAttr(callee.get<SymbolRefAttr>());
+ setCalleeAttr(cast<SymbolRefAttr>(callee));
}
Operation::operand_range TestCallAndStoreOp::getArgOperands() {
@@ -1117,7 +1117,7 @@ CallInterfaceCallable TestCallOnDeviceOp::getCallableForCallee() {
}
void TestCallOnDeviceOp::setCalleeFromCallable(CallInterfaceCallable callee) {
- setCalleeAttr(callee.get<SymbolRefAttr>());
+ setCalleeAttr(cast<SymbolRefAttr>(callee));
}
Operation::operand_range TestCallOnDeviceOp::getArgOperands() {
diff --git a/mlir/test/lib/Dialect/Test/TestOps.td b/mlir/test/lib/Dialect/Test/TestOps.td
index bafab155eb9d57..0b1f22b3ee9323 100644
--- a/mlir/test/lib/Dialect/Test/TestOps.td
+++ b/mlir/test/lib/Dialect/Test/TestOps.td
@@ -566,7 +566,7 @@ def ConversionCallOp : TEST_Op<"conversion_call_op",
}
void $cppClass::setCalleeFromCallable(::mlir::CallInterfaceCallable callee) {
- (*this)->setAttr("callee", callee.get<SymbolRefAttr>());
+ (*this)->setAttr("callee", cast<SymbolRefAttr>(callee));
}
}];
}
diff --git a/mlir/test/lib/Dialect/Test/TestTypes.cpp b/mlir/test/lib/Dialect/Test/TestTypes.cpp
index 6e31bb71d04d80..b822e019e09d24 100644
--- a/mlir/test/lib/Dialect/Test/TestTypes.cpp
+++ b/mlir/test/lib/Dialect/Test/TestTypes.cpp
@@ -295,8 +295,9 @@ TestTypeWithLayoutType::verifyEntries(DataLayoutEntryListRef params,
for (DataLayoutEntryInterface entry : params) {
// This is for testing purposes only, so assert well-formedness.
assert(entry.isTypeEntry() && "unexpected identifier entry");
- assert(llvm::isa<TestTypeWithLayoutType>(entry.getKey().get<Type>()) &&
- "wrong type passed in");
+ assert(
+ llvm::isa<TestTypeWithLayoutType>(llvm::cast<Type>(entry.getKey())) &&
+ "wrong type passed in");
auto array = llvm::dyn_cast<ArrayAttr>(entry.getValue());
assert(array && array.getValue().size() == 2 &&
"expected array of two elements");
|
Note that PointerUnion::{is,get} have been soft deprecated in PointerUnion.h: // FIXME: Replace the uses of is(), get() and dyn_cast() with // isa<T>, cast<T> and the llvm::dyn_cast<T>
Note that PointerUnion::{is,get} have been soft deprecated in
PointerUnion.h:
// FIXME: Replace the uses of is(), get() and dyn_cast() with
// isa, cast and the llvm::dyn_cast