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>
diff --git a/src/writer/spirv/builder.cc b/src/writer/spirv/builder.cc
index afe2bbc..33d64bd 100644
--- a/src/writer/spirv/builder.cc
+++ b/src/writer/spirv/builder.cc
@@ -2322,7 +2322,8 @@
 
   // Generates the SPIR-V ID for the expression for the indexed call parameter,
   // and loads it if necessary. Returns 0 on error.
-  auto get_param_as_value_id = [&](size_t i) -> uint32_t {
+  auto get_param_as_value_id = [&](size_t i,
+                                   bool generate_load = true) -> uint32_t {
     auto* arg = call->params()[i];
     auto* param = intrinsic->Parameters()[i];
     auto val_id = GenerateExpression(arg);
@@ -2330,7 +2331,7 @@
       return 0;
     }
 
-    if (!param->Type()->Is<sem::Pointer>()) {
+    if (generate_load && !param->Type()->Is<sem::Pointer>()) {
       val_id = GenerateLoadIfNeeded(TypeOf(arg), val_id);
     }
     return val_id;
@@ -2427,7 +2428,7 @@
       // Evaluate the single argument, return the non-zero result_id which isn't
       // associated with any op (ignore returns void, so this cannot be used in
       // an expression).
-      if (!get_param_as_value_id(0)) {
+      if (!get_param_as_value_id(0, false)) {
         return 0;
       }
       return result_id;
diff --git a/test/bug/tint/1046.wgsl.expected.spvasm b/test/bug/tint/1046.wgsl.expected.spvasm
index 7d91278..be371f0 100644
--- a/test/bug/tint/1046.wgsl.expected.spvasm
+++ b/test/bug/tint/1046.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 114
+; Bound: 110
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -128,7 +128,7 @@
     %float_0 = OpConstant %float 0
          %92 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
        %void = OpTypeVoid
-        %103 = OpTypeFunction %void
+         %99 = OpTypeFunction %void
    %getColor = OpFunction %v4float None %30
    %fragment = OpFunctionParameter %FragmentInput
          %34 = OpLabel
@@ -195,23 +195,19 @@
      %output = OpVariable %_ptr_Function_FragmentOutput Function %89
          %90 = OpAccessChain %_ptr_Function_v4float %output %uint_0
                OpStore %90 %92
-         %95 = OpLoad %Uniforms %uniforms
-         %97 = OpLoad %26 %mySampler
-         %99 = OpLoad %29 %myTexture
-        %101 = OpLoad %PointLights %pointLights
-        %102 = OpLoad %FragmentOutput %output
-               OpReturnValue %102
+         %98 = OpLoad %FragmentOutput %output
+               OpReturnValue %98
                OpFunctionEnd
-       %main = OpFunction %void None %103
-        %105 = OpLabel
-        %107 = OpLoad %v4float %position_1
-        %108 = OpLoad %v4float %view_position_1
-        %109 = OpLoad %v4float %normal_1
-        %110 = OpLoad %v2float %uv_1
-        %111 = OpLoad %v4float %color_1
-        %112 = OpCompositeConstruct %FragmentInput %107 %108 %109 %110 %111
-        %106 = OpFunctionCall %FragmentOutput %main_inner %112
-        %113 = OpCompositeExtract %v4float %106 0
-               OpStore %color_2 %113
+       %main = OpFunction %void None %99
+        %101 = OpLabel
+        %103 = OpLoad %v4float %position_1
+        %104 = OpLoad %v4float %view_position_1
+        %105 = OpLoad %v4float %normal_1
+        %106 = OpLoad %v2float %uv_1
+        %107 = OpLoad %v4float %color_1
+        %108 = OpCompositeConstruct %FragmentInput %103 %104 %105 %106 %107
+        %102 = OpFunctionCall %FragmentOutput %main_inner %108
+        %109 = OpCompositeExtract %v4float %102 0
+               OpStore %color_2 %109
                OpReturn
                OpFunctionEnd
diff --git a/test/bug/tint/959.wgsl.expected.spvasm b/test/bug/tint/959.wgsl.expected.spvasm
index f47b352..de2df14 100644
--- a/test/bug/tint/959.wgsl.expected.spvasm
+++ b/test/bug/tint/959.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 160
+; Bound: 112
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -235,53 +235,5 @@
          %60 = OpTypeFunction %void
        %main = OpFunction %void None %60
          %63 = OpLabel
-         %65 = OpLoad %S %b0
-         %67 = OpLoad %S %b1
-         %69 = OpLoad %S %b2
-         %71 = OpLoad %S %b3
-         %73 = OpLoad %S %b4
-         %75 = OpLoad %S %b5
-         %77 = OpLoad %S %b6
-         %79 = OpLoad %S %b7
-         %81 = OpLoad %S %b8
-         %83 = OpLoad %S %b9
-         %85 = OpLoad %S %b10
-         %87 = OpLoad %S %b11
-         %89 = OpLoad %S %b12
-         %91 = OpLoad %S %b13
-         %93 = OpLoad %S %b14
-         %95 = OpLoad %S %b15
-         %97 = OpLoad %23 %t0
-         %99 = OpLoad %23 %t1
-        %101 = OpLoad %23 %t2
-        %103 = OpLoad %23 %t3
-        %105 = OpLoad %23 %t4
-        %107 = OpLoad %23 %t5
-        %109 = OpLoad %23 %t6
-        %111 = OpLoad %23 %t7
-        %113 = OpLoad %33 %t8
-        %115 = OpLoad %33 %t9
-        %117 = OpLoad %33 %t10
-        %119 = OpLoad %33 %t11
-        %121 = OpLoad %33 %t12
-        %123 = OpLoad %33 %t13
-        %125 = OpLoad %33 %t14
-        %127 = OpLoad %33 %t15
-        %129 = OpLoad %43 %s0
-        %131 = OpLoad %43 %s1
-        %133 = OpLoad %43 %s2
-        %135 = OpLoad %43 %s3
-        %137 = OpLoad %43 %s4
-        %139 = OpLoad %43 %s5
-        %141 = OpLoad %43 %s6
-        %143 = OpLoad %43 %s7
-        %145 = OpLoad %43 %s8
-        %147 = OpLoad %43 %s9
-        %149 = OpLoad %43 %s10
-        %151 = OpLoad %43 %s11
-        %153 = OpLoad %43 %s12
-        %155 = OpLoad %43 %s13
-        %157 = OpLoad %43 %s14
-        %159 = OpLoad %43 %s15
                OpReturn
                OpFunctionEnd
diff --git a/test/intrinsics/gen/ignore/2a6ac2.wgsl.expected.spvasm b/test/intrinsics/gen/ignore/2a6ac2.wgsl.expected.spvasm
index 72ffad9..6a6003d 100644
--- a/test/intrinsics/gen/ignore/2a6ac2.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/ignore/2a6ac2.wgsl.expected.spvasm
@@ -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
diff --git a/test/intrinsics/gen/ignore/5016e5.wgsl.expected.spvasm b/test/intrinsics/gen/ignore/5016e5.wgsl.expected.spvasm
index 2261539..bb23bc6 100644
--- a/test/intrinsics/gen/ignore/5016e5.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/ignore/5016e5.wgsl.expected.spvasm
@@ -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
diff --git a/test/intrinsics/gen/ignore/509355.wgsl.expected.spvasm b/test/intrinsics/gen/ignore/509355.wgsl.expected.spvasm
index 9b62c2f..2a6d176 100644
--- a/test/intrinsics/gen/ignore/509355.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/ignore/509355.wgsl.expected.spvasm
@@ -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
diff --git a/test/intrinsics/gen/ignore/5c9edf.wgsl.expected.spvasm b/test/intrinsics/gen/ignore/5c9edf.wgsl.expected.spvasm
index 5472bfb..fcfbbb3 100644
--- a/test/intrinsics/gen/ignore/5c9edf.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/ignore/5c9edf.wgsl.expected.spvasm
@@ -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
diff --git a/test/intrinsics/gen/ignore/ad88be.wgsl.expected.spvasm b/test/intrinsics/gen/ignore/ad88be.wgsl.expected.spvasm
index 5f0e9b8..a706caa 100644
--- a/test/intrinsics/gen/ignore/ad88be.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/ignore/ad88be.wgsl.expected.spvasm
@@ -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
diff --git a/test/intrinsics/gen/ignore/b469af.wgsl.expected.spvasm b/test/intrinsics/gen/ignore/b469af.wgsl.expected.spvasm
index 6d20fc2..f8886eb 100644
--- a/test/intrinsics/gen/ignore/b469af.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/ignore/b469af.wgsl.expected.spvasm
@@ -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
diff --git a/test/intrinsics/gen/ignore/c8a0ee.wgsl.expected.spvasm b/test/intrinsics/gen/ignore/c8a0ee.wgsl.expected.spvasm
index e864cdb..766ca58 100644
--- a/test/intrinsics/gen/ignore/c8a0ee.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/ignore/c8a0ee.wgsl.expected.spvasm
@@ -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
diff --git a/test/intrinsics/gen/ignore/e0187b.wgsl.expected.spvasm b/test/intrinsics/gen/ignore/e0187b.wgsl.expected.spvasm
index 7d0b8e6..aa19556 100644
--- a/test/intrinsics/gen/ignore/e0187b.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/ignore/e0187b.wgsl.expected.spvasm
@@ -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
diff --git a/test/intrinsics/ignore/runtime_array.wgsl.expected.spvasm b/test/intrinsics/ignore/runtime_array.wgsl.expected.spvasm
index 4539b59..8a33594 100644
--- a/test/intrinsics/ignore/runtime_array.wgsl.expected.spvasm
+++ b/test/intrinsics/ignore/runtime_array.wgsl.expected.spvasm
@@ -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
diff --git a/test/intrinsics/ignore/storage_buffer.wgsl.expected.spvasm b/test/intrinsics/ignore/storage_buffer.wgsl.expected.spvasm
index bd5b51f..18661fe 100644
--- a/test/intrinsics/ignore/storage_buffer.wgsl.expected.spvasm
+++ b/test/intrinsics/ignore/storage_buffer.wgsl.expected.spvasm
@@ -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
diff --git a/test/intrinsics/ignore/uniform_buffer.wgsl.expected.spvasm b/test/intrinsics/ignore/uniform_buffer.wgsl.expected.spvasm
index 3b232a3..e18af14 100644
--- a/test/intrinsics/ignore/uniform_buffer.wgsl.expected.spvasm
+++ b/test/intrinsics/ignore/uniform_buffer.wgsl.expected.spvasm
@@ -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
diff --git a/test/types/sampler.wgsl.expected.spvasm b/test/types/sampler.wgsl.expected.spvasm
index c96735e..01e7133 100644
--- a/test/types/sampler.wgsl.expected.spvasm
+++ b/test/types/sampler.wgsl.expected.spvasm
@@ -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
diff --git a/test/types/texture/depth/2d.wgsl.expected.spvasm b/test/types/texture/depth/2d.wgsl.expected.spvasm
index 20772bc..7465d70 100644
--- a/test/types/texture/depth/2d.wgsl.expected.spvasm
+++ b/test/types/texture/depth/2d.wgsl.expected.spvasm
@@ -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
diff --git a/test/types/texture/depth/2d_array.wgsl.expected.spvasm b/test/types/texture/depth/2d_array.wgsl.expected.spvasm
index ef06878..8e872a5 100644
--- a/test/types/texture/depth/2d_array.wgsl.expected.spvasm
+++ b/test/types/texture/depth/2d_array.wgsl.expected.spvasm
@@ -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
diff --git a/test/types/texture/depth/cube.wgsl.expected.spvasm b/test/types/texture/depth/cube.wgsl.expected.spvasm
index 980a036..8af1613 100644
--- a/test/types/texture/depth/cube.wgsl.expected.spvasm
+++ b/test/types/texture/depth/cube.wgsl.expected.spvasm
@@ -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
diff --git a/test/types/texture/depth/cube_array.wgsl.expected.spvasm b/test/types/texture/depth/cube_array.wgsl.expected.spvasm
index 7e8feb7..fd96dbf 100644
--- a/test/types/texture/depth/cube_array.wgsl.expected.spvasm
+++ b/test/types/texture/depth/cube_array.wgsl.expected.spvasm
@@ -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
diff --git a/test/types/texture/multisampled/2d.wgsl.expected.spvasm b/test/types/texture/multisampled/2d.wgsl.expected.spvasm
index fb8eb65..4dcb22d 100644
--- a/test/types/texture/multisampled/2d.wgsl.expected.spvasm
+++ b/test/types/texture/multisampled/2d.wgsl.expected.spvasm
@@ -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
diff --git a/test/types/texture/sampled/1d.wgsl.expected.spvasm b/test/types/texture/sampled/1d.wgsl.expected.spvasm
index d6de88c..61a74ac 100644
--- a/test/types/texture/sampled/1d.wgsl.expected.spvasm
+++ b/test/types/texture/sampled/1d.wgsl.expected.spvasm
@@ -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
diff --git a/test/types/texture/sampled/2d.wgsl.expected.spvasm b/test/types/texture/sampled/2d.wgsl.expected.spvasm
index 750d32e..c890825 100644
--- a/test/types/texture/sampled/2d.wgsl.expected.spvasm
+++ b/test/types/texture/sampled/2d.wgsl.expected.spvasm
@@ -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
diff --git a/test/types/texture/sampled/2d_array.wgsl.expected.spvasm b/test/types/texture/sampled/2d_array.wgsl.expected.spvasm
index d9e9dd2..fa4f943 100644
--- a/test/types/texture/sampled/2d_array.wgsl.expected.spvasm
+++ b/test/types/texture/sampled/2d_array.wgsl.expected.spvasm
@@ -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
diff --git a/test/types/texture/sampled/3d.wgsl.expected.spvasm b/test/types/texture/sampled/3d.wgsl.expected.spvasm
index 3a2253e..1a4b9a4 100644
--- a/test/types/texture/sampled/3d.wgsl.expected.spvasm
+++ b/test/types/texture/sampled/3d.wgsl.expected.spvasm
@@ -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
diff --git a/test/types/texture/sampled/cube.wgsl.expected.spvasm b/test/types/texture/sampled/cube.wgsl.expected.spvasm
index b260e7d..ab12149 100644
--- a/test/types/texture/sampled/cube.wgsl.expected.spvasm
+++ b/test/types/texture/sampled/cube.wgsl.expected.spvasm
@@ -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
diff --git a/test/types/texture/sampled/cube_array.wgsl.expected.spvasm b/test/types/texture/sampled/cube_array.wgsl.expected.spvasm
index 9df0e15..1c06610 100644
--- a/test/types/texture/sampled/cube_array.wgsl.expected.spvasm
+++ b/test/types/texture/sampled/cube_array.wgsl.expected.spvasm
@@ -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
diff --git a/test/types/texture/storage/1d.wgsl.expected.spvasm b/test/types/texture/storage/1d.wgsl.expected.spvasm
index 5cfe147..8304a15 100644
--- a/test/types/texture/storage/1d.wgsl.expected.spvasm
+++ b/test/types/texture/storage/1d.wgsl.expected.spvasm
@@ -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
diff --git a/test/types/texture/storage/2d.wgsl.expected.spvasm b/test/types/texture/storage/2d.wgsl.expected.spvasm
index c41c90c..0a7060b 100644
--- a/test/types/texture/storage/2d.wgsl.expected.spvasm
+++ b/test/types/texture/storage/2d.wgsl.expected.spvasm
@@ -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
diff --git a/test/types/texture/storage/2d_array.wgsl.expected.spvasm b/test/types/texture/storage/2d_array.wgsl.expected.spvasm
index 998c280..bc8c3fe 100644
--- a/test/types/texture/storage/2d_array.wgsl.expected.spvasm
+++ b/test/types/texture/storage/2d_array.wgsl.expected.spvasm
@@ -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
diff --git a/test/types/texture/storage/3d.wgsl.expected.spvasm b/test/types/texture/storage/3d.wgsl.expected.spvasm
index feeabd0..2d03bbd 100644
--- a/test/types/texture/storage/3d.wgsl.expected.spvasm
+++ b/test/types/texture/storage/3d.wgsl.expected.spvasm
@@ -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
diff --git a/test/var/initialization/function/array.wgsl.expected.spvasm b/test/var/initialization/function/array.wgsl.expected.spvasm
index ced29ed..dcbe83e 100644
--- a/test/var/initialization/function/array.wgsl.expected.spvasm
+++ b/test/var/initialization/function/array.wgsl.expected.spvasm
@@ -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
diff --git a/test/var/initialization/function/matrix.wgsl.expected.spvasm b/test/var/initialization/function/matrix.wgsl.expected.spvasm
index 5b2ef08..0f87cff 100644
--- a/test/var/initialization/function/matrix.wgsl.expected.spvasm
+++ b/test/var/initialization/function/matrix.wgsl.expected.spvasm
@@ -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
diff --git a/test/var/initialization/function/scalar.wgsl.expected.spvasm b/test/var/initialization/function/scalar.wgsl.expected.spvasm
index c67d83d..2c7cf86 100644
--- a/test/var/initialization/function/scalar.wgsl.expected.spvasm
+++ b/test/var/initialization/function/scalar.wgsl.expected.spvasm
@@ -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
diff --git a/test/var/initialization/function/struct.wgsl.expected.spvasm b/test/var/initialization/function/struct.wgsl.expected.spvasm
index 9c865a6..f29f7fc 100644
--- a/test/var/initialization/function/struct.wgsl.expected.spvasm
+++ b/test/var/initialization/function/struct.wgsl.expected.spvasm
@@ -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
diff --git a/test/var/initialization/function/vector.wgsl.expected.spvasm b/test/var/initialization/function/vector.wgsl.expected.spvasm
index aa8b479..ce9e523 100644
--- a/test/var/initialization/function/vector.wgsl.expected.spvasm
+++ b/test/var/initialization/function/vector.wgsl.expected.spvasm
@@ -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
diff --git a/test/var/initialization/private/array.wgsl.expected.spvasm b/test/var/initialization/private/array.wgsl.expected.spvasm
index 1996520..4a35a3a 100644
--- a/test/var/initialization/private/array.wgsl.expected.spvasm
+++ b/test/var/initialization/private/array.wgsl.expected.spvasm
@@ -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
diff --git a/test/var/initialization/private/matrix.wgsl.expected.spvasm b/test/var/initialization/private/matrix.wgsl.expected.spvasm
index 04a8f59..e4c4739 100644
--- a/test/var/initialization/private/matrix.wgsl.expected.spvasm
+++ b/test/var/initialization/private/matrix.wgsl.expected.spvasm
@@ -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
diff --git a/test/var/initialization/private/scalar.wgsl.expected.spvasm b/test/var/initialization/private/scalar.wgsl.expected.spvasm
index 3deea8c..6cdfba2 100644
--- a/test/var/initialization/private/scalar.wgsl.expected.spvasm
+++ b/test/var/initialization/private/scalar.wgsl.expected.spvasm
@@ -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
diff --git a/test/var/initialization/private/struct.wgsl.expected.spvasm b/test/var/initialization/private/struct.wgsl.expected.spvasm
index ff2048a..fcab0f5 100644
--- a/test/var/initialization/private/struct.wgsl.expected.spvasm
+++ b/test/var/initialization/private/struct.wgsl.expected.spvasm
@@ -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
diff --git a/test/var/initialization/private/vector.wgsl.expected.spvasm b/test/var/initialization/private/vector.wgsl.expected.spvasm
index f5086e9..fdb0aa5 100644
--- a/test/var/initialization/private/vector.wgsl.expected.spvasm
+++ b/test/var/initialization/private/vector.wgsl.expected.spvasm
@@ -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
diff --git a/test/var/initialization/workgroup/array.wgsl.expected.spvasm b/test/var/initialization/workgroup/array.wgsl.expected.spvasm
index 287835b..584939e 100644
--- a/test/var/initialization/workgroup/array.wgsl.expected.spvasm
+++ b/test/var/initialization/workgroup/array.wgsl.expected.spvasm
@@ -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
diff --git a/test/var/initialization/workgroup/matrix.wgsl.expected.spvasm b/test/var/initialization/workgroup/matrix.wgsl.expected.spvasm
index f4f4ed4..6d2312d 100644
--- a/test/var/initialization/workgroup/matrix.wgsl.expected.spvasm
+++ b/test/var/initialization/workgroup/matrix.wgsl.expected.spvasm
@@ -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
diff --git a/test/var/initialization/workgroup/scalar.wgsl.expected.spvasm b/test/var/initialization/workgroup/scalar.wgsl.expected.spvasm
index 5d37379..1cbc3ea 100644
--- a/test/var/initialization/workgroup/scalar.wgsl.expected.spvasm
+++ b/test/var/initialization/workgroup/scalar.wgsl.expected.spvasm
@@ -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
diff --git a/test/var/initialization/workgroup/struct.wgsl.expected.spvasm b/test/var/initialization/workgroup/struct.wgsl.expected.spvasm
index 5ff4989..1ef4fc9 100644
--- a/test/var/initialization/workgroup/struct.wgsl.expected.spvasm
+++ b/test/var/initialization/workgroup/struct.wgsl.expected.spvasm
@@ -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
diff --git a/test/var/initialization/workgroup/vector.wgsl.expected.spvasm b/test/var/initialization/workgroup/vector.wgsl.expected.spvasm
index d4c5546..9efd8eb 100644
--- a/test/var/initialization/workgroup/vector.wgsl.expected.spvasm
+++ b/test/var/initialization/workgroup/vector.wgsl.expected.spvasm
@@ -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