[Mlir-commits] [mlir] [mlir] ArithToLLVM: fix memref bitcast lowering (PR #125148)

Matthias Springer llvmlistbot at llvm.org
Fri Jan 31 01:11:29 PST 2025


================
@@ -54,6 +54,23 @@ struct ConstrainedVectorConvertToLLVMPattern
   }
 };
 
+/// No-op bitcast.
+struct IdentityBitcastLowering final
+    : public OpConversionPattern<arith::BitcastOp> {
+  using OpConversionPattern::OpConversionPattern;
+
+  LogicalResult
+  matchAndRewrite(arith::BitcastOp op, OpAdaptor adaptor,
+                  ConversionPatternRewriter &rewriter) const final {
+    Value src = adaptor.getIn();
+    if (src.getType() != getTypeConverter()->convertType(op.getType()))
----------------
matthias-springer wrote:

I find this a bit difficult to follow. Would it make sense to change this to: `if (!isa<MemRefType>(src.getType())`? And rename the pattern to `MemRefBitcastLowering`?


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


More information about the Mlir-commits mailing list