<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/149708>149708</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Flang][OpenMP][Debug] Assertion `DbgUsers.empty()' failed.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            bug
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          k-arrows
      </td>
    </tr>
</table>

<pre>
    Reproducer:
```f90
 procedure(g), pointer :: f
  !$omp parallel
   f => g
  !$omp end parallel
contains
  subroutine g
    integer :: i, j, k
    !$omp taskloop firstprivate (j, k)
    do i = 1, 2
    end do
  end subroutine g
end
```

When I use assertion-enabled flang, compiling the above reproducer by "flang -fopenmp -g" causes the following assertion failure:
```txt
llvm-project/llvm/lib/Transforms/Utils/CodeExtractor.cpp:1290: void fixupDebugInfoPostExtraction(llvm::Function &, llvm::Function &, llvm::CallInst &, const SetVector<llvm::Value *> &, ArrayRef<llvm::Value *>): Assertion `DbgUsers.empty()' failed.
``` 
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVE2P2zYQ_TXUZWCDoiTbOuigrGNgD0WDtEnPpDiSmaVIgh_O7r8vyKhrJ0CBFjDMrzecmfcexUNQi0EcSPeBdOeKp3i1fnjZce_t91AJK9-Gz-i8lWlCT5qR0JEc6I_f3FNCR3DeTiiTR8JOC2E9YU_grDIRPeSIZoQ544CwmrDWrg4c91xr1GUbZiDNmTQfYfkFhkY-QidrIlcmFFRIwtsUlcEtDCCnXO5JVS7kW_572QD3myMPL9paB7PyITqvbjwiEHba8KzfQqQFlcuDOh-wbTcXJm1Z5OkvtaCRjzTlOR3_uqKBZ0gBgYeAPiprdmi40Chh1twsOcFkV6e0MgvEKwIX9obg3_kH8QaEsYKG3WwdmtXBbiGMwcRTwFDCZqu1_Z4vec8EM1c6S_SzgvE1EjpqfVt3zttvOEXCLnmZByUIu_zpuQmz9Wsg7PIlKp3HJyvx42v0fIrW7yfnSDPWrKeZ9ZtVEmb1mtwZRVqezWw_2RA3uLKGsFPJUES6JFM2gbBD7v-_nDxxrZ9NiP-cTDYv_sD4FXM9pHm6Y79ynbKuY7bXhh-952-fcf5XYFa_GWF8J48c6FksXwL6sMfVxTfCTsXox8Iryv0jqVDJoZF90_MKh_rYNbRu-2NdXYdJUCn6lnPRtD3vxVQfZNucOsq7XgiGlRoYZR09Mlqz5lDX-04cBaN13bRSnCibSEtx5Urvc-V765dKhZBwyBnoqdJcoA7lNTMmUjZGftZ-KBKLtATSUq1CDPcLooq6fAAuxYTdmXQffndofvv0Y15kJN35f_FRJa-Ha4wuZHrZhbDLouI1if1k1weP_ey80ks22NbObWB_BwAA__8022vJ">