<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60641>60641</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[OpenMP] offload linking undesired entanglement
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
jdoerfert
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ye-luo
</td>
</tr>
</table>
<pre>
Using the reproducer
```
$ clang++ -fopenmp --offload-arch=sm_80 main.cpp -foffload-lto -O3 -ffast-math -v
...
nvlink info : Function properties for '__omp_offloading_10307_18c6188_main_l9':
nvlink info : used 28 registers, 8 stack, 40 bytes smem, 360 bytes cmem[0], 0 bytes lmem
```
Once I comment the second offload region
```
nvlink info : Function properties for '__omp_offloading_10307_18c606c_main_l9':
nvlink info : used 16 registers, 0 stack, 12 bytes smem, 360 bytes cmem[0], 0 bytes lmem
```
The first offload kernel generation should not be affected by other kernels. There are undesired entanglement.
reproducer main.cpp
```
#include <unistd.h>
#include <cstdio>
#define N 100
int main()
{
int a[N];
#pragma omp target teams distribute parallel for map(a)
for(int i=0; i<N; i++)
{ a[i]=i; }
int b = 0;
#pragma omp target teams distribute parallel for map(a) reduction(+:b)
for(int i=0; i<N; i++)
{ a[i]+=1; b+=a[i]; }
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVUFv4zgP_TXKhbAhS4njHHyo6y_Ad9h2D7PnQJZoW1NZMiS5i_77hRw3yQCdwy4KBAnDR5GPDxQlQtCDRazJoSGM_VQOfY8-EsbIod2JJY7O1x-YmcXtOqc-6r-CtgPEEcHj7J1aJHpCW0KfSEm3z_Uv24M0wg6ENYQ1kPVuRjvNkGWu740TKhNejoS3YbpUFCahbS7nOQVuuIkOslcOWd-LELNJxBGy92v6PM-vhn032r6Btr0DACD8Cc6LlVE7C7N3M_qoMUDvPBB2vFzcNF-2AtoOl4JyerwUlSyLqrokEhdzIuxI-NNv8y8BFbAKPA46RPSBsGeoIEQh35K5p9B9RAwQJpySg5efHpk8h4aSQ5uAT7dJ7q9UfLUS4f8g3TShjavuAaWzCrYeVhLOfnn4kfp_14WW8t_oUpS_6kLvuhTs23T5MSL02od40-ENvUUDA1r0Yu0yjG4xCqyL0CGIvkcZUUH3AS6O6LcTIYcfI3oE4REWqzBojwrQRmEHg0n2bdKu3_exv43sb-afayvNohAIf16sDlHlI-H_-wqWISrt7uBniMJeW4QXKCh9hLSNa3XCKsJOG3JsrgZAggU5NC9JTn5zE8ZnL4ZJgJtmiMIPGCGimAIoHaLX3RIRZuGFMWjW0ZjETFglbkUgeQmrUgVNeEsJb5Lx_HI11rv-EE2OzcpEr0xanaLIsX3s5Uq3A8JboN_FFjyqZR32VaKG8Kfue5pIudoiBXZX-97eY2s349ep2KmaqxM_iR3WRXk8nI50T9lurGmB4nDiRXHkWPBqr0q5L3jFOBO8qjq10zWjjFNGT8WJUVrkneJldVCqVKeu60tJ9hQnoU1uzPuUOz_sdAgL1iUt98XOiA5N2Pa8xb9hBbc97-t0JuuWIZA9NTrEcM8SdTTrA_E6o_3jT3Job3cubYD0HHx9bXaLN_UY4xzS0mBnws6DjuPS5dJNhJ1The0nm737iTISdl55BcLOK-9_AgAA__9JW_s8">