[SPIRV] Emit DebugLexicalScope for forloop controls (#8514)#8515
Open
SteveUrquhart wants to merge 1 commit into
Open
[SPIRV] Emit DebugLexicalScope for forloop controls (#8514)#8515SteveUrquhart wants to merge 1 commit into
SteveUrquhart wants to merge 1 commit into
Conversation
Member
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the SPIR-V emitter’s rich debug info generation to introduce an additional lexical scope for for loop controls (the for (<init>; <cond>; <inc>) region), addressing missing scope nesting reported in #8514 and updating FileCheck expectations accordingly.
Changes:
- Emit an extra
DebugLexicalBlockforforloop controls and push/pop it duringForStmtemission. - Update rich debug scope expectations so
%for_check,%for_continue, and%for_mergeuse the new controls lexical scope. - Refresh DebugLexicalBlock expectations in related SPIR-V debug-info tests (line/column and parent-scope relationships).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tools/clang/test/CodeGenSPIRV/shader.debug.debuglexicalblock.hlsl | Updates NS100 debug lexical block expectations to include a separate for controls lexical scope. |
| tools/clang/test/CodeGenSPIRV/rich.debug.debugscope.hlsl | Updates rich debug scope expectations for for blocks/labels to reference the new controls scope. |
| tools/clang/test/CodeGenSPIRV/rich.debug.debuglexicalblock.hlsl | Updates rich debug lexical block expectations to include the new for controls lexical scope. |
| tools/clang/lib/SPIRV/SpirvEmitter.cpp | Adds push/pop of a new debug lexical scope around for loop emission when rich debug info is enabled. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+2722
to
+2734
| RichDebugInfo *info = nullptr; | ||
| if (spirvOptions.debugInfoRich) { | ||
| const auto &sm = astContext.getSourceManager(); | ||
| auto loc = forStmt->getForLoc(); | ||
| const uint32_t line = sm.getPresumedLineNumber(loc); | ||
| const uint32_t column = sm.getPresumedColumnNumber(loc); | ||
| info = getOrCreateRichDebugInfo(loc); | ||
| auto *debugLexicalBlock = spvBuilder.createDebugLexicalBlock( | ||
| info->source, line, column, info->scopeStack.back()); | ||
|
|
||
| // Add this lexical block to the stack of lexical scopes. | ||
| spvContext.pushDebugLexicalScope(info, debugLexicalBlock); | ||
| } |
Comment on lines
+2860
to
+2864
| if (spirvOptions.debugInfoRich) { | ||
| // We are done with processing this compound statement. Remove its | ||
| // lexical block from the stack of lexical scopes. | ||
| spvContext.popDebugLexicalScope(info); | ||
| } |
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.
Adds missing DebugLexicalScope to for-loops, fixes #8514