Skip to content

[SPIRV] Emit DebugLexicalScope for forloop controls (#8514)#8515

Open
SteveUrquhart wants to merge 1 commit into
microsoft:mainfrom
SteveUrquhart:emit-forloop-debugscope
Open

[SPIRV] Emit DebugLexicalScope for forloop controls (#8514)#8515
SteveUrquhart wants to merge 1 commit into
microsoft:mainfrom
SteveUrquhart:emit-forloop-debugscope

Conversation

@SteveUrquhart
Copy link
Copy Markdown
Contributor

Adds missing DebugLexicalScope to for-loops, fixes #8514

@damyanp
Copy link
Copy Markdown
Member

damyanp commented Jun 3, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 DebugLexicalBlock for for loop controls and push/pop it during ForStmt emission.
  • Update rich debug scope expectations so %for_check, %for_continue, and %for_merge use 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 thread tools/clang/lib/SPIRV/SpirvEmitter.cpp
Comment thread tools/clang/lib/SPIRV/SpirvEmitter.cpp
@SteveUrquhart SteveUrquhart force-pushed the emit-forloop-debugscope branch from 2d38cb6 to ae0dab8 Compare June 5, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

[SPIR-V] debug info omits scope necessary for for-loops

3 participants