[flang-commits] [flang] [mlir] [WIP] Delayed privatization. (PR #79862)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Fri Feb 9 02:31:59 PST 2024


================
@@ -3505,6 +3505,18 @@ struct ZeroOpConversion : public FIROpConversion<fir::ZeroOp> {
   }
 };
 
+class DeclareOpConversion : public FIROpConversion<fir::DeclareOp> {
----------------
tblah wrote:

No `fir-oppt --fir-to-llvm-ir` is not sufficient. The FIR pass pipeline is quite long (see https://github.com/llvm/llvm-project/blob/main/flang/test/Driver/mlir-pass-pipeline.f90). A few of these are optimizations (e.g. SimplifyIntrinsics, CSE, AliasTags), but several different passes are needed to convert FIR into LLVM (even more for HLFIR).

Roughly, to get from FIR to LLVM you need the passes in `createDefaultFIRCodeGenPassPipeline`: https://github.com/llvm/llvm-project/blob/ac3bd2bd530127786741bd9f164d66a3c3f40961/flang/include/flang/Tools/CLOptions.inc#L302

>From the command line you can pipe FIR into `tco` and it will output LLVM IR. `fir-opt` is more for running individual passes. The help text is a bit hard to follow, you can find `tco` specific options at the top of this file https://github.com/llvm/llvm-project/blob/main/flang/tools/tco/tco.cpp#L41

For example, `./bin/bbc -emit-hlfir -o - file.f90 | ./bin/tco` is a bit like running `flang-new -fc1 -O2 -emit-llvm -o - file.f90`

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


More information about the flang-commits mailing list