[all-commits] [llvm/llvm-project] 877552: [flang][Transforms] Add SelectOpsConversion pass
Kareem Ergawy via All-commits
all-commits at lists.llvm.org
Thu Jul 30 02:54:30 PDT 2026
Branch: refs/heads/users/ergawy/lower-fir-switch-to-cf
Home: https://github.com/llvm/llvm-project
Commit: 877552125de71adb20acf492c35ddf94830e26e5
https://github.com/llvm/llvm-project/commit/877552125de71adb20acf492c35ddf94830e26e5
Author: ergawy <kareem.ergawy at gmail.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
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.
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