Skip to content

[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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}];

Expand Down
2 changes: 1 addition & 1 deletion mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}];

Expand Down
4 changes: 2 additions & 2 deletions mlir/include/mlir/Dialect/Func/IR/FuncOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}];

Expand Down Expand Up @@ -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));
}
}];

Expand Down
2 changes: 1 addition & 1 deletion mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Dialect/Affine/IR/AffineOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++);
}
}
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/lib/Dialect/Affine/TestReifyValueBounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Dialect/Test/TestOpDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/lib/Dialect/Test/TestOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}];
}
Expand Down
5 changes: 3 additions & 2 deletions mlir/test/lib/Dialect/Test/TestTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Loading