Skip to content

spirv-opt: Keep ids used by OpMemberDecorateIdEXT live in ADCE - #6996

Closed
apollo-2006 wants to merge 1 commit into
KhronosGroup:mainfrom
apollo-2006:adce-member-decorate-id
Closed

apollo-2006 wants to merge 1 commit into
KhronosGroup:mainfrom
apollo-2006:adce-member-decorate-id

Conversation

@apollo-2006

Copy link
Copy Markdown
Contributor

ADCE drops constants that are only used by OpMemberDecorateIdEXT but keeps the decoration itself. So with

OpMemberDecorateIdEXT %Heap 0 OffsetIdEXT %offset

%offset is gone while the decoration still points at it, and the output fails with The following forward referenced IDs have not been defined. Six of glslang’s descriptor heap tests hit this under -O, -Os and --legalize-hlsl.

The decoration manager never registered OpMemberDecorateIdEXT, and ADCE only kept OpDecorateId operands live. Now it’s registered, ADCE keeps its id operand live like it does for OpDecorateId, and it’s removed when its target is dead, like OpMemberDecorate. The type manager still ignores it.

I added two ADCE tests, one with a live target and one with a dead one. test_opt passes on release and debug, and those six heap tests come out valid now. If you’d rather handle it another way, let me know :)

The decoration manager did not register OpMemberDecorateIdEXT, and ADCE
only kept the id operands of OpDecorateId live. So for

    OpMemberDecorateIdEXT %Heap 0 OffsetIdEXT %offset

ADCE removed %offset but kept the decoration, and the output failed
validation with "The following forward referenced IDs have not been
defined". All of glslang's descriptor heap tests that use OffsetIdEXT
hit this under -O, -Os and --legalize-hlsl.

Register OpMemberDecorateIdEXT in the decoration manager, keep its id
operand live in ADCE, and remove it when its target is dead.
@s-perron

Copy link
Copy Markdown
Collaborator

Thanks for the contribution. Sorry I didn't get to it sooner. #7021 does this too, and handle another pass as well. I will close this PR in favour of the other.

@s-perron s-perron closed this Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants