[HLSL][SPIRV] Remove unecessary `STI.isShader()` check that avoid `OpConstantNull`
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Currently, to match DXC existing behaviour, there are a few cases where `STI.isShader()` is used to decide if a null constant should be used when lowering to SPIRV.
https://github.com/llvm/llvm-project/blob/f04b27125ad150f3ca7488272cddc3a6341cbf15/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp#L4159
After an internal discussion, we decided to NOT replicate this pattern in clang. So such checks can be removed. For example, the following code:
```spirv
%[[#const_i16_0:]] = OpConstant %[[#int_16]] 0
OpConstantComposite %[[#vec4_16:]] %[[#const_i16_0:]] %[[#const_i16_0:]] %[[#const_i16_0:]] %[[#const_i16_0:]]
```
Should lower to:
```spirv
%[[#const_i16_0:]] = OpConstantNull %[[#int_16]]
```
Contributor guide
Assessment
This issue has not been assessed yet.