<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/128071>128071</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[DirectX] Error if unknown intrinsic makes it to DXILOpLowering.cpp
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:DirectX
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
farzonl
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
farzonl
</td>
</tr>
</table>
<pre>
For the purposes of this ticket an unknown intrinsic is defined as any intrinsics not defined in `llvm/lib/Target/DirectX/DXIL.td`. In other words intrinsics not mapped to a DXIL Op.
Today we are letting these intrinsics slip through and we only catch the failure in the DXIL validator.
> Why is this a problem?
Clang builtins are usable in HLSL mode so intrinsics we never intended to support could also make their way to the DirectX backend.
Example:
https://hlsl.godbolt.org/z/13rPj18vn
This is because we don't error in the default case, we just skip it if we don't know what to do with it.
https://github.com/llvm/llvm-project/blob/87bf23216fc1257e88e0d38730df2d0187ff5bc6/llvm/lib/Target/DirectX/DXILOpLowering.cpp#L788-L789
Solution we should return some diagnositcs so the User knows the builtin and its coresponding llvm codegen is not valid when targeting the DirectX backend.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUlMGO2zYQhp-GvgwiUJQtaQ86uNk1GsBACiRFc6XIkcQ1TQqckV3n6QvKTrJo2gK9iSJn-M8_H0cTuTEgdmL3i1Bq0OlrDF4oJXbPG73wFFP3-Lnpo711Qu4PMQFPCPOS5khIEAfgyRGwMydk0AGWcArxGsAFTi6QM-AILA4uoAVNoMPtxx5BiPx91wUQtfT-chbq4F0v1OGzTiOyUIdnl9Dwl_z15cOxYCtqWcCHAJEnTHCNydLf8571PKMFjqAhR8HHuRByL-T-c7T6BlcEnRA8Mrsw5sII3-Yg72bgKcVlnEAHmwNi8Dcwms20GjFo55eUo9blestFe2c1x1TA_TZRvcAf0y0bsZqlYU6x93gW1UHI_Xuvwwj94jy7QKukhXTv16y_Hj8d4RwtAsW32q4IAS-Y8j8M9l4mLfMcE4OJi7egPUU46xNmaS7BVd_yoVXn3U3otTlhsA9XXv7U59mjqPJiYp4pf6qDUIfJky_GaPvouYhpFOrwVahDWaXfXsv2Eh625uocQY9GL4RZpI1BqIYBU4rpm00WB714BqMJhXqfz70uxEAnN4NjcMPb0MwTXCfNWb2NcHU8gePiJ5Gj42npCxNXfh4Y-cv53ZziK5qMUe9jxqpt-kFVqqwHU6pdg22L0lZtU0k7KCvLthmGXW_qN3n-C8eP8zFeMbkwFmaehaqOTdu-Ozbt092XT9Ev7GLIVdG0NichLykAxTOCdXoMkRxn5u4N-p0wrYXTunzAsULomMDEhDTHYDO3WSGYaHHEkN3P6K8MwnXCALxqfgD-L53f2K6yT9WT3mBXNlsp27rabTdT11ZlrZVubF-ZutRtI-umkU3VV_VTZRq9cZ2SaieVkqosn8ptse13u9K0RqGt5dYosZV41s4XWWZGZ-OIFuxK1cqm3Hjdo6fHDHqIEtX-u7_rNErd2sZ-GUlspXfE9CMdO_brEPsWs3uGlzttwz9Mo_wgKEPGEX7u3WZJvvvfVK0VUX4P96IunforAAD__w49zXY">