[flang-commits] [flang] [flang] lower select rank (PR #93967)

via flang-commits flang-commits at lists.llvm.org
Fri May 31 09:05:23 PDT 2024


https://github.com/vdonaldson approved this pull request.

Thanks Jean! This looks good to me!

I like your decision to use `fir.select_case` and remove `fir.select_rank`.

Most constructs are implemented at the construct level, not the statement level. Until now, the select case implementation was something of an anomaly in being implemented at the statement level. I kind of like the choice to again do it that way. The only cost of that is the change to `ConstructContext`, which I think is quite reasonable. The choice to reuse existing code already solves some issues. This means that of the three select constructs, select type is now the minority, construct-level implementation rather than select case, although the reverse is true for constructs overall. Any of these choices are fine though, which was the intent of allowing this flexibility for lowering.

I haven't checked this code or the large test case on this count but did you try various degenerate cases such as:
- no select-rank-case statements
- only a default select-rank-case-stmt
- only an assumed rank select-rank-case-stmt
- a select-rank-case-stmt with no code
- an assumed rank select-rank-case-stmt with no code
Most or all of these are probably legal.

Looks good!

https://github.com/llvm/llvm-project/pull/93967


More information about the flang-commits mailing list