Fix payload access qualifier ICEs on member method calls - #8726
Merged
damyanp merged 3 commits intoJul 31, 2026
Conversation
Calling a member method on a payload under -enable-payload-qualifiers hit two crashes in the SemaDXR payload-access analysis: * A method on a nested payload field (`p.e.getType()`) was picked up as the payload field `MemberExpr`, so `cast<FieldDecl>` on the method decl failed with `llvm::cast<X>() argument of incompatible type!`. Payload access tracking now only considers member expressions that name a field, which also attributes the access to the correct field. * A method on the payload itself (`p.getTag()`) has no explicit payload argument, so `DiagnosePayloadAsFunctionArg` never assigned `CalleeInfo.Payload`. `DxrShaderDiagnoseInfo` had no member initializers, so the subsequent null check read an indeterminate pointer and faulted in `GetPayloadType`. The members are now initialized, which also removes the same latent issue at the two other partially-initialized construction sites. Add a DXC regression test covering both cases. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 545d43d4-7d8a-4f9c-b823-364bfee6c739
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 545d43d4-7d8a-4f9c-b823-364bfee6c739
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes payload access qualifier crashes caused by ray payload member-method calls.
Changes:
- Safely distinguishes payload fields from member methods.
- Initializes payload diagnostic state.
- Adds regression coverage and release notes.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
tools/clang/lib/Sema/SemaDXR.cpp |
Prevents invalid casts and uninitialized reads. |
tools/clang/test/DXC/payload_qualifier_nested_method_call.hlsl |
Tests nested-field and payload method calls. |
docs/ReleaseNotes.md |
Documents the fix. |
damyanp
marked this pull request as draft
July 31, 2026 17:06
The DXIL compat suite re-runs tools/clang/test/DXC against released dxil.dll validators, and lib_6_9 is rejected by the 1.6 validator. The bug is not SM 6.9 specific, so target lib_6_7 and add the matching REQUIRES gate. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 545d43d4-7d8a-4f9c-b823-364bfee6c739
llvm-beanz
approved these changes
Jul 31, 2026
llvm-beanz
left a comment
Collaborator
There was a problem hiding this comment.
This looks reasonable, but I don't really like that it's including changes unrelated to the issue it is resolving.
bob80905
approved these changes
Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Calling a member method on a ray payload crashed the payload access qualifier
analysis, on any
lib_6_7+ target or with-enable-payload-qualifiers. It goesback to at least DXC 1.7.2207.
cast<FieldDecl>failure when the method is called on a payload fieldMethod bodies are still not analyzed, so a write inside a payload method is not
seen by the "never unconditionally written" check. That already matches how a
write through an
inoutfree function parameter behaves today.Fixes #6464
Assisted-by: copilot