Issue 239027
Summary [HLSL][DXIL] Assertion in CGHLSLRuntime::handleStructSemanticLoad for bool struct member of entry point input
Labels new issue
Assignees
Reporter jzakharovnv
    Clang asserts during CodeGen when an HLSL entry point takes a struct parameter with a `bool` member carrying a semantic, for the DXIL target. The SPIR-V target compiles the same input.

### Reproducer

```hlsl
struct S { bool b : FOO; };
float main(S s) : SV_Target { return s.b ? 1 : 0; }
```

```
clang -cc1 -triple dxil-pc-shadermodel6.3-pixel -x hlsl -emit-llvm repro.hlsl
```

### Expected result

The shader compiles. The `bool` field is loaded from the signature and stored in the struct with the correct type.

### Actual result

```
Assertion failed: ExtractValueInst::getIndexedType(Agg->getType(), Idxs) == Val->getType()
 && "Inserted value must match indexed type!", file llvm\lib\IR\Instructions.cpp, line 2561
Stack dump:
 llvm::InsertValueInst::init()
  llvm::IRBuilderBase::CreateInsertValue()
 clang::CodeGen::CGHLSLRuntime::handleStructSemanticLoad() CGHLSLRuntime.cpp:1956
  clang::CodeGen::CGHLSLRuntime::handleSemanticLoad() CGHLSLRuntime.cpp:2008
 clang::CodeGen::CGHLSLRuntime::emitEntryFunction() CGHLSLRuntime.cpp:2128
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to