spirv-opt: Switch from Vulkan.DebugInfo to Shader.DebugInfo (#4493)
Includes:
- Shift to use of spirv-header extinst.nonsemantic.shader grammar.json
- Remove extinst.nonsemantic.vulkan.debuginfo.100.grammar.json
- Enable all optimizations for Shader.DebugInfo
Also fixes scalar replacement to only insert DebugValue after all
OpVariables. This is not necessary for OpenCL.DebugInfo, but it is
for Shader.DebugInfo.
Likewise, fixes Private-to-Local to insert DebugDeclare after all
OpVariables.
Also fixes inlining to handle FunctionDefinition which can show up
after first block if early return processing happens.
Co-authored-by: baldurk <baldurk@baldurk.org>
diff --git a/source/opt/inline_pass.cpp b/source/opt/inline_pass.cpp
index a6bdaaf..8b91ad6 100644
--- a/source/opt/inline_pass.cpp
+++ b/source/opt/inline_pass.cpp
@@ -405,8 +405,8 @@
while (callee_inst_itr != callee_first_block->end()) {
// Don't inline function definition links, the calling function is not a
// definition.
- if (callee_inst_itr->GetVulkan100DebugOpcode() ==
- NonSemanticVulkanDebugInfo100DebugFunctionDefinition) {
+ if (callee_inst_itr->GetShader100DebugOpcode() ==
+ NonSemanticShaderDebugInfo100DebugFunctionDefinition) {
++callee_inst_itr;
continue;
}
@@ -441,6 +441,11 @@
auto tail_inst_itr = callee_block_itr->end();
for (auto inst_itr = callee_block_itr->begin(); inst_itr != tail_inst_itr;
++inst_itr) {
+ // Don't inline function definition links, the calling function is not a
+ // definition
+ if (inst_itr->GetShader100DebugOpcode() ==
+ NonSemanticShaderDebugInfo100DebugFunctionDefinition)
+ continue;
if (!InlineSingleInstruction(
callee2caller, new_blk_ptr.get(), &*inst_itr,
context()->get_debug_info_mgr()->BuildDebugInlinedAtChain(