KhronosGroup / SPIRV-Registry

SPIR-V specs
109 stars 72 forks source link

NonSemantic.Shader.DebugInfo.100 & DebugGlobalVariable's Variable field #229

Closed LU-JOHN closed 6 months ago

LU-JOHN commented 8 months ago

The NonSemantic.Shader.DebugInfo.100 describes DebugGlobalVariable's Variable field as:

Variable is the of the source global variable or constant that is described by this instruction. If the variable is optimized out, this operand must be DebugInfoNone.

Sometimes when the variable is optimized out, we would like to utilize this field to hold an Expression that contains the constant value of the variable that was optimized out. Is this modification okay?

This change is motivated by https://github.com/llvm/llvm-project/pull/71780 which generates code like:

!5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression(DW_OP_constu, 1, DW_OP_stack_value)) !6 = distinct !DIGlobalVariable(name: "true", scope: !2, file: !3, line: 3, type: !7, isLocal: true, isDefinition: true)

This change will allow preservation of the DIExpression.

bashbaug commented 7 months ago

Since we've merged #231 is there anything more to do for this issue? Thanks!