[flang-commits] [flang] [mlir] [MLIR][LLVM] Fix inlining of a single block ending with unreachable (PR #122615)
Tobias Gysi via flang-commits
flang-commits at lists.llvm.org
Sun Jan 12 10:29:42 PST 2025
gysit wrote:
> LLVM is similar: https://godbolt.org/z/ncM7enGh6
LLVM seems to split the callee block into a first block terminated by an unreachable operation and a second block that returns poison. This has the advantage that the unreachable is inlined and not lost (I believe the PR deletes the poison?). I wonder if we could implement the same behavior?
One approach may be to overwrite `processInlinedBlocks` to detect if the inlined blocks contain one block terminated with an unreachable. In this case, we could split the single block and have a separate block that returns poison to avoid the code path in the inliner that optimizes the single-block case. I am not entirely sure if this works though.
https://github.com/llvm/llvm-project/pull/122615
More information about the flang-commits
mailing list