-
Notifications
You must be signed in to change notification settings - Fork 624
Closed
Description
When spv input to spirv-opt contains functions without blocks (declarations), some optimization passes crash. It seems that they assume functions will have blocks.
%normalFunc = OpFunction %int None %26
%a = OpFunctionParameter %int
OpFunctionEnd
; SPIR-V
; Version: 1.5
; Generator: Khronos; 40
; Bound: 36
; Schema: 0
OpCapability Linkage
OpCapability RayTracingKHR
OpCapability Shader
OpExtension "SPV_KHR_ray_tracing"
OpMemoryModel Logical GLSL450
OpEntryPoint AnyHitKHR %anyhit "main" %Constants %8
OpSource Slang 1
OpName %Payload "Payload"
OpMemberName %Payload 0 "val"
OpName %SLANG_ParameterGroup_Constants_std140 "SLANG_ParameterGroup_Constants_std140"
OpMemberName %SLANG_ParameterGroup_Constants_std140 0 "x"
OpMemberName %SLANG_ParameterGroup_Constants_std140 1 "y"
OpName %Constants "Constants"
OpName %a "a"
OpName %normalFunc "normalFunc"
OpName %a_0 "a"
OpName %normalFuncUsesGeneric "normalFuncUsesGeneric"
OpName %anyhit "anyhit"
OpMemberDecorate %Payload 0 Offset 0
OpDecorate %SLANG_ParameterGroup_Constants_std140 Block
OpMemberDecorate %SLANG_ParameterGroup_Constants_std140 0 Offset 0
OpMemberDecorate %SLANG_ParameterGroup_Constants_std140 1 Offset 4
OpDecorate %Constants Binding 0
OpDecorate %Constants DescriptorSet 0
OpDecorate %normalFunc LinkageAttributes "_SR29export_2Dxlibrary_2Dxgenerics10normalFuncp1pi_ii" Import
OpDecorate %normalFuncUsesGeneric LinkageAttributes "_SR29export_2Dxlibrary_2Dxgenerics21normalFuncUsesGenericp1pi_ii" Import
%void = OpTypeVoid
%3 = OpTypeFunction %void
%int = OpTypeInt 32 1
%Payload = OpTypeStruct %int
%_ptr_IncomingRayPayloadKHR_Payload = OpTypePointer IncomingRayPayloadKHR %Payload
%int_0 = OpConstant %int 0
%_ptr_IncomingRayPayloadKHR_int = OpTypePointer IncomingRayPayloadKHR %int
%float = OpTypeFloat 32
%SLANG_ParameterGroup_Constants_std140 = OpTypeStruct %float %float
%_ptr_Uniform_SLANG_ParameterGroup_Constants_std140 = OpTypePointer Uniform %SLANG_ParameterGroup_Constants_std140
%_ptr_Uniform_float = OpTypePointer Uniform %float
%int_1 = OpConstant %int 1
%26 = OpTypeFunction %int %int
%8 = OpVariable %_ptr_IncomingRayPayloadKHR_Payload IncomingRayPayloadKHR
%Constants = OpVariable %_ptr_Uniform_SLANG_ParameterGroup_Constants_std140 Uniform
%normalFunc = OpFunction %int None %26
%a = OpFunctionParameter %int
OpFunctionEnd
%normalFuncUsesGeneric = OpFunction %int None %26
%a_0 = OpFunctionParameter %int
OpFunctionEnd
%anyhit = OpFunction %void None %3
%4 = OpLabel
%11 = OpAccessChain %_ptr_IncomingRayPayloadKHR_int %8 %int_0
%17 = OpAccessChain %_ptr_Uniform_float %Constants %int_0
%18 = OpLoad %float %17
%20 = OpAccessChain %_ptr_Uniform_float %Constants %int_1
%21 = OpLoad %float %20
%22 = OpFMul %float %18 %21
%23 = OpConvertFToS %int %22
%24 = OpFunctionCall %int %normalFunc %23
%28 = OpLoad %float %20
%29 = OpConvertFToS %int %28
%30 = OpFunctionCall %int %normalFuncUsesGeneric %29
%33 = OpIAdd %int %24 %30
OpStore %11 %33
OpReturn
OpFunctionEnd
Metadata
Metadata
Assignees
Labels
No labels