-
Notifications
You must be signed in to change notification settings - Fork 664
opt: assertion failure: bool spvtools::opt::IRContext::ReplaceAllUsesWith(uint32_t, uint32_t): Assertion `get_def_use_mgr()->GetDef(after) && "'after' is not a registered def."' failed. #2744
Copy link
Copy link
Closed
Description
Issue found using GraphicsFuzz.
Tool versions:
To reproduce:
glslangValidator -V shader.comp -o shader.comp.spv
spirv-opt shader.comp.spv -o temp.spv --validate-after-all -O
The following shader files are included in the attached archive, some of which are also shown inline below:
- 0_glsl/shader.comp
- 1_spirv/shader.comp.spv
- 1_spirv_asm/shader.comp.asm
0_glsl/shader.comp:
#version 310 es
precision highp float;
layout(std430, binding = 0) buffer doesNotMatter
{
vec4 _compute_data[];
};
layout(local_size_x = 1, local_size_y = 18, local_size_z = 6) in;
mediump vec4 GLF_live2gl_FragCoord;
void main()
{
int GLF_live2_looplimiter1 = 0;
for (
int i = 0;
i < 1;
++i)
{
if (GLF_live2_looplimiter1 >= 3)
{
for (
int j = 0;
j < 1;
++j)
{
if (int(GLF_live2gl_FragCoord.x) < 120)
{
}
else
{
barrier();
}
}
break;
}
}
float GLF_dead3x = 0.0;
for (
int GLF_dead3k = 0;
GLF_dead3k < 2;
++GLF_dead3k)
{
if (GLF_dead3x > 4.0)
{
break;
}
GLF_dead3x = GLF_live2gl_FragCoord.x;
barrier();
}
}
1_spirv_asm/shader.comp.asm:
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 7
; Bound: 86
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %4 "main"
OpExecutionMode %4 LocalSize 1 18 6
OpSource ESSL 310
OpName %4 "main"
OpName %8 "GLF_live2_looplimiter1"
OpName %10 "i"
OpName %25 "j"
OpName %36 "GLF_live2gl_FragCoord"
OpName %56 "GLF_dead3x"
OpName %58 "GLF_dead3k"
OpName %78 "doesNotMatter"
OpMemberName %78 0 "_compute_data"
OpName %80 ""
OpDecorate %36 RelaxedPrecision
OpDecorate %41 RelaxedPrecision
OpDecorate %74 RelaxedPrecision
OpDecorate %77 ArrayStride 16
OpMemberDecorate %78 0 Offset 0
OpDecorate %78 BufferBlock
OpDecorate %80 DescriptorSet 0
OpDecorate %80 Binding 0
OpDecorate %85 BuiltIn WorkgroupSize
%2 = OpTypeVoid
%3 = OpTypeFunction %2
%6 = OpTypeInt 32 1
%7 = OpTypePointer Function %6
%9 = OpConstant %6 0
%17 = OpConstant %6 1
%18 = OpTypeBool
%21 = OpConstant %6 3
%33 = OpTypeFloat 32
%34 = OpTypeVector %33 4
%35 = OpTypePointer Private %34
%36 = OpVariable %35 Private
%37 = OpTypeInt 32 0
%38 = OpConstant %37 0
%39 = OpTypePointer Private %33
%43 = OpConstant %6 120
%48 = OpConstant %37 2
%49 = OpConstant %37 264
%55 = OpTypePointer Function %33
%57 = OpConstant %33 0
%65 = OpConstant %6 2
%68 = OpConstant %33 4
%77 = OpTypeRuntimeArray %34
%78 = OpTypeStruct %77
%79 = OpTypePointer Uniform %78
%80 = OpVariable %79 Uniform
%81 = OpTypeVector %37 3
%82 = OpConstant %37 1
%83 = OpConstant %37 18
%84 = OpConstant %37 6
%85 = OpConstantComposite %81 %82 %83 %84
%4 = OpFunction %2 None %3
%5 = OpLabel
%8 = OpVariable %7 Function
%10 = OpVariable %7 Function
%25 = OpVariable %7 Function
%56 = OpVariable %55 Function
%58 = OpVariable %7 Function
OpStore %8 %9
OpStore %10 %9
OpBranch %11
%11 = OpLabel
OpLoopMerge %13 %14 None
OpBranch %15
%15 = OpLabel
%16 = OpLoad %6 %10
%19 = OpSLessThan %18 %16 %17
OpBranchConditional %19 %12 %13
%12 = OpLabel
%20 = OpLoad %6 %8
%22 = OpSGreaterThanEqual %18 %20 %21
OpSelectionMerge %24 None
OpBranchConditional %22 %23 %24
%23 = OpLabel
OpStore %25 %9
OpBranch %26
%26 = OpLabel
OpLoopMerge %28 %29 None
OpBranch %30
%30 = OpLabel
%31 = OpLoad %6 %25
%32 = OpSLessThan %18 %31 %17
OpBranchConditional %32 %27 %28
%27 = OpLabel
%40 = OpAccessChain %39 %36 %38
%41 = OpLoad %33 %40
%42 = OpConvertFToS %6 %41
%44 = OpSLessThan %18 %42 %43
OpSelectionMerge %46 None
OpBranchConditional %44 %45 %47
%45 = OpLabel
OpBranch %46
%47 = OpLabel
OpControlBarrier %48 %48 %49
OpBranch %46
%46 = OpLabel
OpBranch %29
%29 = OpLabel
%50 = OpLoad %6 %25
%51 = OpIAdd %6 %50 %17
OpStore %25 %51
OpBranch %26
%28 = OpLabel
OpBranch %13
%24 = OpLabel
OpBranch %14
%14 = OpLabel
%53 = OpLoad %6 %10
%54 = OpIAdd %6 %53 %17
OpStore %10 %54
OpBranch %11
%13 = OpLabel
OpStore %56 %57
OpStore %58 %9
OpBranch %59
%59 = OpLabel
OpLoopMerge %61 %62 None
OpBranch %63
%63 = OpLabel
%64 = OpLoad %6 %58
%66 = OpSLessThan %18 %64 %65
OpBranchConditional %66 %60 %61
%60 = OpLabel
%67 = OpLoad %33 %56
%69 = OpFOrdGreaterThan %18 %67 %68
OpSelectionMerge %71 None
OpBranchConditional %69 %70 %71
%70 = OpLabel
OpBranch %61
%71 = OpLabel
%73 = OpAccessChain %39 %36 %38
%74 = OpLoad %33 %73
OpStore %56 %74
OpControlBarrier %48 %48 %49
OpBranch %62
%62 = OpLabel
%75 = OpLoad %6 %58
%76 = OpIAdd %6 %75 %17
OpStore %58 %76
OpBranch %59
%61 = OpLabel
OpReturn
OpFunctionEnd
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels