Skip to content

spirv-opt: MergeReturn pass places DebugFunctionDefinition in non-first block of a function. #5959

@csyonghe

Description

@csyonghe

Given this SPIRV Input:

in.zip

Running

spirv-val in.spv --scalar-block-layout

returns no errors.

However, if we run the merge return pass on this spirv and then validate its output, we will get an error:

spirv-opt in.spv --scalar-block-layout --merge-return -o out.spv
spirv-val out.spv --scalar-block-layout

Produces:

error: line 171: NonSemantic.Shader.DebugInfo.100 DebugFunctionDefinition: must be in the entry basic block of the function
  %38 = OpExtInst %void %2 DebugFunctionDefinition %34 %main

Observed with SPIRV-Tools v2024.4 v2024.4.rc2-0-g4d2f0b40.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions