<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/108567>108567</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[HLSL][SPIRV] HLSL Entry points are not properly process when targeting spirv
</td>
</tr>
<tr>
<th>Labels</th>
<td>
HLSL
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
s-perron
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
s-perron
</td>
</tr>
</table>
<pre>
### Problem 1
If the entry point is [main](https://godbolt.org/z/K6T59sord), a new function is created to wrap around "main", which becomes the new entry point. Since the original function is already called "main", the entry pointer gets the name "main.1". This is what shows up in the `OpEntryPoint` instruction in the SPIR-V:
```
OpEntryPoint GLCompute %4 "main.1"
```
For DXIL, the original function is considered an internal function, and has its name mangled. This allow the actual entry point to get the name "main". See https://godbolt.org/z/oebKEKq1d.
### Problem 2
The `-E` option, which is used to identify an entry point other than main, is ignored. See https://godbolt.org/z/s5fP3661M. Note that csmain is viewed as an exported function, but not an entry point.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVMFu4zYQ_RrqMrAgjS3JPuiwieM2SNoGTbDolRLHEguKVMlRXPfrC0oO1vEu0AIEbZEzb957HFKGoDtLVIviTiCG1UjeOysQRbFP5MS98_XHatI4da4FrpcBL941hgbIRbYX2ZdlfjwC9wRk2Z9hdNoy6ACiuBuktqLYC9z2zGMQ6y8CDwIPnVONM5w63wk8_CPw8FS-FbvgvBK4E3gPEiyd4DjZlrWzEa71JJkUsIOTlyNI7yarQCDOVRBj2qnXbQ8NtW6gMJOKMFfEUnjVtqV5y3ndaSvNpzLSeJLqDK00hm7hb1SSh474UkcO9BGd5gIxhbdehwh56iVD6N0pwDSCtnO8KLPfxoeI9RKhRJmBtoH9dGGyRL2-PP6--hp9u7JblNllzJ_XMPDT870bxokjl2LzidAPk5f54Dzs_3h8_tD4Q2daZ4NW5EmBjASZ_HXIfGpWQS8DaA6LIYO0nSF18UIa405zAdnyJM2njmEXzfzOy9nJVyL4rw5y1Dw9PP2Vq_STV991Ll5vvy0nsXqI_rvxQ8fSRjrAFJaO04os6-M5Kr8m7bgnD9xLCwvZ-5ilO-t8VP1_eIfi-LIuy_yXFH51HDtTMrQhwkWsd02n6HiYS_89Oh8vwbXpzcRgHd9QSxNVr9VuvZMJ1XmFJa6ral0lfZ2rY6nyXYWNVGpLedPgNm9RkWplQ5QlusYMN9kuX-cb3BZVik2lsuNWFu2uOiq5EZuMBqlNasz7EKUkOoSJ6jzbFmWVGNmQCZfn5efn1-fL0-LrGL9qpi6ITWZ04PANgTWb-UmaE4q9KO5i838VxR7iEjx80xZAepo1j96N5M05_mkpxLtGFlj6jljbDsKo_XsyeVPfHIPmfmrS1g0CD5HD5Wc1evcntSzwMEsKAg8XVe81_hsAAP__h96upQ">