[flang][OpenMP][OpenACC] Support stop statement in OpenMP/OpenACC region
This supports lowering of stop statement in OpenMP/OpenACC region.
- OpenMP/OpenACC: Emit fir.unreachable only if the block is not terminated by any terminator. This avoids knocking off an existing OpenMP/OpenACC terminator.
- OpenMP: Emit the OpenMP terminator instead of fir.unreachable since OpenMP regions can only be terminated by OpenMP terminators. This is currently skipped for OpenACC since unstructured code is not yet handled specially in OpenACC lowering.
Fixes #60737
Fixes #61877
Co-authored-by: Peixin Qiao <qiaopeixin@huawei.com>
Co-authored-by: Val Donaldson <vdonaldson@nvidia.com>
I am a bit surprised that this works. From the tests, it does work. How does it detect correctly whether the Stop is not in the final basic block for insertion of fir.unreachable?
This will have issues with the Block construct.
For the following test, something goes wrong. Could be an existing issue.