[flang-commits] [clang] [flang] [Flang][FIR] Introduce FIRToCoreMLIR pass. (PR #168703)

Ming Yan via flang-commits flang-commits at lists.llvm.org
Mon Dec 15 23:10:22 PST 2025


NexMing wrote:

Hi @jeanPerier 

> While I agree that leveraging the existing memref infra makes sense, and as @rscottmanley mentioned, we are actually also working on enabling converting part of FIR to MLIR memref/scf, I think the more generic MLIR optimizations passes are the one that are dialect independent and relies on interfaces.

I agree with your proposal. I think we are largely aligned on the overall work of converting FIR to MLIR memref/scf, and I also agree that establishing the pipeline at this stage is too premature. If I revert the handling of fir.cg, do you think the current PR is still worth submitting (it seems to overlap with your work)? I need to rely on the work of converting FIR to MLIR for further optimization exploration.

> I would more than welcome some help to enable the mem2reg with fir.delcare, I think what is needed is a fir.declare_value that can be used to keep track of the promoted values (very similar to what is done for [llvm.dbg.declare](https://github.com/llvm/llvm-project/blob/6e01ea4babc8b5f41cc1541ab73af4388b1744f3/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td#L710)) so that we can later emit debug info for it in the DebugInfo pass. Would you be interested to work on this?

I’d be very happy to help with this work. Do you mean enabling mem2reg at the FIR level and converting `fir.declare` to `fir.declare_value` during the FIR to MLIR lowering process?

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


More information about the flang-commits mailing list