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: 14
; Bound: 13
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -21,6 +21,5 @@
%main = OpFunction %void None %1
%4 = OpLabel
%v = OpVariable %_ptr_Function__arr_int_uint_3 Function %11
%13 = OpLoad %_arr_int_uint_3 %v
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 13
; Bound: 12
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -19,6 +19,5 @@
%main = OpFunction %void None %1
%4 = OpLabel
%v = OpVariable %_ptr_Function_mat2v3float Function %10
%12 = OpLoad %mat2v3float %v
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 11
; Bound: 10
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -17,6 +17,5 @@
%main = OpFunction %void None %1
%4 = OpLabel
%v = OpVariable %_ptr_Function_int Function %8
%10 = OpLoad %int %v
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 13
; Bound: 12
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -24,6 +24,5 @@
%main = OpFunction %void None %1
%4 = OpLabel
%v = OpVariable %_ptr_Function_S Function %10
%12 = OpLoad %S %v
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 12
; Bound: 11
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -18,6 +18,5 @@
%main = OpFunction %void None %1
%4 = OpLabel
%v = OpVariable %_ptr_Function_v3int Function %9
%11 = OpLoad %v3int %v
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 14
; Bound: 13
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -21,6 +21,5 @@
%8 = OpTypeFunction %void
%main = OpFunction %void None %8
%11 = OpLabel
%13 = OpLoad %_arr_int_uint_3 %v
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 13
; Bound: 12
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -19,6 +19,5 @@
%7 = OpTypeFunction %void
%main = OpFunction %void None %7
%10 = OpLabel
%12 = OpLoad %mat2v3float %v
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 11
; Bound: 10
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -17,6 +17,5 @@
%5 = OpTypeFunction %void
%main = OpFunction %void None %5
%8 = OpLabel
%10 = OpLoad %int %v
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 13
; Bound: 12
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -24,6 +24,5 @@
%7 = OpTypeFunction %void
%main = OpFunction %void None %7
%10 = OpLabel
%12 = OpLoad %S %v
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 12
; Bound: 11
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -18,6 +18,5 @@
%6 = OpTypeFunction %void
%main = OpFunction %void None %6
%9 = OpLabel
%11 = OpLoad %v3int %v
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 44
; Bound: 43
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -33,7 +33,7 @@
%uint_1 = OpConstant %uint 1
%uint_2 = OpConstant %uint 2
%uint_264 = OpConstant %uint 264
%39 = OpTypeFunction %void
%38 = OpTypeFunction %void
%main_inner = OpFunction %void None %9
%local_invocation_index = OpFunctionParameter %uint
%13 = OpLabel
@@ -63,12 +63,11 @@
OpBranch %17
%18 = OpLabel
OpControlBarrier %uint_2 %uint_2 %uint_264
%38 = OpLoad %_arr_int_uint_3 %v
OpReturn
OpFunctionEnd
%main = OpFunction %void None %39
%41 = OpLabel
%43 = OpLoad %uint %local_invocation_index_1
%42 = OpFunctionCall %void %main_inner %43
%main = OpFunction %void None %38
%40 = OpLabel
%42 = OpLoad %uint %local_invocation_index_1
%41 = OpFunctionCall %void %main_inner %42
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 25
; Bound: 24
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -26,18 +26,17 @@
%14 = OpConstantNull %mat2v3float
%uint_2 = OpConstant %uint 2
%uint_264 = OpConstant %uint 264
%20 = OpTypeFunction %void
%19 = OpTypeFunction %void
%main_inner = OpFunction %void None %9
%local_invocation_index = OpFunctionParameter %uint
%13 = OpLabel
OpStore %v %14
OpControlBarrier %uint_2 %uint_2 %uint_264
%19 = OpLoad %mat2v3float %v
OpReturn
OpFunctionEnd
%main = OpFunction %void None %20
%22 = OpLabel
%24 = OpLoad %uint %local_invocation_index_1
%23 = OpFunctionCall %void %main_inner %24
%main = OpFunction %void None %19
%21 = OpLabel
%23 = OpLoad %uint %local_invocation_index_1
%22 = OpFunctionCall %void %main_inner %23
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 23
; Bound: 22
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -24,18 +24,17 @@
%12 = OpConstantNull %int
%uint_2 = OpConstant %uint 2
%uint_264 = OpConstant %uint 264
%18 = OpTypeFunction %void
%17 = OpTypeFunction %void
%main_inner = OpFunction %void None %7
%local_invocation_index = OpFunctionParameter %uint
%11 = OpLabel
OpStore %v %12
OpControlBarrier %uint_2 %uint_2 %uint_264
%17 = OpLoad %int %v
OpReturn
OpFunctionEnd
%main = OpFunction %void None %18
%20 = OpLabel
%22 = OpLoad %uint %local_invocation_index_1
%21 = OpFunctionCall %void %main_inner %22
%main = OpFunction %void None %17
%19 = OpLabel
%21 = OpLoad %uint %local_invocation_index_1
%20 = OpFunctionCall %void %main_inner %21
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 25
; Bound: 24
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -31,18 +31,17 @@
%14 = OpConstantNull %S
%uint_2 = OpConstant %uint 2
%uint_264 = OpConstant %uint 264
%20 = OpTypeFunction %void
%19 = OpTypeFunction %void
%main_inner = OpFunction %void None %9
%local_invocation_index = OpFunctionParameter %uint
%13 = OpLabel
OpStore %v %14
OpControlBarrier %uint_2 %uint_2 %uint_264
%19 = OpLoad %S %v
OpReturn
OpFunctionEnd
%main = OpFunction %void None %20
%22 = OpLabel
%24 = OpLoad %uint %local_invocation_index_1
%23 = OpFunctionCall %void %main_inner %24
%main = OpFunction %void None %19
%21 = OpLabel
%23 = OpLoad %uint %local_invocation_index_1
%22 = OpFunctionCall %void %main_inner %23
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 24
; Bound: 23
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -25,18 +25,17 @@
%13 = OpConstantNull %v3int
%uint_2 = OpConstant %uint 2
%uint_264 = OpConstant %uint 264
%19 = OpTypeFunction %void
%18 = OpTypeFunction %void
%main_inner = OpFunction %void None %8
%local_invocation_index = OpFunctionParameter %uint
%12 = OpLabel
OpStore %v %13
OpControlBarrier %uint_2 %uint_2 %uint_264
%18 = OpLoad %v3int %v
OpReturn
OpFunctionEnd
%main = OpFunction %void None %19
%21 = OpLabel
%23 = OpLoad %uint %local_invocation_index_1
%22 = OpFunctionCall %void %main_inner %23
%main = OpFunction %void None %18
%20 = OpLabel
%22 = OpLoad %uint %local_invocation_index_1
%21 = OpFunctionCall %void %main_inner %22
OpReturn
OpFunctionEnd