<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/119124>119124</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
When do we still want "warning: local memory global used by non-kernel function"
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:AMDGPU
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
JonChesterfield
</td>
</tr>
</table>
<pre>
Currently, non-kernel functions which use AMDGPUAS::REGION_ADDRESS will raise this error. I think that's fine - region address maps onto global data store (iirc) which is quite niche already.
Functions which use LDS and are reachable from a kernel have their accesses rewritten to globals with absolute addresses (and thus don't trigger this warning), but functions which are not used by any kernels are presently left unchanged and do emit this warning. That seems to be a somewhat common case, I get asked about it once a month or so.
Shall we keep the warning, but adjust the LDS lowering pass to burn out the uses in dead functions? Currently we compile them to a trap in the backend immediately after the diagnostic, it seems broadly reasonable to replace with undef and insert a trap in the IR lowering instead. Then the backend warning stays in place to catch places where the middle end has messed up but the current false positives are removed.
Thoughts / objections?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxslE9v4zYQxT8NfRnEsCk7sQ46uJv1IkX_YbNFj8VIHIncUByVM4rhb19QdjbYdk-GLHLmvd88DYqEIRE1Zv-T2T-ucFbPufmZ0wdPopT7QNGtWnaX5sOcMyWNF2M_QOJ090I5UYR-Tp0GTgJnHzoPsxAcf3389Mefx2dTHU11_Pzx09Pvv_19fHz8_PH5Gc4hRsgYhEB9EKCcOa_hqTylF1CPauyDQB8SwR1kGgInQOcyicCIkwAnZRgitxjBoSKIciYw9hBC7oytb1qCwD9zUIIUOk-AMRO6y9psjmZzPP1A-C-Pz4DJAWaCTNh5bCNBn3kEhJthj69FOYUM2HUkQgKZzjmoUoJvwgTOQT1gKxxnpTcDJEVm6aF-FnCcjH1Q0ByGgfKVyBlzCmkwti6s21n_B7noS6xFs4P2ApguN3myvJsyyTIsiNQrzKnzm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