[Mlir-commits] [mlir] [mlir][memref] Add foldUseDominateCast function to castOp (PR #168337)

lonely eagle llvmlistbot at llvm.org
Mon Nov 17 07:28:00 PST 2025


================
@@ -793,8 +795,32 @@ bool CastOp::areCastCompatible(TypeRange inputs, TypeRange outputs) {
   return false;
 }
 
+static OpFoldResult foldUseDominateCast(CastOp castOp) {
+  auto funcOp = castOp->getParentOfType<FunctionOpInterface>();
+  if (!funcOp)
+    return {};
----------------
linuxlonelyeagle wrote:

I wish to extract the castOps from funcOp, apologies. The following code would be `auto castOps = funcOp.getFunctionBody().getOps<CastOp>();`

https://github.com/llvm/llvm-project/pull/168337


More information about the Mlir-commits mailing list