[Flang][OpenMP] Fixes for unstructured OpenMP code
authorKiran Chandramohan <kiran.chandramohan@arm.com>
Tue, 24 May 2022 21:31:57 +0000 (21:31 +0000)
committerKiran Chandramohan <kiran.chandramohan@arm.com>
Tue, 24 May 2022 21:33:59 +0000 (21:33 +0000)
commit29f167abcf7d871d17dd3f38f361916de1a12470
treec14286427e94a53e343ea2bb46cfd3ae0e91d3d1
parent0bf3c38b0be3f9b45b589b780ed53f2de4d364d4
[Flang][OpenMP] Fixes for unstructured OpenMP code

Since the FIR operations are mostly structured, it is only the functions
that could contain multiple blocks inside an operation. This changes
with OpenMP since OpenMP regions can contain multiple blocks. For
unstructured code, the blocks are created in advance and belong to the
top-level function. This caused code in OpenMP region to be placed under
the function level.

In this fix, if the OpenMP region is unstructured then new blocks are
created inside it.

Note1: This is part of upstreaming from the fir-dev branch of
https://github.com/flang-compiler/f18-llvm-project. The code in this patch is a
subset of the changes in https://github.com/flang-compiler/f18-llvm-project/pull/1178.

Reviewed By: vdonaldson

Differential Revision: https://reviews.llvm.org/D126293

Co-authored-by: Val Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
flang/lib/Lower/OpenMP.cpp
flang/test/Lower/OpenMP/omp-unstructured.f90 [new file with mode: 0644]