summaryrefslogtreecommitdiff
path: root/mlir/examples/toy/Ch5
diff options
context:
space:
mode:
authorTres Popp <tpopp@google.com>2023-05-09 15:56:42 +0200
committerTres Popp <tpopp@google.com>2023-05-12 11:17:27 +0200
commit5c8ce6d5761ed6a9a39ef5a77aa45d8b6095e0f5 (patch)
tree60b910bd2320148cc8f97e230dbad1759fe48992 /mlir/examples/toy/Ch5
parentc89266448666262a3fc3b2f620d65078b4edd0ba (diff)
downloadllvm-5c8ce6d5761ed6a9a39ef5a77aa45d8b6095e0f5.tar.gz
[mlir] Move casting method calls to function calls
The MLIR classes Type/Attribute/Operation/Op/Value support cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast functionality in addition to defining methods with the same name. This change continues the migration of uses of the method to the corresponding function call as has been decided as more consistent. This commit attempts to update all occurrences of the casts in .td files, although it is likely that a couple were missed. Context: - https://mlir.llvm.org/deprecation/ at "Use the free function variants for dyn_cast/cast/isa/…" - Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443 Implementation: Unfortunatley, this was not automated, but was handled by mindlessly going to next occurrences of patterns, selecting the piece of code to be moved into the function call, and running a vim macro over the span of around 4 hours. Differential Revision: https://reviews.llvm.org/D150199
Diffstat (limited to 'mlir/examples/toy/Ch5')
-rw-r--r--mlir/examples/toy/Ch5/mlir/ToyCombine.td2
1 files changed, 1 insertions, 1 deletions
diff --git a/mlir/examples/toy/Ch5/mlir/ToyCombine.td b/mlir/examples/toy/Ch5/mlir/ToyCombine.td
index 15477e8969ca..11d783150ebe 100644
--- a/mlir/examples/toy/Ch5/mlir/ToyCombine.td
+++ b/mlir/examples/toy/Ch5/mlir/ToyCombine.td
@@ -42,7 +42,7 @@ def ReshapeReshapeOptPattern : Pat<(ReshapeOp(ReshapeOp $arg)),
// Reshape(Constant(x)) = x'
def ReshapeConstant :
- NativeCodeCall<"$0.reshape(($1.getType()).cast<ShapedType>())">;
+ NativeCodeCall<"$0.reshape(::llvm::cast<ShapedType>($1.getType()))">;
def FoldConstantReshapeOptPattern : Pat<
(ReshapeOp:$res (ConstantOp $arg)),
(ConstantOp (ReshapeConstant $arg, $res))>;