Some uses of the preprocessor can result in multiple target regions on the
authorMike Rice <michael.p.rice@intel.com>
Thu, 3 Nov 2022 15:50:08 +0000 (08:50 -0700)
committerMike Rice <michael.p.rice@intel.com>
Fri, 4 Nov 2022 19:54:22 +0000 (12:54 -0700)
commitc954cfeb57a1c8c0996a34da64243bc7f7fe1107
treea9678302adb4d3bced105b78b36bbe7084b5194e
parent8c33639aa65d0771472abb28718f178d0ffa923d
Some uses of the preprocessor can result in multiple target regions on the
same line. Cases such as those in the associated lit tests, can now be
supported.

This adds a 'Count' field to TargetRegionEntryInfo to differentiate
regions with the same source position.

The OffloadEntriesInfoManager routines are updated to maintain a count of
regions seen at a location. The registration of regions proceeds that same as
before, but now the next available count is always determined and used in the
offload entry.

Fixes: https://github.com/llvm/llvm-project/issues/52707

Differential Revision: https://reviews.llvm.org/D134816
24 files changed:
clang/lib/CodeGen/CGOpenMPRuntime.cpp
clang/test/OpenMP/Inputs/multiple_regions.inc [new file with mode: 0644]
clang/test/OpenMP/multiple_regions_per_line.cpp [new file with mode: 0644]
clang/test/OpenMP/target_codegen_registration.cpp
clang/test/OpenMP/target_codegen_registration_naming.cpp
clang/test/OpenMP/target_parallel_codegen_registration.cpp
clang/test/OpenMP/target_parallel_codegen_registration_naming.cpp
clang/test/OpenMP/target_parallel_for_codegen_registration.cpp
clang/test/OpenMP/target_parallel_for_codegen_registration_naming.cpp
clang/test/OpenMP/target_parallel_for_simd_codegen_registration.cpp
clang/test/OpenMP/target_parallel_for_simd_codegen_registration_naming.cpp
clang/test/OpenMP/target_simd_codegen_registration.cpp
clang/test/OpenMP/target_simd_codegen_registration_naming.cpp
clang/test/OpenMP/target_teams_codegen_registration.cpp
clang/test/OpenMP/target_teams_codegen_registration_naming.cpp
clang/test/OpenMP/target_teams_distribute_codegen_registration.cpp
clang/test/OpenMP/target_teams_distribute_codegen_registration_naming.cpp
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_codegen_registration.cpp
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_codegen_registration_naming.cpp
clang/test/OpenMP/target_teams_distribute_simd_codegen_registration.cpp
clang/test/OpenMP/target_teams_distribute_simd_codegen_registration_naming.cpp
llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp