Added debug info for localized global variables for inlined scopes.#7799
Merged
adam-yang merged 7 commits intomicrosoft:mainfrom Nov 17, 2025
Merged
Added debug info for localized global variables for inlined scopes.#7799adam-yang merged 7 commits intomicrosoft:mainfrom
adam-yang merged 7 commits intomicrosoft:mainfrom
Conversation
Contributor
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
llvm-beanz
reviewed
Oct 8, 2025
tools/clang/test/HLSLFileCheck/dxil/debug/local_global_inline_scope.hlsl
Show resolved
Hide resolved
damyanp
approved these changes
Nov 13, 2025
Member
There was a problem hiding this comment.
LGTM
FWIW, I wasn't sure what the .ll test was testing (mostly through my ignorance), but I checked out the branch and reverted the functional changes and that test started failing, which convinced me at least that it is testing something.
I would recommend getting a review from someone more familiar with the codebase than I am!
llvm-beanz
approved these changes
Nov 17, 2025
damyanp
added a commit
to damyanp/DirectXShaderCompiler
that referenced
this pull request
Feb 19, 2026
…oft#8174) PR microsoft#7799 added debug info for global variables across all inlined subprograms, creating O(subprograms x globals) debug instructions. This caused 2-3x slower compilation for shaders with many globals and deeply-inlined functions. Fix: Instead of collecting ALL subprograms for a function (walking every instruction), only collect subprograms from the alloca's actual users -- the instructions that reference the specific global variable. This preserves the debug info feature (globals visible in inlined scopes that use them) while eliminating work for unrelated scopes. The 'Lower static global into Alloca' pass is 3.8x faster on the stress test (41ms -> 11ms), and overall debug compilation is ~10% faster. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
tex3d
pushed a commit
that referenced
this pull request
Feb 20, 2026
…ateDxilComputeAndNodeCommonInputs() (#8022) As a result of #7799, the HLSL entry function can now contain `dbg.value` calls with !dbg location metadata with scopes corresponding to functions which have been inlined. The `HLSignatureLower::GenerateDxilComputeAndNodeCommonInputs()` creates `@dx.op.threadId` intrinsic calls, using the default dbg loc when creating an `IRBuilder`. When the first instruction in the entry block is one of the `dbg,value` calls, its dbg location is copied to the `@dx.op.threadId` calls. That makes the DXIL unreadable by the modern LLVM IR reader since it fails the IR module verification because of !dbg pointing to a different subprogram scope. This change sets the dbg location for IRBuilder to be the !dbg node of the first non-PHI and non-debug instruction in the block. --------- Co-authored-by: Konstantin <konstantin.pyzhov@amd.com>
Copilot AI
added a commit
that referenced
this pull request
Feb 20, 2026
… inlined scopes Co-authored-by: alsepkow <5620315+alsepkow@users.noreply.github.com>
alsepkow
added a commit
to alsepkow/DirectXShaderCompiler
that referenced
this pull request
Feb 20, 2026
…copes. (microsoft#7799)" This reverts commit 450bbe5.
alsepkow
added a commit
that referenced
this pull request
Feb 20, 2026
luciechoi
pushed a commit
to luciechoi/DirectXShaderCompiler
that referenced
this pull request
Feb 20, 2026
…ateDxilComputeAndNodeCommonInputs() (microsoft#8022) As a result of microsoft#7799, the HLSL entry function can now contain `dbg.value` calls with !dbg location metadata with scopes corresponding to functions which have been inlined. The `HLSignatureLower::GenerateDxilComputeAndNodeCommonInputs()` creates `@dx.op.threadId` intrinsic calls, using the default dbg loc when creating an `IRBuilder`. When the first instruction in the entry block is one of the `dbg,value` calls, its dbg location is copied to the `@dx.op.threadId` calls. That makes the DXIL unreadable by the modern LLVM IR reader since it fails the IR module verification because of !dbg pointing to a different subprogram scope. This change sets the dbg location for IRBuilder to be the !dbg node of the first non-PHI and non-debug instruction in the block. --------- Co-authored-by: Konstantin <konstantin.pyzhov@amd.com>
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.
Previously, global variables converted to
alloca's, their debug info is written as adbg.valuefor a fake local variable prefixed with "global.". This was only done for the entry function'sDISubprogram, which makes the variable inaccessible for all inlined function scopes.This change creates a
dbg.valuefor each inlinedDISubprogram, each pointing to a newDILocalVariablewith the inlinedDISubprogramas its scope.