[flang-commits] [flang] [Flang] Moving MIFOpConverion pass earlier (PR #184342)
via flang-commits
flang-commits at lists.llvm.org
Tue Mar 3 07:30:30 PST 2026
https://github.com/jeanPerier commented:
I am not against moving the conversion earlier, but I think this is just dodging an issue that may also fire in other contexts. mif.change_team[ definition claims](https://github.com/llvm/llvm-project/blob/e570faa87ed3afb21504d06d0c22d82686f3a8e3/flang/include/flang/Optimizer/Dialect/MIF/MIFOps.td#L369) it can support a region with one or more blocks, but [its codegen](https://github.com/llvm/llvm-project/blob/81396ebc51c40214465111ede745147989c67e48/flang/lib/Optimizer/Transforms/MIFOpConversion.cpp#L692-L694) only deals with the case where it has one block.
There are contexts in which lowering will generate mutli block logic and you will hit the same issue. So I think you should rather fix the codegen to move all blocks instead of just one.
Example, there is a good chance the following valid program still crashes after your current patch:
```
subroutine test(i)
use, intrinsic :: iso_fortran_env, only: team_type
implicit none
integer :: i
type(team_type) :: team
change team (team)
1 i = i +1
if (i<0) go to 1
end team
end
```
https://github.com/llvm/llvm-project/pull/184342
More information about the flang-commits
mailing list