Issue 79057
Summary [SPIRV] SPIR-V Backend crashes on creation of a struct with opaque pointer fields
Labels new issue
Assignees
Reporter VyacheslavLevytskyy
    An attempt to use opaque pointer fields in a struct makes SPIR-V Backend crash on the stage of module analysis if the struct has more than one opaque pointer field. For example:

```
@a = addrspace(1) constant i32 123
@struct = addrspace(1) global {ptr addrspace(1), ptr addrspace(1)} { ptr addrspace(1) @a, ptr addrspace(1) @a }

define spir_kernel void @foo() {
  ret void
}
```

demonstrates a crash in `SPIRVGeneralDuplicatesTracker::buildDepsGraph()` due to the fact that there is no mandatory records defined in `SPIRVReg2EntryTy Reg2Entry;` for some type references of `OpTypeStruct`: namely, for all opaque pointer type arguments of `OpTypeStruct` after the first one.

The root cause is producing of multiple identical opaque pointer types, i.e., creation of new `OpTypePointer` without checking their existence. Along with inserting just a single record per type into a data structure used for dependencies analysis in `SPIRVGeneralDuplicatesTracker::buildDepsGraph()` this causes missing records in the same data structure for all opaque pointer fields except for the first one.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to