[flang-commits] [PATCH] D153858: [flang] do not merge block after lowering
Jean Perier via Phabricator via flang-commits
flang-commits at lists.llvm.org
Tue Jun 27 09:37:24 PDT 2023
jeanPerier added a comment.
In D153858#4452828 <https://reviews.llvm.org/D153858#4452828>, @vdonaldson wrote:
> Does block coalescing still happen later in the compilation pipeline? That's a nice optimization that we don't want to completely lose.
It will still happen in LLVM after MLIR depending on what optimization levels are set.
If we want it at the MLIR level, we will need to add options to the MLIR one so that it has some sort of idea of the cost of merging blocks (creating block arguments implies forcing the codegen of the related type to some runtime representation. Depending on the SSA type this may or may not be cheap. So the MLIR pass should be provided some kind of interface to decide whether or not block merging is profitable).
Or we will need to share the some logic with MLIR but do our own pass.
So far I am assuming that LLVM is able to do a good job for simple small blocks/extra jumps and that we do not really need to do this at the MLIR level.
================
Comment at: flang/lib/Lower/Bridge.cpp:4181
// Eliminate dead code as a prerequisite to calling other IR passes.
// FIXME: This simplification should happen in a normal pass, not here.
mlir::IRRewriter rewriter(*builder);
----------------
vdonaldson wrote:
> Is this FIXME comment (still) valid?
>
It is not recommended by MLIR to use IRRewriter directly, that is why I am leaving it. But I do not see us changing this anytime soon.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153858/new/
https://reviews.llvm.org/D153858
More information about the flang-commits
mailing list