[Mlir-commits] [mlir] [mlir][bufferization] Introduce castBufferTypeFn hook and API (PR #205080)

Andrei Golubev llvmlistbot at llvm.org
Wed Jul 1 01:52:43 PDT 2026


================
@@ -172,12 +172,9 @@ struct SelectOpInterface
         return selectOp->emitError(
             "incompatible buffer types on true/false operands");
       }
-      if (trueBuffer.getType() != *targetType)
-        trueBuffer =
-            memref::CastOp::create(rewriter, loc, *targetType, trueBuffer);
-      if (falseBuffer.getType() != *targetType)
-        falseBuffer =
-            memref::CastOp::create(rewriter, loc, *targetType, falseBuffer);
+      trueBuffer = *options.createCast(rewriter, loc, *targetType, trueBuffer);
----------------
andrey-golubev wrote:

done! it does look a bit clunkier now but i guess this is something that I'll revise in the follow-up: when cleaning up the `create*()` functions.

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


More information about the Mlir-commits mailing list