[all-commits] [llvm/llvm-project] 730b80: [flang][Transforms] Add `SelectOpsConversion` pass...
Kareem Ergawy via All-commits
all-commits at lists.llvm.org
Thu Jul 30 10:54:07 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 730b803ed05e307d635b6b2764fad833629042c2
https://github.com/llvm/llvm-project/commit/730b803ed05e307d635b6b2764fad833629042c2
Author: Kareem Ergawy <kergawy at nvidia.com>
Date: 2026-07-30 (Thu, 30 Jul 2026)
Changed paths:
M flang/include/flang/Optimizer/Transforms/Passes.td
M flang/lib/Optimizer/Passes/Pipelines.cpp
M flang/lib/Optimizer/Transforms/CMakeLists.txt
A flang/lib/Optimizer/Transforms/SelectOpsConversion.cpp
M flang/test/Driver/bbc-mlir-pass-pipeline.f90
M flang/test/Driver/mlir-debug-pass-pipeline.f90
M flang/test/Driver/mlir-pass-pipeline.f90
A flang/test/Fir/SelectOpsConversion/select.fir
A flang/test/Fir/SelectOpsConversion/select_case.fir
A flang/test/Fir/SelectOpsConversion/select_rank.fir
M flang/test/Fir/basic-program.fir
M flang/test/Fir/select.fir
M flang/test/Lower/volatile3.f90
Log Message:
-----------
[flang][Transforms] Add `SelectOpsConversion` pass (#212977)
Introduces `--fir-select-ops-conversion`, which lowers `fir.select`,
`fir.select_case`, and `fir.select_rank` to the control-flow dialect
(`cf.switch` / `cf.cond_br` / `cf.br`) while preserving the CFG shape.
`fir.select_case` becomes an if-then-else ladder of `arith.cmpi` +
`cf.cond_br`; Fortran `UNSIGNED` selectors use `ule`. Signed / unsigned
FIR integer values are normalized to signless via `fir.convert` first.
`fir.select_type` is not handled here — it is already lowered by
`--fir-polymorphic-op` (`PolymorphicOpConversion`).
The pass runs in the default FIR optimizer pipeline right after
`PolymorphicOpConversion`. Pipeline-check tests are updated to expect
`SelectOpsConversion` in the sequence; `Fir/select.fir` and
`Lower/volatile3.f90` are relaxed to accept the newly-canonicalized form
of the lowered output.
The main purpose of moving these conversion pattern earlier in the MLIR
pipeline and target `cf` instead of directly `llvm` is to be able to
later on use control-flow to structured-control-flow lifting:
https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir/Conversion/Passes.td#L402.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply at anthropic.com>
PR Stack:
* ▶️ https://github.com/llvm/llvm-project/pull/212977
* https://github.com/llvm/llvm-project/pull/212978
---------
Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply at anthropic.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list