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

    <tr>
        <th>Summary</th>
        <td>
            Backport request for fix POCL building on LoongArch
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          ouankou
      </td>
    </tr>
</table>

<pre>
    When building the main branch (6.0 pre-release) of POCL on LoongArch, 74 out of 252 tests failed because they lacked `addrspacecast` support. If we backport this [commit](https://github.com/llvm/llvm-project/commit/dd3e0a4643670f33850278ad281a358bbdd04e92) to the 18.x release, they all passed. The changes are only applied to LoongArch target.

/cherry-pick https://github.com/llvm/llvm-project/commit/dd3e0a4643670f33850278ad281a358bbdd04e92

```bash
 STDOUT:

  STDERR:

  6 warnings generated.

  LLVM ERROR: Cannot select: 0x7fffd94c7390: i64 = addrspacecast[0 -> 2]
 0x7fffd905c940

    0x7fffd905c940: i64 = PseudoLA_PCREL TargetGlobalAddress:i64<ptr @.str> 0
      0x7fffd94a5710: i64 = TargetGlobalAddress<ptr @.str> 0

  In function: _pocl_kernel_draw
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VEtv6zYT_TXUZhCBot4LLRw7_nABf0jgpu0yGJEjiTVNqiTVJP--kH3zum0X3RQQJGiGc868eDAEPVqijpW3rNwluMTJ-c4taE9uSXqnXrtfJ7LQL9oobUeIE8EZtYXeo5UTMNFUKYfZ040nQxiIiRbcAA_32wM4Cwfn7LjxcmJiC3UBbomrW5QCIoUYYEBtSEFPEpdAK8ErGJQnUsAqjkr5MKMkiSGyikNY5tn5mMK3AZ4JepSn9R_ipAOw8la681lHVu6YaKYY58DyDRN7JvajjtPSp9Kdmdgb88fb52b27jeSkYn992CxVyonjkVV5FXNhzxvSi7qBpVoMszLpu-V4gW1Yi02uktXsiZ9gfcebK-FoDEwYwikUnicCOSEdqQA6AmcNa-A82w0qRXkvVMQ0Y8UU8Z3jG--v8VeTuT9682s5Qn-g8o-k1f8-vQYpqsJfnrc3f_8uKbw6SCs5rvj8S_mCp7RW23HACNZ8hhJpV-PHA6__B_ujsf7NRq2aK2LEMis-ecb4C_1MAyqLWSdt3y16KoAlu_g64qUtxxuWH4HYt2BK_ZbLC9lW_CvtPCj9xPyQ6BFucPm6WF7vDvA42Us_zOuR7NRylNYR6CrguXbOXpgBU9D9Cs5_4D_ICiwrLMvBH-L-A9Yb4jfLAyLlVE7u0I9zU6apxN5S-ZJeXz-YWSJ6nLV5i0m1GV1lmVVnrdtMnWCN1WVYdZzURRN23CsuOKyHJRsW8I60Z3gouC5yHnO27JNsez7aih5XWWyL4aBFZzOqE267lrq_JjoEBbqmiqveWKwJxMuyiKEpWe4OJlY55L47rKf_TIGVnCjQwwfKFFHQ93t28329PtCIcLgPAz65aos74L0WWKSxZvuX1-NS16Bif0l7z8DAAD__zRujEA">