[flang-commits] [flang] [flang] restrict fir.convert lowering (PR #172117)
via flang-commits
flang-commits at lists.llvm.org
Mon Dec 15 05:13:31 PST 2025
================
@@ -816,6 +816,16 @@ struct ConvertOpConversion : public fir::FIROpConversion<fir::ConvertOp> {
mlir::ConversionPatternRewriter &rewriter) const override {
auto fromFirTy = convert.getValue().getType();
auto toFirTy = convert.getRes().getType();
+
+ // Let more specialized conversions (e.g. FIR to memref
+ // converters) handle fir.convert when either side is a memref. This
+ // avoids interfering with descriptor-based flows such as fir.box /
+ // fir.box_addr and keeps this pattern focused on value conversions.
+ if (mlir::isa<mlir::MemRefType>(fromFirTy) ||
+ mlir::isa<mlir::MemRefType>(toFirTy)) {
+ return mlir::failure();
+ }
----------------
jeanPerier wrote:
Nit: no braces for single line if.
https://github.com/llvm/llvm-project/pull/172117
More information about the flang-commits
mailing list