Issue |
140420
|
Summary |
[DirectX] External declaration 'switch.table.*' is unused
|
Labels |
new issue
|
Assignees |
|
Reporter |
farzonl
|
Currently seeing 6 errors of this on DML shaders
```bash
lldb -- dxv validation/QLinearConvDp4a7x7x2_QLConvI8_u8u8.dat
error: External declaration 'switch.table.CSMain' is unused
```
## Emited Error DeclNotUsedExternal:
https://github.com/microsoft/DirectXShaderCompiler/blob/adffd31eb02f690d9d1afe86c7fa6f12b4e70aa1/lib/DxilValidation/DxilValidation.cpp#L3798
## Erroring Instruction
```llvm
(lldb) expr GV->dump()
@switch.table.CSMain = private unnamed_addr constant [4 x i32] [i32 1, i32 257, i32 65793, i32 16843009], align 4
```
If we go beyond this breakpoint we eventually hit this assert:
## Assert in:
https://github.com/microsoft/DirectXShaderCompiler/blob/adffd31eb02f690d9d1afe86c7fa6f12b4e70aa1/lib/IR/Globals.cpp#L210
```cpp
void GlobalVariable::setInitializer(Constant *InitVal) {
if (!InitVal) {
if (hasInitializer()) {
// Note, the num operands is used to compute the offset of the operand, so
// the order here matters. Clearing the operand then clearing the num
// operands ensures we have the correct offset to the operand.
Op<0>().set(nullptr);
setGlobalVariableNumOperands(0);
}
} else {
/*line 210 -->*/ assert(InitVal->getType() == getType()->getElementType() &&
"Initializer type must match GlobalVariable type");
// Note, the num operands is used to compute the offset of the operand, so
// the order here matters. We need to set num operands to 1 first so that
// we get the correct offset to the first operand when we set it.
if (!hasInitializer())
setGlobalVariableNumOperands(1);
Op<0>().set(InitVal);
}
}
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs