spirv backend: do not generate a load for ignored expressions

Fixes spirv-val failing on loads of dynamic arrays.

Bug: chromium:1249602
Change-Id: Ic15af9f9ef2beb45bc732e4e45f023651544a1c7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64400
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Antonio Maiorano
2021-09-16 13:32:57 +00:00
committed by Tint LUCI CQ
parent d1d99bc7de
commit dad26395d8
45 changed files with 177 additions and 411 deletions

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Bound: 31
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -35,32 +35,31 @@
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%void = OpTypeVoid
%12 = OpTypeFunction %void
%18 = OpTypeFunction %v4float
%17 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%ignore_2a6ac2 = OpFunction %void None %12
%15 = OpLabel
%17 = OpLoad %11 %arg_0
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %ignore_2a6ac2
%vertex_main_inner = OpFunction %v4float None %17
%19 = OpLabel
%20 = OpFunctionCall %void %ignore_2a6ac2
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %12
%23 = OpLabel
%24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %24
%22 = OpLabel
%23 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %23
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %12
%27 = OpLabel
%28 = OpFunctionCall %void %ignore_2a6ac2
%26 = OpLabel
%27 = OpFunctionCall %void %ignore_2a6ac2
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %12
%30 = OpLabel
%31 = OpFunctionCall %void %ignore_2a6ac2
%29 = OpLabel
%30 = OpFunctionCall %void %ignore_2a6ac2
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Bound: 31
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -35,32 +35,31 @@
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%void = OpTypeVoid
%12 = OpTypeFunction %void
%18 = OpTypeFunction %v4float
%17 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%ignore_5016e5 = OpFunction %void None %12
%15 = OpLabel
%17 = OpLoad %11 %arg_0
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %ignore_5016e5
%vertex_main_inner = OpFunction %v4float None %17
%19 = OpLabel
%20 = OpFunctionCall %void %ignore_5016e5
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %12
%23 = OpLabel
%24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %24
%22 = OpLabel
%23 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %23
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %12
%27 = OpLabel
%28 = OpFunctionCall %void %ignore_5016e5
%26 = OpLabel
%27 = OpFunctionCall %void %ignore_5016e5
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %12
%30 = OpLabel
%31 = OpFunctionCall %void %ignore_5016e5
%29 = OpLabel
%30 = OpFunctionCall %void %ignore_5016e5
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Bound: 31
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -35,32 +35,31 @@
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%void = OpTypeVoid
%12 = OpTypeFunction %void
%18 = OpTypeFunction %v4float
%17 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%ignore_509355 = OpFunction %void None %12
%15 = OpLabel
%17 = OpLoad %11 %arg_0
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %ignore_509355
%vertex_main_inner = OpFunction %v4float None %17
%19 = OpLabel
%20 = OpFunctionCall %void %ignore_509355
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %12
%23 = OpLabel
%24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %24
%22 = OpLabel
%23 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %23
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %12
%27 = OpLabel
%28 = OpFunctionCall %void %ignore_509355
%26 = OpLabel
%27 = OpFunctionCall %void %ignore_509355
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %12
%30 = OpLabel
%31 = OpFunctionCall %void %ignore_509355
%29 = OpLabel
%30 = OpFunctionCall %void %ignore_509355
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Bound: 31
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -35,32 +35,31 @@
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%void = OpTypeVoid
%12 = OpTypeFunction %void
%18 = OpTypeFunction %v4float
%17 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%ignore_5c9edf = OpFunction %void None %12
%15 = OpLabel
%17 = OpLoad %11 %arg_0
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %ignore_5c9edf
%vertex_main_inner = OpFunction %v4float None %17
%19 = OpLabel
%20 = OpFunctionCall %void %ignore_5c9edf
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %12
%23 = OpLabel
%24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %24
%22 = OpLabel
%23 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %23
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %12
%27 = OpLabel
%28 = OpFunctionCall %void %ignore_5c9edf
%26 = OpLabel
%27 = OpFunctionCall %void %ignore_5c9edf
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %12
%30 = OpLabel
%31 = OpFunctionCall %void %ignore_5c9edf
%29 = OpLabel
%30 = OpFunctionCall %void %ignore_5c9edf
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Bound: 31
; Schema: 0
OpCapability Shader
OpCapability SampledCubeArray
@@ -36,32 +36,31 @@
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%void = OpTypeVoid
%12 = OpTypeFunction %void
%18 = OpTypeFunction %v4float
%17 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%ignore_ad88be = OpFunction %void None %12
%15 = OpLabel
%17 = OpLoad %11 %arg_0
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %ignore_ad88be
%vertex_main_inner = OpFunction %v4float None %17
%19 = OpLabel
%20 = OpFunctionCall %void %ignore_ad88be
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %12
%23 = OpLabel
%24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %24
%22 = OpLabel
%23 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %23
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %12
%27 = OpLabel
%28 = OpFunctionCall %void %ignore_ad88be
%26 = OpLabel
%27 = OpFunctionCall %void %ignore_ad88be
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %12
%30 = OpLabel
%31 = OpFunctionCall %void %ignore_ad88be
%29 = OpLabel
%30 = OpFunctionCall %void %ignore_ad88be
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Bound: 31
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -35,32 +35,31 @@
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%void = OpTypeVoid
%12 = OpTypeFunction %void
%18 = OpTypeFunction %v4float
%17 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%ignore_b469af = OpFunction %void None %12
%15 = OpLabel
%17 = OpLoad %11 %arg_0
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %ignore_b469af
%vertex_main_inner = OpFunction %v4float None %17
%19 = OpLabel
%20 = OpFunctionCall %void %ignore_b469af
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %12
%23 = OpLabel
%24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %24
%22 = OpLabel
%23 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %23
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %12
%27 = OpLabel
%28 = OpFunctionCall %void %ignore_b469af
%26 = OpLabel
%27 = OpFunctionCall %void %ignore_b469af
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %12
%30 = OpLabel
%31 = OpFunctionCall %void %ignore_b469af
%29 = OpLabel
%30 = OpFunctionCall %void %ignore_b469af
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Bound: 31
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -35,32 +35,31 @@
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%void = OpTypeVoid
%12 = OpTypeFunction %void
%18 = OpTypeFunction %v4float
%17 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%ignore_c8a0ee = OpFunction %void None %12
%15 = OpLabel
%17 = OpLoad %11 %arg_0
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %ignore_c8a0ee
%vertex_main_inner = OpFunction %v4float None %17
%19 = OpLabel
%20 = OpFunctionCall %void %ignore_c8a0ee
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %12
%23 = OpLabel
%24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %24
%22 = OpLabel
%23 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %23
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %12
%27 = OpLabel
%28 = OpFunctionCall %void %ignore_c8a0ee
%26 = OpLabel
%27 = OpFunctionCall %void %ignore_c8a0ee
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %12
%30 = OpLabel
%31 = OpFunctionCall %void %ignore_c8a0ee
%29 = OpLabel
%30 = OpFunctionCall %void %ignore_c8a0ee
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Bound: 31
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -35,32 +35,31 @@
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%void = OpTypeVoid
%12 = OpTypeFunction %void
%18 = OpTypeFunction %v4float
%17 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%ignore_e0187b = OpFunction %void None %12
%15 = OpLabel
%17 = OpLoad %11 %arg_0
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %ignore_e0187b
%vertex_main_inner = OpFunction %v4float None %17
%19 = OpLabel
%20 = OpFunctionCall %void %ignore_e0187b
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %12
%23 = OpLabel
%24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %24
%22 = OpLabel
%23 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %23
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %12
%27 = OpLabel
%28 = OpFunctionCall %void %ignore_e0187b
%26 = OpLabel
%27 = OpFunctionCall %void %ignore_e0187b
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %12
%30 = OpLabel
%31 = OpFunctionCall %void %ignore_e0187b
%29 = OpLabel
%30 = OpFunctionCall %void %ignore_e0187b
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 16
; Bound: 15
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -29,6 +29,5 @@
%main = OpFunction %void None %6
%9 = OpLabel
%14 = OpAccessChain %_ptr_StorageBuffer__runtimearr_int %s %uint_0
%15 = OpLoad %_runtimearr_int %14
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 17
; Bound: 15
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -26,8 +26,6 @@
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%main = OpFunction %void None %5
%8 = OpLabel
%10 = OpLoad %S %s
%15 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0
%16 = OpLoad %int %15
%14 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 17
; Bound: 15
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -27,8 +27,6 @@
%_ptr_Uniform_int = OpTypePointer Uniform %int
%main = OpFunction %void None %5
%8 = OpLabel
%10 = OpLoad %S %u
%15 = OpAccessChain %_ptr_Uniform_int %u %uint_0
%16 = OpLoad %int %15
%14 = OpAccessChain %_ptr_Uniform_int %u %uint_0
OpReturn
OpFunctionEnd