Hello, I’ve encountered an issue with OpenMP in LLVM 17. While testing OpenMP memory mapping, I found that when using multi-level chained pointer access, the runtime mapping table cannot be correctly deleted due to reference counting.
For example, consider the following OpenMP directives:
#pragma omp target enter data map(to: s.ps->ps->ps->ps->i)
#pragma omp target exit data map(from: s.ps->ps->ps->ps->i)
After the enter data directive, the reference counts of the mapped objects are:
s.ps(1) -> ps(2) -> ps(2) -> ps(2) -> i(1)
Then, during exit data, the directive reduces the reference counts as follows:
s.ps(0) -> ps(1) -> ps(1) -> ps(1) -> i(0)
As a result, only the mappings for s.ps and i are deleted, while the intermediate mappings remain, which prevents proper cleanup.