[flang-commits] [PATCH] D121171: [flang] Add ExternalNameConversionPass to flang-new pipeline
Andrzej Warzynski via Phabricator via flang-commits
flang-commits at lists.llvm.org
Mon Apr 11 03:16:54 PDT 2022
awarzynski added inline comments.
================
Comment at: flang/test/Driver/pass-pipeline.f90:33
+! CHECK: FIRToLLVMLowering
+! CHECK-NOT: LLVMIRLoweringPass
----------------
rovka wrote:
> It seems tco and flang-new lower from the LLVM dialect to LLVM IR slightly differently. tco uses a [[ https://github.com/llvm/llvm-project/blob/f1cfa461f28ed5bf77ca2e8f26cbf66fa09481a0/flang/tools/tco/tco.cpp#L115 | pass ]], but flang-new [[ https://github.com/llvm/llvm-project/blob/09c2b7c35af8c4bad39f03e9f60df8bd07323028/flang/lib/Frontend/FrontendActions.cpp#L440 | doesn't ]]. I put this check here in case we ever switch flang-new to use the pass, like tco does.
> It seems tco and flang-new lower from the LLVM dialect to LLVM IR slightly differently.
Good catch! This particular pass is effectively a wrapper for [[ https://github.com/llvm/llvm-project/blob/main/flang/lib/Optimizer/CodeGen/CodeGen.cpp#L3411 | mlir::translateModuleToLLVMIR ]] that unconditionally [[ https://github.com/llvm/llvm-project/blob/main/flang/lib/Optimizer/CodeGen/CodeGen.cpp#L3413 | prints the output ]]. So in practice this pass does two things:
* lower from MLIR LLVM IR to LLVM IR
* print the generated LLVM IR
In `flang-new`, the two actions are separated. `mlir::translateModuleToLLVMIR` is run [[ https://github.com/llvm/llvm-project/blob/3d0e0e1027203fe5e89104ad81ee7bb53e525f95/flang/lib/Frontend/FrontendActions.cpp#L440-L441 | here ]]. Printing is then done e.g. [[ https://github.com/llvm/llvm-project/blob/3d0e0e1027203fe5e89104ad81ee7bb53e525f95/flang/lib/Frontend/FrontendActions.cpp#L472 | here ]].
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121171/new/
https://reviews.llvm.org/D121171
More information about the flang-commits
mailing list