llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.07k stars 11.08k forks source link

[flang][OpenACC] stop statement in one construct inside one acc region #61281

Open PeixinQiao opened 1 year ago

PeixinQiao commented 1 year ago
subroutine test_stop_in_region3()
  integer :: x
  !$acc parallel
    x = 3
    if (x > 1) stop x
  !$acc end parallel
end
$ bbc -emit-fir -fopenacc test.f90 
error: loc("/home/qpx/compilers/llvm-community/example/fix-exit-region/acc/test.f90":4:5): operation with block successors must terminate its parent block
FATAL: verification of lowering to FIR failed
llvmbot commented 1 year ago

@llvm/issue-subscribers-flang-ir

clementval commented 1 year ago

Didn't you work on a patch for that (https://reviews.llvm.org/D129969)

PeixinQiao commented 1 year ago

@clementval I am rebasing it. I found they are different problems. If the stop statement is in one OpenMP/OpenACC region, D129969 will handle it by removing fir.unreachable. If the stop statement is in one if construct and if construct is in one OpenMP/OpenACC region, the fir.unreachable will not be removed. This case is OK in OpenMP, but it crash in OpenACC.

llvmbot commented 1 year ago

@llvm/issue-subscribers-bug