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: 12
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -23,7 +23,5 @@
%6 = OpTypeFunction %void
%main = OpFunction %void None %6
%9 = OpLabel
%11 = OpLoad %3 %s
%13 = OpLoad %3 %sc
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
@@ -19,6 +19,5 @@
%5 = OpTypeFunction %void
%main = OpFunction %void None %5
%8 = OpLabel
%10 = OpLoad %3 %t_f
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
@@ -19,6 +19,5 @@
%5 = OpTypeFunction %void
%main = OpFunction %void None %5
%8 = OpLabel
%10 = OpLoad %3 %t_f
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
@@ -19,6 +19,5 @@
%5 = OpTypeFunction %void
%main = OpFunction %void None %5
%8 = OpLabel
%10 = OpLoad %3 %t_f
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
OpCapability SampledCubeArray
@@ -20,6 +20,5 @@
%5 = OpTypeFunction %void
%main = OpFunction %void None %5
%8 = OpLabel
%10 = OpLoad %3 %t_f
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 23
; Bound: 20
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -33,8 +33,5 @@
%13 = OpTypeFunction %void
%main = OpFunction %void None %13
%16 = OpLabel
%18 = OpLoad %3 %t_f
%20 = OpLoad %7 %t_i
%22 = OpLoad %11 %t_u
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 23
; Bound: 20
; Schema: 0
OpCapability Shader
OpCapability Sampled1D
@@ -34,8 +34,5 @@
%13 = OpTypeFunction %void
%main = OpFunction %void None %13
%16 = OpLabel
%18 = OpLoad %3 %t_f
%20 = OpLoad %7 %t_i
%22 = OpLoad %11 %t_u
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 23
; Bound: 20
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -33,8 +33,5 @@
%13 = OpTypeFunction %void
%main = OpFunction %void None %13
%16 = OpLabel
%18 = OpLoad %3 %t_f
%20 = OpLoad %7 %t_i
%22 = OpLoad %11 %t_u
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 23
; Bound: 20
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -33,8 +33,5 @@
%13 = OpTypeFunction %void
%main = OpFunction %void None %13
%16 = OpLabel
%18 = OpLoad %3 %t_f
%20 = OpLoad %7 %t_i
%22 = OpLoad %11 %t_u
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 23
; Bound: 20
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -33,8 +33,5 @@
%13 = OpTypeFunction %void
%main = OpFunction %void None %13
%16 = OpLabel
%18 = OpLoad %3 %t_f
%20 = OpLoad %7 %t_i
%22 = OpLoad %11 %t_u
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 23
; Bound: 20
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -33,8 +33,5 @@
%13 = OpTypeFunction %void
%main = OpFunction %void None %13
%16 = OpLabel
%18 = OpLoad %3 %t_f
%20 = OpLoad %7 %t_i
%22 = OpLoad %11 %t_u
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 23
; Bound: 20
; Schema: 0
OpCapability Shader
OpCapability SampledCubeArray
@@ -34,8 +34,5 @@
%13 = OpTypeFunction %void
%main = OpFunction %void None %13
%16 = OpLabel
%18 = OpLoad %3 %t_f
%20 = OpLoad %7 %t_i
%22 = OpLoad %11 %t_u
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 152
; Bound: 120
; Schema: 0
OpCapability Shader
OpCapability Image1D
@@ -225,37 +225,5 @@
%84 = OpTypeFunction %void
%main = OpFunction %void None %84
%87 = OpLabel
%89 = OpLoad %3 %t_rgba8unorm_r
%91 = OpLoad %7 %t_rgba8snorm_r
%93 = OpLoad %10 %t_rgba8uint_r
%95 = OpLoad %14 %t_rgba8sint_r
%97 = OpLoad %18 %t_rgba16uint_r
%99 = OpLoad %21 %t_rgba16sint_r
%101 = OpLoad %24 %t_rgba16float_r
%103 = OpLoad %27 %t_r32uint_r
%105 = OpLoad %30 %t_r32sint_r
%107 = OpLoad %33 %t_r32float_r
%109 = OpLoad %36 %t_rg32uint_r
%111 = OpLoad %39 %t_rg32sint_r
%113 = OpLoad %42 %t_rg32float_r
%115 = OpLoad %45 %t_rgba32uint_r
%117 = OpLoad %48 %t_rgba32sint_r
%119 = OpLoad %51 %t_rgba32float_r
%121 = OpLoad %3 %t_rgba8unorm_w
%123 = OpLoad %7 %t_rgba8snorm_w
%125 = OpLoad %10 %t_rgba8uint_w
%127 = OpLoad %14 %t_rgba8sint_w
%129 = OpLoad %18 %t_rgba16uint_w
%131 = OpLoad %21 %t_rgba16sint_w
%133 = OpLoad %24 %t_rgba16float_w
%135 = OpLoad %27 %t_r32uint_w
%137 = OpLoad %30 %t_r32sint_w
%139 = OpLoad %33 %t_r32float_w
%141 = OpLoad %36 %t_rg32uint_w
%143 = OpLoad %39 %t_rg32sint_w
%145 = OpLoad %42 %t_rg32float_w
%147 = OpLoad %45 %t_rgba32uint_w
%149 = OpLoad %48 %t_rgba32sint_w
%151 = OpLoad %51 %t_rgba32float_w
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 152
; Bound: 120
; Schema: 0
OpCapability Shader
OpCapability StorageImageExtendedFormats
@@ -224,37 +224,5 @@
%84 = OpTypeFunction %void
%main = OpFunction %void None %84
%87 = OpLabel
%89 = OpLoad %3 %t_rgba8unorm_r
%91 = OpLoad %7 %t_rgba8snorm_r
%93 = OpLoad %10 %t_rgba8uint_r
%95 = OpLoad %14 %t_rgba8sint_r
%97 = OpLoad %18 %t_rgba16uint_r
%99 = OpLoad %21 %t_rgba16sint_r
%101 = OpLoad %24 %t_rgba16float_r
%103 = OpLoad %27 %t_r32uint_r
%105 = OpLoad %30 %t_r32sint_r
%107 = OpLoad %33 %t_r32float_r
%109 = OpLoad %36 %t_rg32uint_r
%111 = OpLoad %39 %t_rg32sint_r
%113 = OpLoad %42 %t_rg32float_r
%115 = OpLoad %45 %t_rgba32uint_r
%117 = OpLoad %48 %t_rgba32sint_r
%119 = OpLoad %51 %t_rgba32float_r
%121 = OpLoad %3 %t_rgba8unorm_w
%123 = OpLoad %7 %t_rgba8snorm_w
%125 = OpLoad %10 %t_rgba8uint_w
%127 = OpLoad %14 %t_rgba8sint_w
%129 = OpLoad %18 %t_rgba16uint_w
%131 = OpLoad %21 %t_rgba16sint_w
%133 = OpLoad %24 %t_rgba16float_w
%135 = OpLoad %27 %t_r32uint_w
%137 = OpLoad %30 %t_r32sint_w
%139 = OpLoad %33 %t_r32float_w
%141 = OpLoad %36 %t_rg32uint_w
%143 = OpLoad %39 %t_rg32sint_w
%145 = OpLoad %42 %t_rg32float_w
%147 = OpLoad %45 %t_rgba32uint_w
%149 = OpLoad %48 %t_rgba32sint_w
%151 = OpLoad %51 %t_rgba32float_w
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 152
; Bound: 120
; Schema: 0
OpCapability Shader
OpCapability StorageImageExtendedFormats
@@ -224,37 +224,5 @@
%84 = OpTypeFunction %void
%main = OpFunction %void None %84
%87 = OpLabel
%89 = OpLoad %3 %t_rgba8unorm_r
%91 = OpLoad %7 %t_rgba8snorm_r
%93 = OpLoad %10 %t_rgba8uint_r
%95 = OpLoad %14 %t_rgba8sint_r
%97 = OpLoad %18 %t_rgba16uint_r
%99 = OpLoad %21 %t_rgba16sint_r
%101 = OpLoad %24 %t_rgba16float_r
%103 = OpLoad %27 %t_r32uint_r
%105 = OpLoad %30 %t_r32sint_r
%107 = OpLoad %33 %t_r32float_r
%109 = OpLoad %36 %t_rg32uint_r
%111 = OpLoad %39 %t_rg32sint_r
%113 = OpLoad %42 %t_rg32float_r
%115 = OpLoad %45 %t_rgba32uint_r
%117 = OpLoad %48 %t_rgba32sint_r
%119 = OpLoad %51 %t_rgba32float_r
%121 = OpLoad %3 %t_rgba8unorm_w
%123 = OpLoad %7 %t_rgba8snorm_w
%125 = OpLoad %10 %t_rgba8uint_w
%127 = OpLoad %14 %t_rgba8sint_w
%129 = OpLoad %18 %t_rgba16uint_w
%131 = OpLoad %21 %t_rgba16sint_w
%133 = OpLoad %24 %t_rgba16float_w
%135 = OpLoad %27 %t_r32uint_w
%137 = OpLoad %30 %t_r32sint_w
%139 = OpLoad %33 %t_r32float_w
%141 = OpLoad %36 %t_rg32uint_w
%143 = OpLoad %39 %t_rg32sint_w
%145 = OpLoad %42 %t_rg32float_w
%147 = OpLoad %45 %t_rgba32uint_w
%149 = OpLoad %48 %t_rgba32sint_w
%151 = OpLoad %51 %t_rgba32float_w
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 152
; Bound: 120
; Schema: 0
OpCapability Shader
OpCapability StorageImageExtendedFormats
@@ -224,37 +224,5 @@
%84 = OpTypeFunction %void
%main = OpFunction %void None %84
%87 = OpLabel
%89 = OpLoad %3 %t_rgba8unorm_r
%91 = OpLoad %7 %t_rgba8snorm_r
%93 = OpLoad %10 %t_rgba8uint_r
%95 = OpLoad %14 %t_rgba8sint_r
%97 = OpLoad %18 %t_rgba16uint_r
%99 = OpLoad %21 %t_rgba16sint_r
%101 = OpLoad %24 %t_rgba16float_r
%103 = OpLoad %27 %t_r32uint_r
%105 = OpLoad %30 %t_r32sint_r
%107 = OpLoad %33 %t_r32float_r
%109 = OpLoad %36 %t_rg32uint_r
%111 = OpLoad %39 %t_rg32sint_r
%113 = OpLoad %42 %t_rg32float_r
%115 = OpLoad %45 %t_rgba32uint_r
%117 = OpLoad %48 %t_rgba32sint_r
%119 = OpLoad %51 %t_rgba32float_r
%121 = OpLoad %3 %t_rgba8unorm_w
%123 = OpLoad %7 %t_rgba8snorm_w
%125 = OpLoad %10 %t_rgba8uint_w
%127 = OpLoad %14 %t_rgba8sint_w
%129 = OpLoad %18 %t_rgba16uint_w
%131 = OpLoad %21 %t_rgba16sint_w
%133 = OpLoad %24 %t_rgba16float_w
%135 = OpLoad %27 %t_r32uint_w
%137 = OpLoad %30 %t_r32sint_w
%139 = OpLoad %33 %t_r32float_w
%141 = OpLoad %36 %t_rg32uint_w
%143 = OpLoad %39 %t_rg32sint_w
%145 = OpLoad %42 %t_rg32float_w
%147 = OpLoad %45 %t_rgba32uint_w
%149 = OpLoad %48 %t_rgba32sint_w
%151 = OpLoad %51 %t_rgba32float_w
OpReturn
OpFunctionEnd