[Mlir-commits] [mlir] e750c41 - [mlir] Update CallInterfaceCallable to use the new casting infra.
Nick Kreeger
llvmlistbot at llvm.org
Thu Oct 13 18:33:51 PDT 2022
Author: Nick Kreeger
Date: 2022-10-13T20:33:24-05:00
New Revision: e750c41ec1accc25f12e46fd64e52cd1495cfc58
URL: https://github.com/llvm/llvm-project/commit/e750c41ec1accc25f12e46fd64e52cd1495cfc58
DIFF: https://github.com/llvm/llvm-project/commit/e750c41ec1accc25f12e46fd64e52cd1495cfc58.diff
LOG: [mlir] Update CallInterfaceCallable to use the new casting infra.
This enables casting LLVM style for mlir::CallInterfaceCallable usage.
Differential Revision: https://reviews.llvm.org/D135823
Added:
Modified:
mlir/include/mlir/Interfaces/CallInterfaces.h
mlir/lib/Interfaces/CallInterfaces.cpp
mlir/lib/Transforms/Inliner.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Interfaces/CallInterfaces.h b/mlir/include/mlir/Interfaces/CallInterfaces.h
index 1b842e8412551..26a245eba3e58 100644
--- a/mlir/include/mlir/Interfaces/CallInterfaces.h
+++ b/mlir/include/mlir/Interfaces/CallInterfaces.h
@@ -28,4 +28,12 @@ struct CallInterfaceCallable : public PointerUnion<SymbolRefAttr, Value> {
/// Include the generated interface declarations.
#include "mlir/Interfaces/CallInterfaces.h.inc"
+namespace llvm {
+
+template <typename To>
+struct CastInfo<To, mlir::CallInterfaceCallable>
+ : public CastInfo<To, mlir::CallInterfaceCallable::PointerUnion> {};
+
+} // namespace llvm
+
#endif // MLIR_INTERFACES_CALLINTERFACES_H
diff --git a/mlir/lib/Interfaces/CallInterfaces.cpp b/mlir/lib/Interfaces/CallInterfaces.cpp
index c7bcb7a960992..455684d8e2ea7 100644
--- a/mlir/lib/Interfaces/CallInterfaces.cpp
+++ b/mlir/lib/Interfaces/CallInterfaces.cpp
@@ -21,7 +21,7 @@ using namespace mlir;
Operation *
CallOpInterface::resolveCallable(SymbolTableCollection *symbolTable) {
CallInterfaceCallable callable = getCallableForCallee();
- if (auto symbolVal = callable.dyn_cast<Value>())
+ if (auto symbolVal = dyn_cast<Value>(callable))
return symbolVal.getDefiningOp();
// If the callable isn't a value, lookup the symbol reference.
diff --git a/mlir/lib/Transforms/Inliner.cpp b/mlir/lib/Transforms/Inliner.cpp
index 1fdeeafc8ebd9..1e6f211fe296a 100644
--- a/mlir/lib/Transforms/Inliner.cpp
+++ b/mlir/lib/Transforms/Inliner.cpp
@@ -344,7 +344,7 @@ static void collectCallOps(iterator_range<Region::iterator> blocks,
if (auto call = dyn_cast<CallOpInterface>(op)) {
// TODO: Support inlining nested call references.
CallInterfaceCallable callable = call.getCallableForCallee();
- if (SymbolRefAttr symRef = callable.dyn_cast<SymbolRefAttr>()) {
+ if (SymbolRefAttr symRef = dyn_cast<SymbolRefAttr>(callable)) {
if (!symRef.isa<FlatSymbolRefAttr>())
continue;
}
More information about the Mlir-commits
mailing list