<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/124630>124630</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[HLSL] Create HLSLConstantAccess pass to translate `hlsl_constant` loads
</td>
</tr>
<tr>
<th>Labels</th>
<td>
HLSL
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hekota
</td>
</tr>
</table>
<pre>
Create a new `HLSLConstantAccess` pass that will translate all `load` instructions in `hlsl_constant` address space to `llvm.{dx|spv}.resource.load.cbuffer` intrinsics calls. It will make use of the metadata generated in #113514 that maps the constants global variables to individual constant buffers and specified the constant buffer layout. The pass also needs to transform related `getelementptr` instructions to use the constant buffer layout offsets.
After the `HLSLConstantAccess` pass completes the constant buffer metadata is no longer needed and should be removed.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8U01vpDgQ_TXmUgoC89HdBw6dRK1dKbfd-6qwC_DG2MhVdDb_fgXdk5lRMnPiwKtX7z3XQ2Y3BqJONY-qec5wlSmmbqLXKJj10b53T4lQCBACvYFqiz9e_np5ioEFg5yNIWbVFrAgM8iEAm_Oe5CEgf0-5_025SPaDecCS1qNuBgYXNh-TZ79P-bOuGHQ2kTMwAsaAon7vL_OuTo82v_U4YmXqzo854k4rslQvpHnpl-HgdJtiSQX2BkGg95zDn_edc34SrAyQRxAJoKZBC0KwkiBEgrZXZSuyrJqyvrmaMaFd_Q3kQyjjz16uGJy2HviTaUL1l2dXdF_AOGmiQGDBV7IuMGR_YnrDgGP73GVHP6e6BYmeo4QiOxOvgc6xDRDIr_rVG0xkpCnmYIskj6lK3F3-utlEIeBSThXxVkV5_MglHb471_ZxHnxJMRfUn8k6hhCBB_DSGn3QfYWwxRXb6EnSDTHK9ltfWa7yp6qE2bUlYfqWJRVW1fZ1FmitjxR39SmatGgMeWh0idsrCmKstSZ63Shm6LUB11WdVHlFR7rU3tqj8ehb469VXVBMzqf7ycU05g55pW6UtdtVWQee_K837_Wm2ul9daE1G34h34dWdWFdyz8nUGc-L0z-0DzDPeSfE7tXoz4QyO-Ovntgjlbk-8mkYVVdVb6ovRldDKtfW7irPRlW3__PCwp_ktGlL7sbljpy93QtdP_BwAA__-tSk_E">