Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/dxil.c:
+ + for (i = 0; i < record->operand_count; ++i) + { + uint64_t ref; + + ref = record->operands[i] - 1; + if (record->operands[i] >= 1 && ref >= end_count) + { + WARN("Invalid metadata index %"PRIu64".\n", ref); + vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_INVALID_METADATA, + "Metadata index %"PRIu64" is invalid.", ref); + vkd3d_free(node); + return VKD3D_ERROR_INVALID_SHADER; + } + + if (!node->is_distinct && ref == dst_idx) Here it seems that the point of non-distinct nodes is that they can't reference themselves. However, they can still reference later nodes, so it's still possible that reference cycles exist. Is that expected? I'm asking because I find it somewhat strange that you disallow self-references but still allow cycles. But if that's what LLVM/DXC intended, ¯\\_(ツ)_/¯.
-- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/372#note_47542