Skip to content

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

Open
Steve Urquhart (SteveUrquhart) wants to merge 2 commits into
microsoft:mainfrom
SteveUrquhart:emit-forloop-debugscope
Open

[SPIRV] Emit DebugLexicalScope for forloop controls (#8514)#8515
Steve Urquhart (SteveUrquhart) wants to merge 2 commits 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

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

I addressed the points raised by CoPilot.

Comment thread tools/clang/lib/SPIRV/SpirvEmitter.cpp Outdated
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

✅ With the latest revision this PR passed the C/C++ code formatter.

Comment thread tools/clang/lib/SPIRV/SpirvEmitter.cpp Outdated
Co-authored-by: Chris B <beanz@abolishcrlf.org>
@SteveUrquhart

Copy link
Copy Markdown
Contributor Author

I accepted the nit, requiring reapproval. Sorry about the noise.

@dnovillo Diego Novillo (dnovillo) added the spirv Work related to SPIR-V label Jul 13, 2026
@SteveUrquhart

Copy link
Copy Markdown
Contributor Author

Hi Chris B (@llvm-beanz), can we please merge this?

@pow2clk

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@damyanp

Copy link
Copy Markdown
Member

[Auto-generated note from Damyan Pepper (@damyanp)]

Did you consider adding a release note?

Per our CONTRIBUTING guidance, user-visible bug fixes and new features usually need an entry in docs/ReleaseNotes.md. If this PR is part of a larger multi-PR effort, a single shared release note across that effort is totally fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

spirv Work related to SPIR-V

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

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

6 participants