tint: work around zero-init bug on some GPUs for workgroup size(1)

This was seen specifically on Windows with an AMD GPU, when using DXC to
compile compute shaders with workgroup size of 1. Flaky, but
reproducible when running CTS test:
webgpu:shader,execution,zero_init:compute,zero_init:addressSpace="workgroup";workgroupSize=[1,1,1];*

We are generating valid code in Tint, but this workaround makes it so
that DXC opts to emit the zero-init instructions rather than tagging the
groupshared variable as 'zeroinitializer'. This seems to make the buggy
driver happy.

Also see: https://github.com/microsoft/DirectXShaderCompiler/issues/6352

Bug: tint:2143
Change-Id: If84b992c4961bafeb1a8ff328626d3f6cf1fb98d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/176140
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/tint/lang/msl/writer/ast_printer/ast_printer_test.cc b/src/tint/lang/msl/writer/ast_printer/ast_printer_test.cc
index a78f3ee..5a1e8c0 100644
--- a/src/tint/lang/msl/writer/ast_printer/ast_printer_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/ast_printer_test.cc
@@ -178,7 +178,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float2x2* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = float2x2(float2(0.0f), float2(0.0f));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
@@ -300,7 +300,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup S2* const tint_symbol_1) {
-  {
+  if ((local_idx < 1u)) {
     S2 const tint_symbol = S2{};
     *(tint_symbol_1) = tint_symbol;
   }
@@ -397,7 +397,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float2x2* const tint_symbol, threadgroup float2x3* const tint_symbol_1, threadgroup float2x4* const tint_symbol_2) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = float2x2(float2(0.0f), float2(0.0f));
     *(tint_symbol_1) = float2x3(float3(0.0f), float3(0.0f));
     *(tint_symbol_2) = float2x4(float4(0.0f), float4(0.0f));
@@ -406,7 +406,7 @@
 }
 
 void tint_zero_workgroup_memory_1(uint local_idx_1, threadgroup float3x2* const tint_symbol_3, threadgroup float3x3* const tint_symbol_4, threadgroup float3x4* const tint_symbol_5) {
-  {
+  if ((local_idx_1 < 1u)) {
     *(tint_symbol_3) = float3x2(float2(0.0f), float2(0.0f), float2(0.0f));
     *(tint_symbol_4) = float3x3(float3(0.0f), float3(0.0f), float3(0.0f));
     *(tint_symbol_5) = float3x4(float4(0.0f), float4(0.0f), float4(0.0f));
@@ -415,7 +415,7 @@
 }
 
 void tint_zero_workgroup_memory_2(uint local_idx_2, threadgroup float4x2* const tint_symbol_6, threadgroup float4x3* const tint_symbol_7, threadgroup float4x4* const tint_symbol_8) {
-  {
+  if ((local_idx_2 < 1u)) {
     *(tint_symbol_6) = float4x2(float2(0.0f), float2(0.0f), float2(0.0f), float2(0.0f));
     *(tint_symbol_7) = float4x3(float3(0.0f), float3(0.0f), float3(0.0f), float3(0.0f));
     *(tint_symbol_8) = float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f));
diff --git a/src/tint/lang/wgsl/ast/transform/zero_init_workgroup_memory.cc b/src/tint/lang/wgsl/ast/transform/zero_init_workgroup_memory.cc
index d0e7f74..7745eb3 100644
--- a/src/tint/lang/wgsl/ast/transform/zero_init_workgroup_memory.cc
+++ b/src/tint/lang/wgsl/ast/transform/zero_init_workgroup_memory.cc
@@ -219,6 +219,10 @@
 
             // Determine the block type used to emit these statements.
 
+            // TODO(crbug.com/tint/2143): Always emit an if statement around zero init, even when
+            // workgroup size matches num_iteration, to work around bugs in certain drivers.
+            constexpr bool kWorkaroundUnconditionalZeroInitDriverBug = true;
+
             if (workgroup_size_const == 0 || num_iterations > workgroup_size_const) {
                 // Either the workgroup size is dynamic, or smaller than num_iterations.
                 // In either case, we need to generate a for loop to ensure we
@@ -243,14 +247,14 @@
                 }
                 auto* for_loop = b.For(init, cond, cont, b.Block(block));
                 init_body.Push(for_loop);
-            } else if (num_iterations < workgroup_size_const) {
+            } else if (num_iterations < workgroup_size_const ||
+                       kWorkaroundUnconditionalZeroInitDriverBug) {
                 // Workgroup size is a known constant, but is greater than
                 // num_iterations. Emit an if statement:
                 //
                 //  if (local_index < num_iterations) {
                 //    ...
                 //  }
-
                 auto* cond = b.LessThan(local_idx, u32(num_iterations));
                 auto block = DeclareArrayIndices(num_iterations, array_indices,
                                                  [&] { return b.Expr(local_idx); });
diff --git a/src/tint/lang/wgsl/ast/transform/zero_init_workgroup_memory_test.cc b/src/tint/lang/wgsl/ast/transform/zero_init_workgroup_memory_test.cc
index 440e2a4..c5b8677 100644
--- a/src/tint/lang/wgsl/ast/transform/zero_init_workgroup_memory_test.cc
+++ b/src/tint/lang/wgsl/ast/transform/zero_init_workgroup_memory_test.cc
@@ -139,7 +139,7 @@
 )";
     auto* expect = R"(
 fn tint_zero_workgroup_memory(local_idx_1 : u32) {
-  {
+  if ((local_idx_1 < 1u)) {
     v = i32();
   }
   workgroupBarrier();
@@ -170,7 +170,7 @@
 )";
     auto* expect = R"(
 fn tint_zero_workgroup_memory(local_idx_1 : u32) {
-  {
+  if ((local_idx_1 < 1u)) {
     v = i32();
   }
   workgroupBarrier();
@@ -205,7 +205,7 @@
 )";
     auto* expect = R"(
 fn tint_zero_workgroup_memory(local_idx_1 : u32) {
-  {
+  if ((local_idx_1 < 1u)) {
     v = i32();
   }
   workgroupBarrier();
@@ -245,7 +245,7 @@
 )";
     auto* expect = R"(
 fn tint_zero_workgroup_memory(local_idx_1 : u32) {
-  {
+  if ((local_idx_1 < 1u)) {
     v = i32();
   }
   workgroupBarrier();
@@ -281,7 +281,7 @@
 )";
     auto* expect = R"(
 fn tint_zero_workgroup_memory(local_idx : u32) {
-  {
+  if ((local_idx < 1u)) {
     v = i32();
   }
   workgroupBarrier();
@@ -312,7 +312,7 @@
 )";
     auto* expect = R"(
 fn tint_zero_workgroup_memory(local_idx : u32) {
-  {
+  if ((local_idx < 1u)) {
     v = i32();
   }
   workgroupBarrier();
@@ -354,7 +354,7 @@
 )";
     auto* expect = R"(
 fn tint_zero_workgroup_memory(local_idx_1 : u32) {
-  {
+  if ((local_idx_1 < 1u)) {
     a = i32();
     b.x = i32();
   }
@@ -421,7 +421,7 @@
 )";
     auto* expect = R"(
 fn tint_zero_workgroup_memory(local_idx_1 : u32) {
-  {
+  if ((local_idx_1 < 1u)) {
     a = i32();
     b.x = i32();
   }
@@ -720,7 +720,7 @@
 )";
     auto* expect = R"(
 fn tint_zero_workgroup_memory(local_idx : u32) {
-  {
+  if ((local_idx < 1u)) {
     a = i32();
     b.x = i32();
   }
@@ -787,7 +787,7 @@
 )";
     auto* expect = R"(
 fn tint_zero_workgroup_memory(local_idx : u32) {
-  {
+  if ((local_idx < 1u)) {
     a = i32();
     b.x = i32();
   }
@@ -864,7 +864,7 @@
 )";
     auto* expect = R"(
 fn tint_zero_workgroup_memory(local_idx : u32) {
-  {
+  if ((local_idx < 1u)) {
     a = i32();
   }
   for(var idx : u32 = local_idx; (idx < 32u); idx = (idx + 1u)) {
@@ -975,7 +975,7 @@
 )";
     auto* expect = R"(
 fn tint_zero_workgroup_memory(local_idx : u32) {
-  {
+  if ((local_idx < 1u)) {
     a = i32();
   }
   for(var idx : u32 = local_idx; (idx < 32u); idx = (idx + 1u)) {
@@ -1073,7 +1073,7 @@
 )";
     auto* expect = R"(
 fn tint_zero_workgroup_memory(local_idx_1 : u32) {
-  {
+  if ((local_idx_1 < 1u)) {
     v = i32();
   }
   workgroupBarrier();
@@ -1120,7 +1120,7 @@
 )";
     auto* expect = R"(
 fn tint_zero_workgroup_memory(local_idx_1 : u32) {
-  {
+  if ((local_idx_1 < 1u)) {
     v = i32();
   }
   workgroupBarrier();
@@ -1161,7 +1161,7 @@
 )";
     auto* expect = R"(
 fn tint_zero_workgroup_memory(local_idx : u32) {
-  {
+  if ((local_idx < 1u)) {
     atomicStore(&(i), i32());
     atomicStore(&(u), u32());
   }
@@ -1198,7 +1198,7 @@
 )";
     auto* expect = R"(
 fn tint_zero_workgroup_memory(local_idx : u32) {
-  {
+  if ((local_idx < 1u)) {
     atomicStore(&(i), i32());
     atomicStore(&(u), u32());
   }
@@ -1241,7 +1241,7 @@
 )";
     auto* expect = R"(
 fn tint_zero_workgroup_memory(local_idx : u32) {
-  {
+  if ((local_idx < 1u)) {
     w.a = i32();
     atomicStore(&(w.i), i32());
     w.b = f32();
@@ -1292,7 +1292,7 @@
 )";
     auto* expect = R"(
 fn tint_zero_workgroup_memory(local_idx : u32) {
-  {
+  if ((local_idx < 1u)) {
     w.a = i32();
     atomicStore(&(w.i), i32());
     w.b = f32();
@@ -1528,7 +1528,7 @@
     auto* expect =
         R"(
 fn tint_zero_workgroup_memory(local_idx : u32) {
-  {
+  if ((local_idx < 1u)) {
     W = mat2x2<f32>();
   }
   workgroupBarrier();
diff --git a/test/tint/access/ptr.wgsl.expected.dxc.hlsl b/test/tint/access/ptr.wgsl.expected.dxc.hlsl
index 8216a0a..9adff6f 100644
--- a/test/tint/access/ptr.wgsl.expected.dxc.hlsl
+++ b/test/tint/access/ptr.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int g1;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(g1, 0, atomic_result);
   }
diff --git a/test/tint/access/ptr.wgsl.expected.fxc.hlsl b/test/tint/access/ptr.wgsl.expected.fxc.hlsl
index 8216a0a..9adff6f 100644
--- a/test/tint/access/ptr.wgsl.expected.fxc.hlsl
+++ b/test/tint/access/ptr.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int g1;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(g1, 0, atomic_result);
   }
diff --git a/test/tint/access/ptr.wgsl.expected.glsl b/test/tint/access/ptr.wgsl.expected.glsl
index a627565..bca62b8 100644
--- a/test/tint/access/ptr.wgsl.expected.glsl
+++ b/test/tint/access/ptr.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int g1;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(g1, 0);
   }
   barrier();
diff --git a/test/tint/access/ptr.wgsl.expected.msl b/test/tint/access/ptr.wgsl.expected.msl
index 2daeefb..0e29de7 100644
--- a/test/tint/access/ptr.wgsl.expected.msl
+++ b/test/tint/access/ptr.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol_11) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol_11, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/access/ptr.wgsl.expected.spvasm b/test/tint/access/ptr.wgsl.expected.spvasm
index fcb4435..c38b930 100644
--- a/test/tint/access/ptr.wgsl.expected.spvasm
+++ b/test/tint/access/ptr.wgsl.expected.spvasm
@@ -1,10 +1,10 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 142
+; Bound: 145
 ; Schema: 0
                OpCapability Shader
-         %92 = OpExtInstImport "GLSL.std.450"
+         %95 = OpExtInstImport "GLSL.std.450"
                OpMemoryModel Logical GLSL450
                OpEntryPoint GLCompute %main "main" %local_invocation_index_1
                OpExecutionMode %main LocalSize 1 1 1
@@ -57,141 +57,147 @@
          %g1 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
       %float = OpTypeFloat 32
-         %22 = OpTypeFunction %int %float
+         %27 = OpTypeFunction %int %float
 %float_2_14748352e_09 = OpConstant %float 2.14748352e+09
-       %bool = OpTypeBool
 %float_n2_14748365e_09 = OpConstant %float -2.14748365e+09
 %int_n2147483648 = OpConstant %int -2147483648
 %int_2147483647 = OpConstant %int 2147483647
-         %37 = OpTypeFunction %int %int
+         %41 = OpTypeFunction %int %int
 %_ptr_Function_int = OpTypePointer Function %int
-         %41 = OpTypeFunction %int %_ptr_Function_int
+         %45 = OpTypeFunction %int %_ptr_Function_int
           %S = OpTypeStruct %int %int
 %_ptr_Function_S = OpTypePointer Function %S
-         %59 = OpTypeFunction %int %_ptr_Function_S
-     %uint_1 = OpConstant %uint 1
+         %63 = OpTypeFunction %int %_ptr_Function_S
       %int_2 = OpConstant %int 2
     %v3float = OpTypeVector %float 3
 %_ptr_Function_v3float = OpTypePointer Function %v3float
-         %82 = OpTypeFunction %int %_ptr_Function_v3float
+         %85 = OpTypeFunction %int %_ptr_Function_v3float
 %_ptr_Function_float = OpTypePointer Function %float
-        %102 = OpTypeFunction %int
-        %112 = OpConstantNull %S
-        %114 = OpConstantNull %v3float
+        %105 = OpTypeFunction %int
+        %115 = OpConstantNull %S
+        %117 = OpConstantNull %v3float
 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
-        %137 = OpTypeFunction %void
+        %140 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %g1 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %g1 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-  %tint_ftoi = OpFunction %int None %22
+  %tint_ftoi = OpFunction %int None %27
           %v = OpFunctionParameter %float
-         %26 = OpLabel
-         %29 = OpFOrdLessThan %bool %v %float_2_14748352e_09
-         %33 = OpFOrdLessThan %bool %v %float_n2_14748365e_09
-         %35 = OpConvertFToS %int %v
-         %31 = OpSelect %int %33 %int_n2147483648 %35
-         %27 = OpSelect %int %29 %31 %int_2147483647
-               OpReturnValue %27
+         %31 = OpLabel
+         %34 = OpFOrdLessThan %bool %v %float_2_14748352e_09
+         %37 = OpFOrdLessThan %bool %v %float_n2_14748365e_09
+         %39 = OpConvertFToS %int %v
+         %35 = OpSelect %int %37 %int_n2147483648 %39
+         %32 = OpSelect %int %34 %35 %int_2147483647
+               OpReturnValue %32
                OpFunctionEnd
-%accept_value = OpFunction %int None %37
+%accept_value = OpFunction %int None %41
         %val = OpFunctionParameter %int
-         %40 = OpLabel
+         %44 = OpLabel
                OpReturnValue %val
                OpFunctionEnd
-%accept_ptr_deref_call_func_F = OpFunction %int None %41
+%accept_ptr_deref_call_func_F = OpFunction %int None %45
       %val_0 = OpFunctionParameter %_ptr_Function_int
-         %45 = OpLabel
-         %47 = OpLoad %int %val_0
-         %50 = OpLoad %int %val_0
-         %48 = OpFunctionCall %int %accept_value %50
-         %51 = OpIAdd %int %47 %48
-               OpReturnValue %51
+         %49 = OpLabel
+         %51 = OpLoad %int %val_0
+         %54 = OpLoad %int %val_0
+         %52 = OpFunctionCall %int %accept_value %54
+         %55 = OpIAdd %int %51 %52
+               OpReturnValue %55
                OpFunctionEnd
-%accept_ptr_deref_pass_through_F = OpFunction %int None %41
+%accept_ptr_deref_pass_through_F = OpFunction %int None %45
       %val_1 = OpFunctionParameter %_ptr_Function_int
-         %54 = OpLabel
-         %56 = OpLoad %int %val_1
-         %57 = OpFunctionCall %int %accept_ptr_deref_call_func_F %val_1
-         %58 = OpIAdd %int %56 %57
-               OpReturnValue %58
+         %58 = OpLabel
+         %60 = OpLoad %int %val_1
+         %61 = OpFunctionCall %int %accept_ptr_deref_call_func_F %val_1
+         %62 = OpIAdd %int %60 %61
+               OpReturnValue %62
                OpFunctionEnd
-%accept_ptr_to_struct_and_access_F = OpFunction %int None %59
+%accept_ptr_to_struct_and_access_F = OpFunction %int None %63
       %val_2 = OpFunctionParameter %_ptr_Function_S
-         %64 = OpLabel
-         %66 = OpAccessChain %_ptr_Function_int %val_2 %uint_0
-         %67 = OpLoad %int %66
-         %70 = OpAccessChain %_ptr_Function_int %val_2 %uint_1
+         %68 = OpLabel
+         %70 = OpAccessChain %_ptr_Function_int %val_2 %uint_0
          %71 = OpLoad %int %70
-         %72 = OpIAdd %int %67 %71
-               OpReturnValue %72
+         %73 = OpAccessChain %_ptr_Function_int %val_2 %uint_1
+         %74 = OpLoad %int %73
+         %75 = OpIAdd %int %71 %74
+               OpReturnValue %75
                OpFunctionEnd
-%accept_ptr_to_struct_access_pass_ptr_F = OpFunction %int None %59
+%accept_ptr_to_struct_access_pass_ptr_F = OpFunction %int None %63
       %val_3 = OpFunctionParameter %_ptr_Function_S
-         %75 = OpLabel
-         %77 = OpAccessChain %_ptr_Function_int %val_3 %uint_0
-               OpStore %77 %int_2
+         %78 = OpLabel
          %80 = OpAccessChain %_ptr_Function_int %val_3 %uint_0
-         %81 = OpLoad %int %80
-               OpReturnValue %81
+               OpStore %80 %int_2
+         %83 = OpAccessChain %_ptr_Function_int %val_3 %uint_0
+         %84 = OpLoad %int %83
+               OpReturnValue %84
                OpFunctionEnd
-%accept_ptr_vec_access_elements_F = OpFunction %int None %82
+%accept_ptr_vec_access_elements_F = OpFunction %int None %85
          %v1 = OpFunctionParameter %_ptr_Function_v3float
-         %87 = OpLabel
-         %90 = OpAccessChain %_ptr_Function_float %v1 %uint_0
-         %94 = OpLoad %v3float %v1
-         %96 = OpLoad %v3float %v1
-         %91 = OpExtInst %v3float %92 Cross %94 %96
-         %97 = OpCompositeExtract %float %91 0
-               OpStore %90 %97
-        %100 = OpAccessChain %_ptr_Function_float %v1 %uint_0
-        %101 = OpLoad %float %100
-         %98 = OpFunctionCall %int %tint_ftoi %101
-               OpReturnValue %98
+         %90 = OpLabel
+         %93 = OpAccessChain %_ptr_Function_float %v1 %uint_0
+         %97 = OpLoad %v3float %v1
+         %99 = OpLoad %v3float %v1
+         %94 = OpExtInst %v3float %95 Cross %97 %99
+        %100 = OpCompositeExtract %float %94 0
+               OpStore %93 %100
+        %103 = OpAccessChain %_ptr_Function_float %v1 %uint_0
+        %104 = OpLoad %float %103
+        %101 = OpFunctionCall %int %tint_ftoi %104
+               OpReturnValue %101
                OpFunctionEnd
-%call_builtin_with_mod_scope_ptr = OpFunction %int None %102
-        %104 = OpLabel
-        %105 = OpAtomicLoad %int %g1 %uint_2 %uint_0
-               OpReturnValue %105
+%call_builtin_with_mod_scope_ptr = OpFunction %int None %105
+        %107 = OpLabel
+        %108 = OpAtomicLoad %int %g1 %uint_2 %uint_0
+               OpReturnValue %108
                OpFunctionEnd
  %main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-        %109 = OpLabel
-       %v1_0 = OpVariable %_ptr_Function_int Function %19
-         %v2 = OpVariable %_ptr_Function_S Function %112
-         %v4 = OpVariable %_ptr_Function_v3float Function %114
-        %110 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-               OpStore %v1_0 %19
-               OpStore %v2 %112
-               OpStore %v4 %114
-        %116 = OpAtomicLoad %int %g1 %uint_2 %uint_0
-        %118 = OpFunctionCall %int %accept_ptr_deref_pass_through_F %v1_0
-        %120 = OpFunctionCall %int %accept_ptr_to_struct_and_access_F %v2
-        %122 = OpFunctionCall %int %accept_ptr_to_struct_and_access_F %v2
-        %124 = OpFunctionCall %int %accept_ptr_vec_access_elements_F %v4
-        %126 = OpFunctionCall %int %accept_ptr_to_struct_access_pass_ptr_F %v2
-        %128 = OpFunctionCall %int %call_builtin_with_mod_scope_ptr
-        %130 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0
-        %131 = OpIAdd %int %118 %120
-        %132 = OpIAdd %int %131 %122
-        %133 = OpIAdd %int %132 %124
-        %134 = OpIAdd %int %133 %126
-        %135 = OpIAdd %int %134 %128
-        %136 = OpIAdd %int %135 %116
-               OpStore %130 %136
+        %112 = OpLabel
+       %v1_0 = OpVariable %_ptr_Function_int Function %24
+         %v2 = OpVariable %_ptr_Function_S Function %115
+         %v4 = OpVariable %_ptr_Function_v3float Function %117
+        %113 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+               OpStore %v1_0 %24
+               OpStore %v2 %115
+               OpStore %v4 %117
+        %119 = OpAtomicLoad %int %g1 %uint_2 %uint_0
+        %121 = OpFunctionCall %int %accept_ptr_deref_pass_through_F %v1_0
+        %123 = OpFunctionCall %int %accept_ptr_to_struct_and_access_F %v2
+        %125 = OpFunctionCall %int %accept_ptr_to_struct_and_access_F %v2
+        %127 = OpFunctionCall %int %accept_ptr_vec_access_elements_F %v4
+        %129 = OpFunctionCall %int %accept_ptr_to_struct_access_pass_ptr_F %v2
+        %131 = OpFunctionCall %int %call_builtin_with_mod_scope_ptr
+        %133 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0
+        %134 = OpIAdd %int %121 %123
+        %135 = OpIAdd %int %134 %125
+        %136 = OpIAdd %int %135 %127
+        %137 = OpIAdd %int %136 %129
+        %138 = OpIAdd %int %137 %131
+        %139 = OpIAdd %int %138 %119
+               OpStore %133 %139
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %137
-        %139 = OpLabel
-        %141 = OpLoad %uint %local_invocation_index_1
-        %140 = OpFunctionCall %void %main_inner %141
+       %main = OpFunction %void None %140
+        %142 = OpLabel
+        %144 = OpLoad %uint %local_invocation_index_1
+        %143 = OpFunctionCall %void %main_inner %144
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x2_f16/to_workgroup.wgsl.expected.dxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat2x2_f16/to_workgroup.wgsl.expected.dxc.hlsl
index 2f27a68..b1ae35f 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x2_f16/to_workgroup.wgsl.expected.dxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x2_f16/to_workgroup.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared matrix<float16_t, 2, 2> w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = matrix<float16_t, 2, 2>((float16_t(0.0h)).xx, (float16_t(0.0h)).xx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x2_f16/to_workgroup.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/unnested/mat2x2_f16/to_workgroup.wgsl.expected.glsl
index 568a800..125cd21 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x2_f16/to_workgroup.wgsl.expected.glsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x2_f16/to_workgroup.wgsl.expected.glsl
@@ -3,7 +3,7 @@
 
 shared f16mat2 w;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = f16mat2(f16vec2(0.0hf), f16vec2(0.0hf));
   }
   barrier();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x2_f16/to_workgroup.wgsl.expected.msl b/test/tint/buffer/uniform/std140/unnested/mat2x2_f16/to_workgroup.wgsl.expected.msl
index 0753302..168a4a7 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x2_f16/to_workgroup.wgsl.expected.msl
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x2_f16/to_workgroup.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup half2x2* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = half2x2(half2(0.0h), half2(0.0h));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x2_f16/to_workgroup.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/unnested/mat2x2_f16/to_workgroup.wgsl.expected.spvasm
index 7062020..7ef9d57 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x2_f16/to_workgroup.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x2_f16/to_workgroup.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 62
+; Bound: 66
 ; Schema: 0
                OpCapability Shader
                OpCapability Float16
@@ -42,61 +42,68 @@
           %w = OpVariable %_ptr_Workgroup_mat2v2half Workgroup
        %void = OpTypeVoid
          %12 = OpTypeFunction %void %uint
-         %17 = OpConstantNull %mat2v2half
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %22 = OpConstantNull %mat2v2half
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %mat2v2half
+         %26 = OpTypeFunction %mat2v2half
      %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_v2half = OpTypePointer Uniform %v2half
-     %uint_1 = OpConstant %uint 1
         %int = OpTypeInt 32 1
       %int_1 = OpConstant %int 1
 %_ptr_Workgroup_v2half = OpTypePointer Workgroup %v2half
-         %50 = OpConstantNull %int
+         %54 = OpConstantNull %int
 %_ptr_Workgroup_half = OpTypePointer Workgroup %half
-         %53 = OpConstantNull %uint
+         %57 = OpConstantNull %uint
 %_ptr_Uniform_half = OpTypePointer Uniform %half
-         %57 = OpTypeFunction %void
+         %61 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %12
   %local_idx = OpFunctionParameter %uint
          %16 = OpLabel
-               OpStore %w %17
+         %18 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %20 None
+               OpBranchConditional %18 %21 %20
+         %21 = OpLabel
+               OpStore %w %22
+               OpBranch %20
+         %20 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%load_u_inner = OpFunction %mat2v2half None %21
-         %23 = OpLabel
-         %28 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0
-         %29 = OpLoad %v2half %28
-         %32 = OpAccessChain %_ptr_Uniform_v2half %u %uint_1
-         %33 = OpLoad %v2half %32
-         %34 = OpCompositeConstruct %mat2v2half %29 %33
-               OpReturnValue %34
+%load_u_inner = OpFunction %mat2v2half None %26
+         %28 = OpLabel
+         %33 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0
+         %34 = OpLoad %v2half %33
+         %36 = OpAccessChain %_ptr_Uniform_v2half %u %uint_1
+         %37 = OpLoad %v2half %36
+         %38 = OpCompositeConstruct %mat2v2half %34 %37
+               OpReturnValue %38
                OpFunctionEnd
     %f_inner = OpFunction %void None %12
 %local_invocation_index = OpFunctionParameter %uint
-         %37 = OpLabel
-         %38 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %39 = OpFunctionCall %mat2v2half %load_u_inner
-               OpStore %w %39
-         %43 = OpAccessChain %_ptr_Workgroup_v2half %w %int_1
-         %44 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0
-         %45 = OpLoad %v2half %44
-               OpStore %43 %45
-         %46 = OpAccessChain %_ptr_Workgroup_v2half %w %int_1
-         %47 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0
-         %48 = OpLoad %v2half %47
-         %49 = OpVectorShuffle %v2half %48 %48 1 0
-               OpStore %46 %49
-         %52 = OpAccessChain %_ptr_Workgroup_half %w %50 %int_1
-         %55 = OpAccessChain %_ptr_Uniform_half %u %uint_1 %53
-         %56 = OpLoad %half %55
-               OpStore %52 %56
+         %41 = OpLabel
+         %42 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %43 = OpFunctionCall %mat2v2half %load_u_inner
+               OpStore %w %43
+         %47 = OpAccessChain %_ptr_Workgroup_v2half %w %int_1
+         %48 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0
+         %49 = OpLoad %v2half %48
+               OpStore %47 %49
+         %50 = OpAccessChain %_ptr_Workgroup_v2half %w %int_1
+         %51 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0
+         %52 = OpLoad %v2half %51
+         %53 = OpVectorShuffle %v2half %52 %52 1 0
+               OpStore %50 %53
+         %56 = OpAccessChain %_ptr_Workgroup_half %w %54 %int_1
+         %59 = OpAccessChain %_ptr_Uniform_half %u %uint_1 %57
+         %60 = OpLoad %half %59
+               OpStore %56 %60
                OpReturn
                OpFunctionEnd
-          %f = OpFunction %void None %57
-         %59 = OpLabel
-         %61 = OpLoad %uint %local_invocation_index_1
-         %60 = OpFunctionCall %void %f_inner %61
+          %f = OpFunction %void None %61
+         %63 = OpLabel
+         %65 = OpLoad %uint %local_invocation_index_1
+         %64 = OpFunctionCall %void %f_inner %65
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x2_f32/to_workgroup.wgsl.expected.dxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat2x2_f32/to_workgroup.wgsl.expected.dxc.hlsl
index e99ebcc..8101b07 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x2_f32/to_workgroup.wgsl.expected.dxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x2_f32/to_workgroup.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float2x2 w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = float2x2((0.0f).xx, (0.0f).xx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x2_f32/to_workgroup.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat2x2_f32/to_workgroup.wgsl.expected.fxc.hlsl
index e99ebcc..8101b07 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x2_f32/to_workgroup.wgsl.expected.fxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x2_f32/to_workgroup.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float2x2 w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = float2x2((0.0f).xx, (0.0f).xx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x2_f32/to_workgroup.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/unnested/mat2x2_f32/to_workgroup.wgsl.expected.glsl
index 7686ee8..f3984c1 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x2_f32/to_workgroup.wgsl.expected.glsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x2_f32/to_workgroup.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared mat2 w;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = mat2(vec2(0.0f), vec2(0.0f));
   }
   barrier();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x2_f32/to_workgroup.wgsl.expected.msl b/test/tint/buffer/uniform/std140/unnested/mat2x2_f32/to_workgroup.wgsl.expected.msl
index be1dad0..a26be0a 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x2_f32/to_workgroup.wgsl.expected.msl
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x2_f32/to_workgroup.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float2x2* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = float2x2(float2(0.0f), float2(0.0f));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x2_f32/to_workgroup.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/unnested/mat2x2_f32/to_workgroup.wgsl.expected.spvasm
index 0f9cb43..7a3251b 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x2_f32/to_workgroup.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x2_f32/to_workgroup.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 62
+; Bound: 66
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -39,61 +39,68 @@
           %w = OpVariable %_ptr_Workgroup_mat2v2float Workgroup
        %void = OpTypeVoid
          %12 = OpTypeFunction %void %uint
-         %17 = OpConstantNull %mat2v2float
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %22 = OpConstantNull %mat2v2float
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %mat2v2float
+         %26 = OpTypeFunction %mat2v2float
      %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
-     %uint_1 = OpConstant %uint 1
         %int = OpTypeInt 32 1
       %int_1 = OpConstant %int 1
 %_ptr_Workgroup_v2float = OpTypePointer Workgroup %v2float
-         %50 = OpConstantNull %int
+         %54 = OpConstantNull %int
 %_ptr_Workgroup_float = OpTypePointer Workgroup %float
-         %53 = OpConstantNull %uint
+         %57 = OpConstantNull %uint
 %_ptr_Uniform_float = OpTypePointer Uniform %float
-         %57 = OpTypeFunction %void
+         %61 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %12
   %local_idx = OpFunctionParameter %uint
          %16 = OpLabel
-               OpStore %w %17
+         %18 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %20 None
+               OpBranchConditional %18 %21 %20
+         %21 = OpLabel
+               OpStore %w %22
+               OpBranch %20
+         %20 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%load_u_inner = OpFunction %mat2v2float None %21
-         %23 = OpLabel
-         %28 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0
-         %29 = OpLoad %v2float %28
-         %32 = OpAccessChain %_ptr_Uniform_v2float %u %uint_1
-         %33 = OpLoad %v2float %32
-         %34 = OpCompositeConstruct %mat2v2float %29 %33
-               OpReturnValue %34
+%load_u_inner = OpFunction %mat2v2float None %26
+         %28 = OpLabel
+         %33 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0
+         %34 = OpLoad %v2float %33
+         %36 = OpAccessChain %_ptr_Uniform_v2float %u %uint_1
+         %37 = OpLoad %v2float %36
+         %38 = OpCompositeConstruct %mat2v2float %34 %37
+               OpReturnValue %38
                OpFunctionEnd
     %f_inner = OpFunction %void None %12
 %local_invocation_index = OpFunctionParameter %uint
-         %37 = OpLabel
-         %38 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %39 = OpFunctionCall %mat2v2float %load_u_inner
-               OpStore %w %39
-         %43 = OpAccessChain %_ptr_Workgroup_v2float %w %int_1
-         %44 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0
-         %45 = OpLoad %v2float %44
-               OpStore %43 %45
-         %46 = OpAccessChain %_ptr_Workgroup_v2float %w %int_1
-         %47 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0
-         %48 = OpLoad %v2float %47
-         %49 = OpVectorShuffle %v2float %48 %48 1 0
-               OpStore %46 %49
-         %52 = OpAccessChain %_ptr_Workgroup_float %w %50 %int_1
-         %55 = OpAccessChain %_ptr_Uniform_float %u %uint_1 %53
-         %56 = OpLoad %float %55
-               OpStore %52 %56
+         %41 = OpLabel
+         %42 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %43 = OpFunctionCall %mat2v2float %load_u_inner
+               OpStore %w %43
+         %47 = OpAccessChain %_ptr_Workgroup_v2float %w %int_1
+         %48 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0
+         %49 = OpLoad %v2float %48
+               OpStore %47 %49
+         %50 = OpAccessChain %_ptr_Workgroup_v2float %w %int_1
+         %51 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0
+         %52 = OpLoad %v2float %51
+         %53 = OpVectorShuffle %v2float %52 %52 1 0
+               OpStore %50 %53
+         %56 = OpAccessChain %_ptr_Workgroup_float %w %54 %int_1
+         %59 = OpAccessChain %_ptr_Uniform_float %u %uint_1 %57
+         %60 = OpLoad %float %59
+               OpStore %56 %60
                OpReturn
                OpFunctionEnd
-          %f = OpFunction %void None %57
-         %59 = OpLabel
-         %61 = OpLoad %uint %local_invocation_index_1
-         %60 = OpFunctionCall %void %f_inner %61
+          %f = OpFunction %void None %61
+         %63 = OpLabel
+         %65 = OpLoad %uint %local_invocation_index_1
+         %64 = OpFunctionCall %void %f_inner %65
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x3_f16/to_workgroup.wgsl.expected.dxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat2x3_f16/to_workgroup.wgsl.expected.dxc.hlsl
index 9c6f04a..b67b850 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x3_f16/to_workgroup.wgsl.expected.dxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x3_f16/to_workgroup.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared matrix<float16_t, 2, 3> w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = matrix<float16_t, 2, 3>((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x3_f16/to_workgroup.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/unnested/mat2x3_f16/to_workgroup.wgsl.expected.glsl
index c0b70de..0a98363 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x3_f16/to_workgroup.wgsl.expected.glsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x3_f16/to_workgroup.wgsl.expected.glsl
@@ -3,7 +3,7 @@
 
 shared f16mat2x3 w;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf));
   }
   barrier();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x3_f16/to_workgroup.wgsl.expected.msl b/test/tint/buffer/uniform/std140/unnested/mat2x3_f16/to_workgroup.wgsl.expected.msl
index 5f567db..70549cb 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x3_f16/to_workgroup.wgsl.expected.msl
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x3_f16/to_workgroup.wgsl.expected.msl
@@ -29,7 +29,7 @@
 }
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup half2x3* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = half2x3(half3(0.0h), half3(0.0h));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x3_f16/to_workgroup.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/unnested/mat2x3_f16/to_workgroup.wgsl.expected.spvasm
index 40df049..35e5456 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x3_f16/to_workgroup.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x3_f16/to_workgroup.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 62
+; Bound: 66
 ; Schema: 0
                OpCapability Shader
                OpCapability Float16
@@ -42,61 +42,68 @@
           %w = OpVariable %_ptr_Workgroup_mat2v3half Workgroup
        %void = OpTypeVoid
          %12 = OpTypeFunction %void %uint
-         %17 = OpConstantNull %mat2v3half
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %22 = OpConstantNull %mat2v3half
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %mat2v3half
+         %26 = OpTypeFunction %mat2v3half
      %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_v3half = OpTypePointer Uniform %v3half
-     %uint_1 = OpConstant %uint 1
         %int = OpTypeInt 32 1
       %int_1 = OpConstant %int 1
 %_ptr_Workgroup_v3half = OpTypePointer Workgroup %v3half
-         %50 = OpConstantNull %int
+         %54 = OpConstantNull %int
 %_ptr_Workgroup_half = OpTypePointer Workgroup %half
-         %53 = OpConstantNull %uint
+         %57 = OpConstantNull %uint
 %_ptr_Uniform_half = OpTypePointer Uniform %half
-         %57 = OpTypeFunction %void
+         %61 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %12
   %local_idx = OpFunctionParameter %uint
          %16 = OpLabel
-               OpStore %w %17
+         %18 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %20 None
+               OpBranchConditional %18 %21 %20
+         %21 = OpLabel
+               OpStore %w %22
+               OpBranch %20
+         %20 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%load_u_inner = OpFunction %mat2v3half None %21
-         %23 = OpLabel
-         %28 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0
-         %29 = OpLoad %v3half %28
-         %32 = OpAccessChain %_ptr_Uniform_v3half %u %uint_1
-         %33 = OpLoad %v3half %32
-         %34 = OpCompositeConstruct %mat2v3half %29 %33
-               OpReturnValue %34
+%load_u_inner = OpFunction %mat2v3half None %26
+         %28 = OpLabel
+         %33 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0
+         %34 = OpLoad %v3half %33
+         %36 = OpAccessChain %_ptr_Uniform_v3half %u %uint_1
+         %37 = OpLoad %v3half %36
+         %38 = OpCompositeConstruct %mat2v3half %34 %37
+               OpReturnValue %38
                OpFunctionEnd
     %f_inner = OpFunction %void None %12
 %local_invocation_index = OpFunctionParameter %uint
-         %37 = OpLabel
-         %38 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %39 = OpFunctionCall %mat2v3half %load_u_inner
-               OpStore %w %39
-         %43 = OpAccessChain %_ptr_Workgroup_v3half %w %int_1
-         %44 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0
-         %45 = OpLoad %v3half %44
-               OpStore %43 %45
-         %46 = OpAccessChain %_ptr_Workgroup_v3half %w %int_1
-         %47 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0
-         %48 = OpLoad %v3half %47
-         %49 = OpVectorShuffle %v3half %48 %48 2 0 1
-               OpStore %46 %49
-         %52 = OpAccessChain %_ptr_Workgroup_half %w %50 %int_1
-         %55 = OpAccessChain %_ptr_Uniform_half %u %uint_1 %53
-         %56 = OpLoad %half %55
-               OpStore %52 %56
+         %41 = OpLabel
+         %42 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %43 = OpFunctionCall %mat2v3half %load_u_inner
+               OpStore %w %43
+         %47 = OpAccessChain %_ptr_Workgroup_v3half %w %int_1
+         %48 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0
+         %49 = OpLoad %v3half %48
+               OpStore %47 %49
+         %50 = OpAccessChain %_ptr_Workgroup_v3half %w %int_1
+         %51 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0
+         %52 = OpLoad %v3half %51
+         %53 = OpVectorShuffle %v3half %52 %52 2 0 1
+               OpStore %50 %53
+         %56 = OpAccessChain %_ptr_Workgroup_half %w %54 %int_1
+         %59 = OpAccessChain %_ptr_Uniform_half %u %uint_1 %57
+         %60 = OpLoad %half %59
+               OpStore %56 %60
                OpReturn
                OpFunctionEnd
-          %f = OpFunction %void None %57
-         %59 = OpLabel
-         %61 = OpLoad %uint %local_invocation_index_1
-         %60 = OpFunctionCall %void %f_inner %61
+          %f = OpFunction %void None %61
+         %63 = OpLabel
+         %65 = OpLoad %uint %local_invocation_index_1
+         %64 = OpFunctionCall %void %f_inner %65
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x3_f32/to_workgroup.wgsl.expected.dxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat2x3_f32/to_workgroup.wgsl.expected.dxc.hlsl
index dac5219..30b0cfe 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x3_f32/to_workgroup.wgsl.expected.dxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x3_f32/to_workgroup.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float2x3 w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = float2x3((0.0f).xxx, (0.0f).xxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x3_f32/to_workgroup.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat2x3_f32/to_workgroup.wgsl.expected.fxc.hlsl
index dac5219..30b0cfe 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x3_f32/to_workgroup.wgsl.expected.fxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x3_f32/to_workgroup.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float2x3 w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = float2x3((0.0f).xxx, (0.0f).xxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x3_f32/to_workgroup.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/unnested/mat2x3_f32/to_workgroup.wgsl.expected.glsl
index 44bf129..ae422c7 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x3_f32/to_workgroup.wgsl.expected.glsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x3_f32/to_workgroup.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared mat2x3 w;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = mat2x3(vec3(0.0f), vec3(0.0f));
   }
   barrier();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x3_f32/to_workgroup.wgsl.expected.msl b/test/tint/buffer/uniform/std140/unnested/mat2x3_f32/to_workgroup.wgsl.expected.msl
index a7894cb..59ee2c8 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x3_f32/to_workgroup.wgsl.expected.msl
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x3_f32/to_workgroup.wgsl.expected.msl
@@ -29,7 +29,7 @@
 }
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float2x3* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = float2x3(float3(0.0f), float3(0.0f));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x3_f32/to_workgroup.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/unnested/mat2x3_f32/to_workgroup.wgsl.expected.spvasm
index c55a321..bab66ab 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x3_f32/to_workgroup.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x3_f32/to_workgroup.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 51
+; Bound: 56
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -38,7 +38,9 @@
           %w = OpVariable %_ptr_Workgroup_mat2v3float Workgroup
        %void = OpTypeVoid
          %12 = OpTypeFunction %void %uint
-         %17 = OpConstantNull %mat2v3float
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %22 = OpConstantNull %mat2v3float
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
      %uint_0 = OpConstant %uint 0
@@ -46,43 +48,49 @@
         %int = OpTypeInt 32 1
       %int_1 = OpConstant %int 1
 %_ptr_Workgroup_v3float = OpTypePointer Workgroup %v3float
-         %33 = OpConstantNull %int
+         %38 = OpConstantNull %int
 %_ptr_Uniform_v3float = OpTypePointer Uniform %v3float
 %_ptr_Workgroup_float = OpTypePointer Workgroup %float
 %_ptr_Uniform_float = OpTypePointer Uniform %float
-         %46 = OpTypeFunction %void
+         %51 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %12
   %local_idx = OpFunctionParameter %uint
          %16 = OpLabel
-               OpStore %w %17
+         %18 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %20 None
+               OpBranchConditional %18 %21 %20
+         %21 = OpLabel
+               OpStore %w %22
+               OpBranch %20
+         %20 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
     %f_inner = OpFunction %void None %12
 %local_invocation_index = OpFunctionParameter %uint
-         %23 = OpLabel
-         %24 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %27 = OpAccessChain %_ptr_Uniform_mat2v3float %u %uint_0
-         %28 = OpLoad %mat2v3float %27
-               OpStore %w %28
-         %32 = OpAccessChain %_ptr_Workgroup_v3float %w %int_1
-         %35 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %33
-         %36 = OpLoad %v3float %35
-               OpStore %32 %36
+         %28 = OpLabel
+         %29 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %32 = OpAccessChain %_ptr_Uniform_mat2v3float %u %uint_0
+         %33 = OpLoad %mat2v3float %32
+               OpStore %w %33
          %37 = OpAccessChain %_ptr_Workgroup_v3float %w %int_1
-         %38 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %33
-         %39 = OpLoad %v3float %38
-         %40 = OpVectorShuffle %v3float %39 %39 2 0 1
-               OpStore %37 %40
-         %42 = OpAccessChain %_ptr_Workgroup_float %w %33 %int_1
-         %44 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %int_1 %33
-         %45 = OpLoad %float %44
+         %40 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %38
+         %41 = OpLoad %v3float %40
+               OpStore %37 %41
+         %42 = OpAccessChain %_ptr_Workgroup_v3float %w %int_1
+         %43 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %38
+         %44 = OpLoad %v3float %43
+         %45 = OpVectorShuffle %v3float %44 %44 2 0 1
                OpStore %42 %45
+         %47 = OpAccessChain %_ptr_Workgroup_float %w %38 %int_1
+         %49 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %int_1 %38
+         %50 = OpLoad %float %49
+               OpStore %47 %50
                OpReturn
                OpFunctionEnd
-          %f = OpFunction %void None %46
-         %48 = OpLabel
-         %50 = OpLoad %uint %local_invocation_index_1
-         %49 = OpFunctionCall %void %f_inner %50
+          %f = OpFunction %void None %51
+         %53 = OpLabel
+         %55 = OpLoad %uint %local_invocation_index_1
+         %54 = OpFunctionCall %void %f_inner %55
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x4_f16/to_workgroup.wgsl.expected.dxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat2x4_f16/to_workgroup.wgsl.expected.dxc.hlsl
index 8d82988..f7241f8 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x4_f16/to_workgroup.wgsl.expected.dxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x4_f16/to_workgroup.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared matrix<float16_t, 2, 4> w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = matrix<float16_t, 2, 4>((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x4_f16/to_workgroup.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/unnested/mat2x4_f16/to_workgroup.wgsl.expected.glsl
index c27fa31..d857022 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x4_f16/to_workgroup.wgsl.expected.glsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x4_f16/to_workgroup.wgsl.expected.glsl
@@ -3,7 +3,7 @@
 
 shared f16mat2x4 w;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = f16mat2x4(f16vec4(0.0hf), f16vec4(0.0hf));
   }
   barrier();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x4_f16/to_workgroup.wgsl.expected.msl b/test/tint/buffer/uniform/std140/unnested/mat2x4_f16/to_workgroup.wgsl.expected.msl
index 698ce7e..d85a775 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x4_f16/to_workgroup.wgsl.expected.msl
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x4_f16/to_workgroup.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup half2x4* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = half2x4(half4(0.0h), half4(0.0h));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x4_f16/to_workgroup.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/unnested/mat2x4_f16/to_workgroup.wgsl.expected.spvasm
index 6c7215d..90cb262 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x4_f16/to_workgroup.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x4_f16/to_workgroup.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 62
+; Bound: 66
 ; Schema: 0
                OpCapability Shader
                OpCapability Float16
@@ -42,61 +42,68 @@
           %w = OpVariable %_ptr_Workgroup_mat2v4half Workgroup
        %void = OpTypeVoid
          %12 = OpTypeFunction %void %uint
-         %17 = OpConstantNull %mat2v4half
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %22 = OpConstantNull %mat2v4half
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %mat2v4half
+         %26 = OpTypeFunction %mat2v4half
      %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_v4half = OpTypePointer Uniform %v4half
-     %uint_1 = OpConstant %uint 1
         %int = OpTypeInt 32 1
       %int_1 = OpConstant %int 1
 %_ptr_Workgroup_v4half = OpTypePointer Workgroup %v4half
-         %50 = OpConstantNull %int
+         %54 = OpConstantNull %int
 %_ptr_Workgroup_half = OpTypePointer Workgroup %half
-         %53 = OpConstantNull %uint
+         %57 = OpConstantNull %uint
 %_ptr_Uniform_half = OpTypePointer Uniform %half
-         %57 = OpTypeFunction %void
+         %61 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %12
   %local_idx = OpFunctionParameter %uint
          %16 = OpLabel
-               OpStore %w %17
+         %18 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %20 None
+               OpBranchConditional %18 %21 %20
+         %21 = OpLabel
+               OpStore %w %22
+               OpBranch %20
+         %20 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%load_u_inner = OpFunction %mat2v4half None %21
-         %23 = OpLabel
-         %28 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0
-         %29 = OpLoad %v4half %28
-         %32 = OpAccessChain %_ptr_Uniform_v4half %u %uint_1
-         %33 = OpLoad %v4half %32
-         %34 = OpCompositeConstruct %mat2v4half %29 %33
-               OpReturnValue %34
+%load_u_inner = OpFunction %mat2v4half None %26
+         %28 = OpLabel
+         %33 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0
+         %34 = OpLoad %v4half %33
+         %36 = OpAccessChain %_ptr_Uniform_v4half %u %uint_1
+         %37 = OpLoad %v4half %36
+         %38 = OpCompositeConstruct %mat2v4half %34 %37
+               OpReturnValue %38
                OpFunctionEnd
     %f_inner = OpFunction %void None %12
 %local_invocation_index = OpFunctionParameter %uint
-         %37 = OpLabel
-         %38 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %39 = OpFunctionCall %mat2v4half %load_u_inner
-               OpStore %w %39
-         %43 = OpAccessChain %_ptr_Workgroup_v4half %w %int_1
-         %44 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0
-         %45 = OpLoad %v4half %44
-               OpStore %43 %45
-         %46 = OpAccessChain %_ptr_Workgroup_v4half %w %int_1
-         %47 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0
-         %48 = OpLoad %v4half %47
-         %49 = OpVectorShuffle %v4half %48 %48 1 3 0 2
-               OpStore %46 %49
-         %52 = OpAccessChain %_ptr_Workgroup_half %w %50 %int_1
-         %55 = OpAccessChain %_ptr_Uniform_half %u %uint_1 %53
-         %56 = OpLoad %half %55
-               OpStore %52 %56
+         %41 = OpLabel
+         %42 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %43 = OpFunctionCall %mat2v4half %load_u_inner
+               OpStore %w %43
+         %47 = OpAccessChain %_ptr_Workgroup_v4half %w %int_1
+         %48 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0
+         %49 = OpLoad %v4half %48
+               OpStore %47 %49
+         %50 = OpAccessChain %_ptr_Workgroup_v4half %w %int_1
+         %51 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0
+         %52 = OpLoad %v4half %51
+         %53 = OpVectorShuffle %v4half %52 %52 1 3 0 2
+               OpStore %50 %53
+         %56 = OpAccessChain %_ptr_Workgroup_half %w %54 %int_1
+         %59 = OpAccessChain %_ptr_Uniform_half %u %uint_1 %57
+         %60 = OpLoad %half %59
+               OpStore %56 %60
                OpReturn
                OpFunctionEnd
-          %f = OpFunction %void None %57
-         %59 = OpLabel
-         %61 = OpLoad %uint %local_invocation_index_1
-         %60 = OpFunctionCall %void %f_inner %61
+          %f = OpFunction %void None %61
+         %63 = OpLabel
+         %65 = OpLoad %uint %local_invocation_index_1
+         %64 = OpFunctionCall %void %f_inner %65
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x4_f32/to_workgroup.wgsl.expected.dxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat2x4_f32/to_workgroup.wgsl.expected.dxc.hlsl
index 91fc5f8..4a32f1f 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x4_f32/to_workgroup.wgsl.expected.dxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x4_f32/to_workgroup.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float2x4 w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = float2x4((0.0f).xxxx, (0.0f).xxxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x4_f32/to_workgroup.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat2x4_f32/to_workgroup.wgsl.expected.fxc.hlsl
index 91fc5f8..4a32f1f 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x4_f32/to_workgroup.wgsl.expected.fxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x4_f32/to_workgroup.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float2x4 w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = float2x4((0.0f).xxxx, (0.0f).xxxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x4_f32/to_workgroup.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/unnested/mat2x4_f32/to_workgroup.wgsl.expected.glsl
index 0bd52a5..7cb5f62 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x4_f32/to_workgroup.wgsl.expected.glsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x4_f32/to_workgroup.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared mat2x4 w;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = mat2x4(vec4(0.0f), vec4(0.0f));
   }
   barrier();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x4_f32/to_workgroup.wgsl.expected.msl b/test/tint/buffer/uniform/std140/unnested/mat2x4_f32/to_workgroup.wgsl.expected.msl
index f312464..c1613aa 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x4_f32/to_workgroup.wgsl.expected.msl
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x4_f32/to_workgroup.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float2x4* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = float2x4(float4(0.0f), float4(0.0f));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/buffer/uniform/std140/unnested/mat2x4_f32/to_workgroup.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/unnested/mat2x4_f32/to_workgroup.wgsl.expected.spvasm
index b0fe869..3b2867c 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat2x4_f32/to_workgroup.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/unnested/mat2x4_f32/to_workgroup.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 51
+; Bound: 56
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -38,7 +38,9 @@
           %w = OpVariable %_ptr_Workgroup_mat2v4float Workgroup
        %void = OpTypeVoid
          %12 = OpTypeFunction %void %uint
-         %17 = OpConstantNull %mat2v4float
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %22 = OpConstantNull %mat2v4float
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
      %uint_0 = OpConstant %uint 0
@@ -46,43 +48,49 @@
         %int = OpTypeInt 32 1
       %int_1 = OpConstant %int 1
 %_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float
-         %33 = OpConstantNull %int
+         %38 = OpConstantNull %int
 %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
 %_ptr_Workgroup_float = OpTypePointer Workgroup %float
 %_ptr_Uniform_float = OpTypePointer Uniform %float
-         %46 = OpTypeFunction %void
+         %51 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %12
   %local_idx = OpFunctionParameter %uint
          %16 = OpLabel
-               OpStore %w %17
+         %18 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %20 None
+               OpBranchConditional %18 %21 %20
+         %21 = OpLabel
+               OpStore %w %22
+               OpBranch %20
+         %20 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
     %f_inner = OpFunction %void None %12
 %local_invocation_index = OpFunctionParameter %uint
-         %23 = OpLabel
-         %24 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %27 = OpAccessChain %_ptr_Uniform_mat2v4float %u %uint_0
-         %28 = OpLoad %mat2v4float %27
-               OpStore %w %28
-         %32 = OpAccessChain %_ptr_Workgroup_v4float %w %int_1
-         %35 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %33
-         %36 = OpLoad %v4float %35
-               OpStore %32 %36
+         %28 = OpLabel
+         %29 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %32 = OpAccessChain %_ptr_Uniform_mat2v4float %u %uint_0
+         %33 = OpLoad %mat2v4float %32
+               OpStore %w %33
          %37 = OpAccessChain %_ptr_Workgroup_v4float %w %int_1
-         %38 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %33
-         %39 = OpLoad %v4float %38
-         %40 = OpVectorShuffle %v4float %39 %39 1 3 0 2
-               OpStore %37 %40
-         %42 = OpAccessChain %_ptr_Workgroup_float %w %33 %int_1
-         %44 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %int_1 %33
-         %45 = OpLoad %float %44
+         %40 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %38
+         %41 = OpLoad %v4float %40
+               OpStore %37 %41
+         %42 = OpAccessChain %_ptr_Workgroup_v4float %w %int_1
+         %43 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %38
+         %44 = OpLoad %v4float %43
+         %45 = OpVectorShuffle %v4float %44 %44 1 3 0 2
                OpStore %42 %45
+         %47 = OpAccessChain %_ptr_Workgroup_float %w %38 %int_1
+         %49 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %int_1 %38
+         %50 = OpLoad %float %49
+               OpStore %47 %50
                OpReturn
                OpFunctionEnd
-          %f = OpFunction %void None %46
-         %48 = OpLabel
-         %50 = OpLoad %uint %local_invocation_index_1
-         %49 = OpFunctionCall %void %f_inner %50
+          %f = OpFunction %void None %51
+         %53 = OpLabel
+         %55 = OpLoad %uint %local_invocation_index_1
+         %54 = OpFunctionCall %void %f_inner %55
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x2_f16/to_workgroup.wgsl.expected.dxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat3x2_f16/to_workgroup.wgsl.expected.dxc.hlsl
index e0336f9..2eaa44b 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x2_f16/to_workgroup.wgsl.expected.dxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x2_f16/to_workgroup.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared matrix<float16_t, 3, 2> w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = matrix<float16_t, 3, 2>((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x2_f16/to_workgroup.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/unnested/mat3x2_f16/to_workgroup.wgsl.expected.glsl
index 43831f4..28ea3aa 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x2_f16/to_workgroup.wgsl.expected.glsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x2_f16/to_workgroup.wgsl.expected.glsl
@@ -3,7 +3,7 @@
 
 shared f16mat3x2 w;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = f16mat3x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf));
   }
   barrier();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x2_f16/to_workgroup.wgsl.expected.msl b/test/tint/buffer/uniform/std140/unnested/mat3x2_f16/to_workgroup.wgsl.expected.msl
index 8985f38..9b39dd3 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x2_f16/to_workgroup.wgsl.expected.msl
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x2_f16/to_workgroup.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup half3x2* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = half3x2(half2(0.0h), half2(0.0h), half2(0.0h));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x2_f16/to_workgroup.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/unnested/mat3x2_f16/to_workgroup.wgsl.expected.spvasm
index d321d59..1dcf823 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x2_f16/to_workgroup.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x2_f16/to_workgroup.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 65
+; Bound: 69
 ; Schema: 0
                OpCapability Shader
                OpCapability Float16
@@ -44,63 +44,70 @@
           %w = OpVariable %_ptr_Workgroup_mat3v2half Workgroup
        %void = OpTypeVoid
          %12 = OpTypeFunction %void %uint
-         %17 = OpConstantNull %mat3v2half
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %22 = OpConstantNull %mat3v2half
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %mat3v2half
+         %26 = OpTypeFunction %mat3v2half
      %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_v2half = OpTypePointer Uniform %v2half
-     %uint_1 = OpConstant %uint 1
         %int = OpTypeInt 32 1
       %int_1 = OpConstant %int 1
 %_ptr_Workgroup_v2half = OpTypePointer Workgroup %v2half
-         %53 = OpConstantNull %int
+         %57 = OpConstantNull %int
 %_ptr_Workgroup_half = OpTypePointer Workgroup %half
-         %56 = OpConstantNull %uint
+         %60 = OpConstantNull %uint
 %_ptr_Uniform_half = OpTypePointer Uniform %half
-         %60 = OpTypeFunction %void
+         %64 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %12
   %local_idx = OpFunctionParameter %uint
          %16 = OpLabel
-               OpStore %w %17
+         %18 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %20 None
+               OpBranchConditional %18 %21 %20
+         %21 = OpLabel
+               OpStore %w %22
+               OpBranch %20
+         %20 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%load_u_inner = OpFunction %mat3v2half None %21
-         %23 = OpLabel
-         %28 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0
-         %29 = OpLoad %v2half %28
-         %32 = OpAccessChain %_ptr_Uniform_v2half %u %uint_1
-         %33 = OpLoad %v2half %32
-         %35 = OpAccessChain %_ptr_Uniform_v2half %u %uint_2
-         %36 = OpLoad %v2half %35
-         %37 = OpCompositeConstruct %mat3v2half %29 %33 %36
-               OpReturnValue %37
+%load_u_inner = OpFunction %mat3v2half None %26
+         %28 = OpLabel
+         %33 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0
+         %34 = OpLoad %v2half %33
+         %36 = OpAccessChain %_ptr_Uniform_v2half %u %uint_1
+         %37 = OpLoad %v2half %36
+         %39 = OpAccessChain %_ptr_Uniform_v2half %u %uint_2
+         %40 = OpLoad %v2half %39
+         %41 = OpCompositeConstruct %mat3v2half %34 %37 %40
+               OpReturnValue %41
                OpFunctionEnd
     %f_inner = OpFunction %void None %12
 %local_invocation_index = OpFunctionParameter %uint
-         %40 = OpLabel
-         %41 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %42 = OpFunctionCall %mat3v2half %load_u_inner
-               OpStore %w %42
-         %46 = OpAccessChain %_ptr_Workgroup_v2half %w %int_1
-         %47 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0
-         %48 = OpLoad %v2half %47
-               OpStore %46 %48
-         %49 = OpAccessChain %_ptr_Workgroup_v2half %w %int_1
-         %50 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0
-         %51 = OpLoad %v2half %50
-         %52 = OpVectorShuffle %v2half %51 %51 1 0
-               OpStore %49 %52
-         %55 = OpAccessChain %_ptr_Workgroup_half %w %53 %int_1
-         %58 = OpAccessChain %_ptr_Uniform_half %u %uint_1 %56
-         %59 = OpLoad %half %58
-               OpStore %55 %59
+         %44 = OpLabel
+         %45 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %46 = OpFunctionCall %mat3v2half %load_u_inner
+               OpStore %w %46
+         %50 = OpAccessChain %_ptr_Workgroup_v2half %w %int_1
+         %51 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0
+         %52 = OpLoad %v2half %51
+               OpStore %50 %52
+         %53 = OpAccessChain %_ptr_Workgroup_v2half %w %int_1
+         %54 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0
+         %55 = OpLoad %v2half %54
+         %56 = OpVectorShuffle %v2half %55 %55 1 0
+               OpStore %53 %56
+         %59 = OpAccessChain %_ptr_Workgroup_half %w %57 %int_1
+         %62 = OpAccessChain %_ptr_Uniform_half %u %uint_1 %60
+         %63 = OpLoad %half %62
+               OpStore %59 %63
                OpReturn
                OpFunctionEnd
-          %f = OpFunction %void None %60
-         %62 = OpLabel
-         %64 = OpLoad %uint %local_invocation_index_1
-         %63 = OpFunctionCall %void %f_inner %64
+          %f = OpFunction %void None %64
+         %66 = OpLabel
+         %68 = OpLoad %uint %local_invocation_index_1
+         %67 = OpFunctionCall %void %f_inner %68
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x2_f32/to_workgroup.wgsl.expected.dxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat3x2_f32/to_workgroup.wgsl.expected.dxc.hlsl
index a80d9f2..18ca9a7 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x2_f32/to_workgroup.wgsl.expected.dxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x2_f32/to_workgroup.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float3x2 w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x2_f32/to_workgroup.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat3x2_f32/to_workgroup.wgsl.expected.fxc.hlsl
index a80d9f2..18ca9a7 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x2_f32/to_workgroup.wgsl.expected.fxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x2_f32/to_workgroup.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float3x2 w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x2_f32/to_workgroup.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/unnested/mat3x2_f32/to_workgroup.wgsl.expected.glsl
index 522b2f5..ad77de6 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x2_f32/to_workgroup.wgsl.expected.glsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x2_f32/to_workgroup.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared mat3x2 w;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = mat3x2(vec2(0.0f), vec2(0.0f), vec2(0.0f));
   }
   barrier();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x2_f32/to_workgroup.wgsl.expected.msl b/test/tint/buffer/uniform/std140/unnested/mat3x2_f32/to_workgroup.wgsl.expected.msl
index 7973cec..8538400 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x2_f32/to_workgroup.wgsl.expected.msl
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x2_f32/to_workgroup.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float3x2* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = float3x2(float2(0.0f), float2(0.0f), float2(0.0f));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x2_f32/to_workgroup.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/unnested/mat3x2_f32/to_workgroup.wgsl.expected.spvasm
index 829e01e..adeb165 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x2_f32/to_workgroup.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x2_f32/to_workgroup.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 65
+; Bound: 69
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -41,63 +41,70 @@
           %w = OpVariable %_ptr_Workgroup_mat3v2float Workgroup
        %void = OpTypeVoid
          %12 = OpTypeFunction %void %uint
-         %17 = OpConstantNull %mat3v2float
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %22 = OpConstantNull %mat3v2float
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %mat3v2float
+         %26 = OpTypeFunction %mat3v2float
      %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
-     %uint_1 = OpConstant %uint 1
         %int = OpTypeInt 32 1
       %int_1 = OpConstant %int 1
 %_ptr_Workgroup_v2float = OpTypePointer Workgroup %v2float
-         %53 = OpConstantNull %int
+         %57 = OpConstantNull %int
 %_ptr_Workgroup_float = OpTypePointer Workgroup %float
-         %56 = OpConstantNull %uint
+         %60 = OpConstantNull %uint
 %_ptr_Uniform_float = OpTypePointer Uniform %float
-         %60 = OpTypeFunction %void
+         %64 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %12
   %local_idx = OpFunctionParameter %uint
          %16 = OpLabel
-               OpStore %w %17
+         %18 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %20 None
+               OpBranchConditional %18 %21 %20
+         %21 = OpLabel
+               OpStore %w %22
+               OpBranch %20
+         %20 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%load_u_inner = OpFunction %mat3v2float None %21
-         %23 = OpLabel
-         %28 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0
-         %29 = OpLoad %v2float %28
-         %32 = OpAccessChain %_ptr_Uniform_v2float %u %uint_1
-         %33 = OpLoad %v2float %32
-         %35 = OpAccessChain %_ptr_Uniform_v2float %u %uint_2
-         %36 = OpLoad %v2float %35
-         %37 = OpCompositeConstruct %mat3v2float %29 %33 %36
-               OpReturnValue %37
+%load_u_inner = OpFunction %mat3v2float None %26
+         %28 = OpLabel
+         %33 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0
+         %34 = OpLoad %v2float %33
+         %36 = OpAccessChain %_ptr_Uniform_v2float %u %uint_1
+         %37 = OpLoad %v2float %36
+         %39 = OpAccessChain %_ptr_Uniform_v2float %u %uint_2
+         %40 = OpLoad %v2float %39
+         %41 = OpCompositeConstruct %mat3v2float %34 %37 %40
+               OpReturnValue %41
                OpFunctionEnd
     %f_inner = OpFunction %void None %12
 %local_invocation_index = OpFunctionParameter %uint
-         %40 = OpLabel
-         %41 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %42 = OpFunctionCall %mat3v2float %load_u_inner
-               OpStore %w %42
-         %46 = OpAccessChain %_ptr_Workgroup_v2float %w %int_1
-         %47 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0
-         %48 = OpLoad %v2float %47
-               OpStore %46 %48
-         %49 = OpAccessChain %_ptr_Workgroup_v2float %w %int_1
-         %50 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0
-         %51 = OpLoad %v2float %50
-         %52 = OpVectorShuffle %v2float %51 %51 1 0
-               OpStore %49 %52
-         %55 = OpAccessChain %_ptr_Workgroup_float %w %53 %int_1
-         %58 = OpAccessChain %_ptr_Uniform_float %u %uint_1 %56
-         %59 = OpLoad %float %58
-               OpStore %55 %59
+         %44 = OpLabel
+         %45 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %46 = OpFunctionCall %mat3v2float %load_u_inner
+               OpStore %w %46
+         %50 = OpAccessChain %_ptr_Workgroup_v2float %w %int_1
+         %51 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0
+         %52 = OpLoad %v2float %51
+               OpStore %50 %52
+         %53 = OpAccessChain %_ptr_Workgroup_v2float %w %int_1
+         %54 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0
+         %55 = OpLoad %v2float %54
+         %56 = OpVectorShuffle %v2float %55 %55 1 0
+               OpStore %53 %56
+         %59 = OpAccessChain %_ptr_Workgroup_float %w %57 %int_1
+         %62 = OpAccessChain %_ptr_Uniform_float %u %uint_1 %60
+         %63 = OpLoad %float %62
+               OpStore %59 %63
                OpReturn
                OpFunctionEnd
-          %f = OpFunction %void None %60
-         %62 = OpLabel
-         %64 = OpLoad %uint %local_invocation_index_1
-         %63 = OpFunctionCall %void %f_inner %64
+          %f = OpFunction %void None %64
+         %66 = OpLabel
+         %68 = OpLoad %uint %local_invocation_index_1
+         %67 = OpFunctionCall %void %f_inner %68
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x3_f16/to_workgroup.wgsl.expected.dxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat3x3_f16/to_workgroup.wgsl.expected.dxc.hlsl
index 5f74c09..26b611c 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x3_f16/to_workgroup.wgsl.expected.dxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x3_f16/to_workgroup.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared matrix<float16_t, 3, 3> w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = matrix<float16_t, 3, 3>((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x3_f16/to_workgroup.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/unnested/mat3x3_f16/to_workgroup.wgsl.expected.glsl
index d7bce1f..b8c0058 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x3_f16/to_workgroup.wgsl.expected.glsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x3_f16/to_workgroup.wgsl.expected.glsl
@@ -3,7 +3,7 @@
 
 shared f16mat3 w;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = f16mat3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf));
   }
   barrier();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x3_f16/to_workgroup.wgsl.expected.msl b/test/tint/buffer/uniform/std140/unnested/mat3x3_f16/to_workgroup.wgsl.expected.msl
index d5dfc96..91b1569 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x3_f16/to_workgroup.wgsl.expected.msl
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x3_f16/to_workgroup.wgsl.expected.msl
@@ -29,7 +29,7 @@
 }
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup half3x3* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = half3x3(half3(0.0h), half3(0.0h), half3(0.0h));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x3_f16/to_workgroup.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/unnested/mat3x3_f16/to_workgroup.wgsl.expected.spvasm
index e6e6ef3..f171268 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x3_f16/to_workgroup.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x3_f16/to_workgroup.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 65
+; Bound: 69
 ; Schema: 0
                OpCapability Shader
                OpCapability Float16
@@ -44,63 +44,70 @@
           %w = OpVariable %_ptr_Workgroup_mat3v3half Workgroup
        %void = OpTypeVoid
          %12 = OpTypeFunction %void %uint
-         %17 = OpConstantNull %mat3v3half
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %22 = OpConstantNull %mat3v3half
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %mat3v3half
+         %26 = OpTypeFunction %mat3v3half
      %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_v3half = OpTypePointer Uniform %v3half
-     %uint_1 = OpConstant %uint 1
         %int = OpTypeInt 32 1
       %int_1 = OpConstant %int 1
 %_ptr_Workgroup_v3half = OpTypePointer Workgroup %v3half
-         %53 = OpConstantNull %int
+         %57 = OpConstantNull %int
 %_ptr_Workgroup_half = OpTypePointer Workgroup %half
-         %56 = OpConstantNull %uint
+         %60 = OpConstantNull %uint
 %_ptr_Uniform_half = OpTypePointer Uniform %half
-         %60 = OpTypeFunction %void
+         %64 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %12
   %local_idx = OpFunctionParameter %uint
          %16 = OpLabel
-               OpStore %w %17
+         %18 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %20 None
+               OpBranchConditional %18 %21 %20
+         %21 = OpLabel
+               OpStore %w %22
+               OpBranch %20
+         %20 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%load_u_inner = OpFunction %mat3v3half None %21
-         %23 = OpLabel
-         %28 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0
-         %29 = OpLoad %v3half %28
-         %32 = OpAccessChain %_ptr_Uniform_v3half %u %uint_1
-         %33 = OpLoad %v3half %32
-         %35 = OpAccessChain %_ptr_Uniform_v3half %u %uint_2
-         %36 = OpLoad %v3half %35
-         %37 = OpCompositeConstruct %mat3v3half %29 %33 %36
-               OpReturnValue %37
+%load_u_inner = OpFunction %mat3v3half None %26
+         %28 = OpLabel
+         %33 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0
+         %34 = OpLoad %v3half %33
+         %36 = OpAccessChain %_ptr_Uniform_v3half %u %uint_1
+         %37 = OpLoad %v3half %36
+         %39 = OpAccessChain %_ptr_Uniform_v3half %u %uint_2
+         %40 = OpLoad %v3half %39
+         %41 = OpCompositeConstruct %mat3v3half %34 %37 %40
+               OpReturnValue %41
                OpFunctionEnd
     %f_inner = OpFunction %void None %12
 %local_invocation_index = OpFunctionParameter %uint
-         %40 = OpLabel
-         %41 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %42 = OpFunctionCall %mat3v3half %load_u_inner
-               OpStore %w %42
-         %46 = OpAccessChain %_ptr_Workgroup_v3half %w %int_1
-         %47 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0
-         %48 = OpLoad %v3half %47
-               OpStore %46 %48
-         %49 = OpAccessChain %_ptr_Workgroup_v3half %w %int_1
-         %50 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0
-         %51 = OpLoad %v3half %50
-         %52 = OpVectorShuffle %v3half %51 %51 2 0 1
-               OpStore %49 %52
-         %55 = OpAccessChain %_ptr_Workgroup_half %w %53 %int_1
-         %58 = OpAccessChain %_ptr_Uniform_half %u %uint_1 %56
-         %59 = OpLoad %half %58
-               OpStore %55 %59
+         %44 = OpLabel
+         %45 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %46 = OpFunctionCall %mat3v3half %load_u_inner
+               OpStore %w %46
+         %50 = OpAccessChain %_ptr_Workgroup_v3half %w %int_1
+         %51 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0
+         %52 = OpLoad %v3half %51
+               OpStore %50 %52
+         %53 = OpAccessChain %_ptr_Workgroup_v3half %w %int_1
+         %54 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0
+         %55 = OpLoad %v3half %54
+         %56 = OpVectorShuffle %v3half %55 %55 2 0 1
+               OpStore %53 %56
+         %59 = OpAccessChain %_ptr_Workgroup_half %w %57 %int_1
+         %62 = OpAccessChain %_ptr_Uniform_half %u %uint_1 %60
+         %63 = OpLoad %half %62
+               OpStore %59 %63
                OpReturn
                OpFunctionEnd
-          %f = OpFunction %void None %60
-         %62 = OpLabel
-         %64 = OpLoad %uint %local_invocation_index_1
-         %63 = OpFunctionCall %void %f_inner %64
+          %f = OpFunction %void None %64
+         %66 = OpLabel
+         %68 = OpLoad %uint %local_invocation_index_1
+         %67 = OpFunctionCall %void %f_inner %68
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x3_f32/to_workgroup.wgsl.expected.dxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat3x3_f32/to_workgroup.wgsl.expected.dxc.hlsl
index 51be4dc..d2ec1f5 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x3_f32/to_workgroup.wgsl.expected.dxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x3_f32/to_workgroup.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float3x3 w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x3_f32/to_workgroup.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat3x3_f32/to_workgroup.wgsl.expected.fxc.hlsl
index 51be4dc..d2ec1f5 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x3_f32/to_workgroup.wgsl.expected.fxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x3_f32/to_workgroup.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float3x3 w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x3_f32/to_workgroup.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/unnested/mat3x3_f32/to_workgroup.wgsl.expected.glsl
index 9dc2585..e7008f4 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x3_f32/to_workgroup.wgsl.expected.glsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x3_f32/to_workgroup.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared mat3 w;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = mat3(vec3(0.0f), vec3(0.0f), vec3(0.0f));
   }
   barrier();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x3_f32/to_workgroup.wgsl.expected.msl b/test/tint/buffer/uniform/std140/unnested/mat3x3_f32/to_workgroup.wgsl.expected.msl
index 2ee4e41..799208b 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x3_f32/to_workgroup.wgsl.expected.msl
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x3_f32/to_workgroup.wgsl.expected.msl
@@ -29,7 +29,7 @@
 }
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float3x3* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = float3x3(float3(0.0f), float3(0.0f), float3(0.0f));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x3_f32/to_workgroup.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/unnested/mat3x3_f32/to_workgroup.wgsl.expected.spvasm
index eda4f7f..596b7f7 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x3_f32/to_workgroup.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x3_f32/to_workgroup.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 51
+; Bound: 56
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -38,7 +38,9 @@
           %w = OpVariable %_ptr_Workgroup_mat3v3float Workgroup
        %void = OpTypeVoid
          %12 = OpTypeFunction %void %uint
-         %17 = OpConstantNull %mat3v3float
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %22 = OpConstantNull %mat3v3float
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
      %uint_0 = OpConstant %uint 0
@@ -46,43 +48,49 @@
         %int = OpTypeInt 32 1
       %int_1 = OpConstant %int 1
 %_ptr_Workgroup_v3float = OpTypePointer Workgroup %v3float
-         %33 = OpConstantNull %int
+         %38 = OpConstantNull %int
 %_ptr_Uniform_v3float = OpTypePointer Uniform %v3float
 %_ptr_Workgroup_float = OpTypePointer Workgroup %float
 %_ptr_Uniform_float = OpTypePointer Uniform %float
-         %46 = OpTypeFunction %void
+         %51 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %12
   %local_idx = OpFunctionParameter %uint
          %16 = OpLabel
-               OpStore %w %17
+         %18 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %20 None
+               OpBranchConditional %18 %21 %20
+         %21 = OpLabel
+               OpStore %w %22
+               OpBranch %20
+         %20 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
     %f_inner = OpFunction %void None %12
 %local_invocation_index = OpFunctionParameter %uint
-         %23 = OpLabel
-         %24 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %27 = OpAccessChain %_ptr_Uniform_mat3v3float %u %uint_0
-         %28 = OpLoad %mat3v3float %27
-               OpStore %w %28
-         %32 = OpAccessChain %_ptr_Workgroup_v3float %w %int_1
-         %35 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %33
-         %36 = OpLoad %v3float %35
-               OpStore %32 %36
+         %28 = OpLabel
+         %29 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %32 = OpAccessChain %_ptr_Uniform_mat3v3float %u %uint_0
+         %33 = OpLoad %mat3v3float %32
+               OpStore %w %33
          %37 = OpAccessChain %_ptr_Workgroup_v3float %w %int_1
-         %38 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %33
-         %39 = OpLoad %v3float %38
-         %40 = OpVectorShuffle %v3float %39 %39 2 0 1
-               OpStore %37 %40
-         %42 = OpAccessChain %_ptr_Workgroup_float %w %33 %int_1
-         %44 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %int_1 %33
-         %45 = OpLoad %float %44
+         %40 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %38
+         %41 = OpLoad %v3float %40
+               OpStore %37 %41
+         %42 = OpAccessChain %_ptr_Workgroup_v3float %w %int_1
+         %43 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %38
+         %44 = OpLoad %v3float %43
+         %45 = OpVectorShuffle %v3float %44 %44 2 0 1
                OpStore %42 %45
+         %47 = OpAccessChain %_ptr_Workgroup_float %w %38 %int_1
+         %49 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %int_1 %38
+         %50 = OpLoad %float %49
+               OpStore %47 %50
                OpReturn
                OpFunctionEnd
-          %f = OpFunction %void None %46
-         %48 = OpLabel
-         %50 = OpLoad %uint %local_invocation_index_1
-         %49 = OpFunctionCall %void %f_inner %50
+          %f = OpFunction %void None %51
+         %53 = OpLabel
+         %55 = OpLoad %uint %local_invocation_index_1
+         %54 = OpFunctionCall %void %f_inner %55
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x4_f16/to_workgroup.wgsl.expected.dxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat3x4_f16/to_workgroup.wgsl.expected.dxc.hlsl
index 2a12084..032d73d 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x4_f16/to_workgroup.wgsl.expected.dxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x4_f16/to_workgroup.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared matrix<float16_t, 3, 4> w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = matrix<float16_t, 3, 4>((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x4_f16/to_workgroup.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/unnested/mat3x4_f16/to_workgroup.wgsl.expected.glsl
index 0291f57..25fe8eb 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x4_f16/to_workgroup.wgsl.expected.glsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x4_f16/to_workgroup.wgsl.expected.glsl
@@ -3,7 +3,7 @@
 
 shared f16mat3x4 w;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = f16mat3x4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf));
   }
   barrier();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x4_f16/to_workgroup.wgsl.expected.msl b/test/tint/buffer/uniform/std140/unnested/mat3x4_f16/to_workgroup.wgsl.expected.msl
index ff09eb7..97e957d 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x4_f16/to_workgroup.wgsl.expected.msl
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x4_f16/to_workgroup.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup half3x4* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = half3x4(half4(0.0h), half4(0.0h), half4(0.0h));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x4_f16/to_workgroup.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/unnested/mat3x4_f16/to_workgroup.wgsl.expected.spvasm
index 90d394c..af8aa3e 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x4_f16/to_workgroup.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x4_f16/to_workgroup.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 65
+; Bound: 69
 ; Schema: 0
                OpCapability Shader
                OpCapability Float16
@@ -44,63 +44,70 @@
           %w = OpVariable %_ptr_Workgroup_mat3v4half Workgroup
        %void = OpTypeVoid
          %12 = OpTypeFunction %void %uint
-         %17 = OpConstantNull %mat3v4half
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %22 = OpConstantNull %mat3v4half
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %mat3v4half
+         %26 = OpTypeFunction %mat3v4half
      %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_v4half = OpTypePointer Uniform %v4half
-     %uint_1 = OpConstant %uint 1
         %int = OpTypeInt 32 1
       %int_1 = OpConstant %int 1
 %_ptr_Workgroup_v4half = OpTypePointer Workgroup %v4half
-         %53 = OpConstantNull %int
+         %57 = OpConstantNull %int
 %_ptr_Workgroup_half = OpTypePointer Workgroup %half
-         %56 = OpConstantNull %uint
+         %60 = OpConstantNull %uint
 %_ptr_Uniform_half = OpTypePointer Uniform %half
-         %60 = OpTypeFunction %void
+         %64 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %12
   %local_idx = OpFunctionParameter %uint
          %16 = OpLabel
-               OpStore %w %17
+         %18 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %20 None
+               OpBranchConditional %18 %21 %20
+         %21 = OpLabel
+               OpStore %w %22
+               OpBranch %20
+         %20 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%load_u_inner = OpFunction %mat3v4half None %21
-         %23 = OpLabel
-         %28 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0
-         %29 = OpLoad %v4half %28
-         %32 = OpAccessChain %_ptr_Uniform_v4half %u %uint_1
-         %33 = OpLoad %v4half %32
-         %35 = OpAccessChain %_ptr_Uniform_v4half %u %uint_2
-         %36 = OpLoad %v4half %35
-         %37 = OpCompositeConstruct %mat3v4half %29 %33 %36
-               OpReturnValue %37
+%load_u_inner = OpFunction %mat3v4half None %26
+         %28 = OpLabel
+         %33 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0
+         %34 = OpLoad %v4half %33
+         %36 = OpAccessChain %_ptr_Uniform_v4half %u %uint_1
+         %37 = OpLoad %v4half %36
+         %39 = OpAccessChain %_ptr_Uniform_v4half %u %uint_2
+         %40 = OpLoad %v4half %39
+         %41 = OpCompositeConstruct %mat3v4half %34 %37 %40
+               OpReturnValue %41
                OpFunctionEnd
     %f_inner = OpFunction %void None %12
 %local_invocation_index = OpFunctionParameter %uint
-         %40 = OpLabel
-         %41 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %42 = OpFunctionCall %mat3v4half %load_u_inner
-               OpStore %w %42
-         %46 = OpAccessChain %_ptr_Workgroup_v4half %w %int_1
-         %47 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0
-         %48 = OpLoad %v4half %47
-               OpStore %46 %48
-         %49 = OpAccessChain %_ptr_Workgroup_v4half %w %int_1
-         %50 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0
-         %51 = OpLoad %v4half %50
-         %52 = OpVectorShuffle %v4half %51 %51 1 3 0 2
-               OpStore %49 %52
-         %55 = OpAccessChain %_ptr_Workgroup_half %w %53 %int_1
-         %58 = OpAccessChain %_ptr_Uniform_half %u %uint_1 %56
-         %59 = OpLoad %half %58
-               OpStore %55 %59
+         %44 = OpLabel
+         %45 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %46 = OpFunctionCall %mat3v4half %load_u_inner
+               OpStore %w %46
+         %50 = OpAccessChain %_ptr_Workgroup_v4half %w %int_1
+         %51 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0
+         %52 = OpLoad %v4half %51
+               OpStore %50 %52
+         %53 = OpAccessChain %_ptr_Workgroup_v4half %w %int_1
+         %54 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0
+         %55 = OpLoad %v4half %54
+         %56 = OpVectorShuffle %v4half %55 %55 1 3 0 2
+               OpStore %53 %56
+         %59 = OpAccessChain %_ptr_Workgroup_half %w %57 %int_1
+         %62 = OpAccessChain %_ptr_Uniform_half %u %uint_1 %60
+         %63 = OpLoad %half %62
+               OpStore %59 %63
                OpReturn
                OpFunctionEnd
-          %f = OpFunction %void None %60
-         %62 = OpLabel
-         %64 = OpLoad %uint %local_invocation_index_1
-         %63 = OpFunctionCall %void %f_inner %64
+          %f = OpFunction %void None %64
+         %66 = OpLabel
+         %68 = OpLoad %uint %local_invocation_index_1
+         %67 = OpFunctionCall %void %f_inner %68
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x4_f32/to_workgroup.wgsl.expected.dxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat3x4_f32/to_workgroup.wgsl.expected.dxc.hlsl
index 12070bb..55f9e96 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x4_f32/to_workgroup.wgsl.expected.dxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x4_f32/to_workgroup.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float3x4 w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x4_f32/to_workgroup.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat3x4_f32/to_workgroup.wgsl.expected.fxc.hlsl
index 12070bb..55f9e96 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x4_f32/to_workgroup.wgsl.expected.fxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x4_f32/to_workgroup.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float3x4 w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x4_f32/to_workgroup.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/unnested/mat3x4_f32/to_workgroup.wgsl.expected.glsl
index 540f080..8be0f4e 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x4_f32/to_workgroup.wgsl.expected.glsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x4_f32/to_workgroup.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared mat3x4 w;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = mat3x4(vec4(0.0f), vec4(0.0f), vec4(0.0f));
   }
   barrier();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x4_f32/to_workgroup.wgsl.expected.msl b/test/tint/buffer/uniform/std140/unnested/mat3x4_f32/to_workgroup.wgsl.expected.msl
index b854900..9eb2bd2 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x4_f32/to_workgroup.wgsl.expected.msl
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x4_f32/to_workgroup.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float3x4* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = float3x4(float4(0.0f), float4(0.0f), float4(0.0f));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/buffer/uniform/std140/unnested/mat3x4_f32/to_workgroup.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/unnested/mat3x4_f32/to_workgroup.wgsl.expected.spvasm
index 783e5c2..0b72b46 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat3x4_f32/to_workgroup.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/unnested/mat3x4_f32/to_workgroup.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 51
+; Bound: 56
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -38,7 +38,9 @@
           %w = OpVariable %_ptr_Workgroup_mat3v4float Workgroup
        %void = OpTypeVoid
          %12 = OpTypeFunction %void %uint
-         %17 = OpConstantNull %mat3v4float
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %22 = OpConstantNull %mat3v4float
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
      %uint_0 = OpConstant %uint 0
@@ -46,43 +48,49 @@
         %int = OpTypeInt 32 1
       %int_1 = OpConstant %int 1
 %_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float
-         %33 = OpConstantNull %int
+         %38 = OpConstantNull %int
 %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
 %_ptr_Workgroup_float = OpTypePointer Workgroup %float
 %_ptr_Uniform_float = OpTypePointer Uniform %float
-         %46 = OpTypeFunction %void
+         %51 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %12
   %local_idx = OpFunctionParameter %uint
          %16 = OpLabel
-               OpStore %w %17
+         %18 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %20 None
+               OpBranchConditional %18 %21 %20
+         %21 = OpLabel
+               OpStore %w %22
+               OpBranch %20
+         %20 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
     %f_inner = OpFunction %void None %12
 %local_invocation_index = OpFunctionParameter %uint
-         %23 = OpLabel
-         %24 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %27 = OpAccessChain %_ptr_Uniform_mat3v4float %u %uint_0
-         %28 = OpLoad %mat3v4float %27
-               OpStore %w %28
-         %32 = OpAccessChain %_ptr_Workgroup_v4float %w %int_1
-         %35 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %33
-         %36 = OpLoad %v4float %35
-               OpStore %32 %36
+         %28 = OpLabel
+         %29 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %32 = OpAccessChain %_ptr_Uniform_mat3v4float %u %uint_0
+         %33 = OpLoad %mat3v4float %32
+               OpStore %w %33
          %37 = OpAccessChain %_ptr_Workgroup_v4float %w %int_1
-         %38 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %33
-         %39 = OpLoad %v4float %38
-         %40 = OpVectorShuffle %v4float %39 %39 1 3 0 2
-               OpStore %37 %40
-         %42 = OpAccessChain %_ptr_Workgroup_float %w %33 %int_1
-         %44 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %int_1 %33
-         %45 = OpLoad %float %44
+         %40 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %38
+         %41 = OpLoad %v4float %40
+               OpStore %37 %41
+         %42 = OpAccessChain %_ptr_Workgroup_v4float %w %int_1
+         %43 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %38
+         %44 = OpLoad %v4float %43
+         %45 = OpVectorShuffle %v4float %44 %44 1 3 0 2
                OpStore %42 %45
+         %47 = OpAccessChain %_ptr_Workgroup_float %w %38 %int_1
+         %49 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %int_1 %38
+         %50 = OpLoad %float %49
+               OpStore %47 %50
                OpReturn
                OpFunctionEnd
-          %f = OpFunction %void None %46
-         %48 = OpLabel
-         %50 = OpLoad %uint %local_invocation_index_1
-         %49 = OpFunctionCall %void %f_inner %50
+          %f = OpFunction %void None %51
+         %53 = OpLabel
+         %55 = OpLoad %uint %local_invocation_index_1
+         %54 = OpFunctionCall %void %f_inner %55
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x2_f16/to_workgroup.wgsl.expected.dxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat4x2_f16/to_workgroup.wgsl.expected.dxc.hlsl
index bfffd18..9055009 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x2_f16/to_workgroup.wgsl.expected.dxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x2_f16/to_workgroup.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared matrix<float16_t, 4, 2> w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = matrix<float16_t, 4, 2>((float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx, (float16_t(0.0h)).xx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x2_f16/to_workgroup.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/unnested/mat4x2_f16/to_workgroup.wgsl.expected.glsl
index 01ca06b..96ddb6e 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x2_f16/to_workgroup.wgsl.expected.glsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x2_f16/to_workgroup.wgsl.expected.glsl
@@ -3,7 +3,7 @@
 
 shared f16mat4x2 w;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = f16mat4x2(f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf), f16vec2(0.0hf));
   }
   barrier();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x2_f16/to_workgroup.wgsl.expected.msl b/test/tint/buffer/uniform/std140/unnested/mat4x2_f16/to_workgroup.wgsl.expected.msl
index 9c2cefb..9d42d8d 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x2_f16/to_workgroup.wgsl.expected.msl
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x2_f16/to_workgroup.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup half4x2* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = half4x2(half2(0.0h), half2(0.0h), half2(0.0h), half2(0.0h));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x2_f16/to_workgroup.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/unnested/mat4x2_f16/to_workgroup.wgsl.expected.spvasm
index 99c9b87..51cde74 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x2_f16/to_workgroup.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x2_f16/to_workgroup.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 69
+; Bound: 73
 ; Schema: 0
                OpCapability Shader
                OpCapability Float16
@@ -46,66 +46,73 @@
           %w = OpVariable %_ptr_Workgroup_mat4v2half Workgroup
        %void = OpTypeVoid
          %12 = OpTypeFunction %void %uint
-         %17 = OpConstantNull %mat4v2half
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %22 = OpConstantNull %mat4v2half
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %mat4v2half
+         %26 = OpTypeFunction %mat4v2half
      %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_v2half = OpTypePointer Uniform %v2half
-     %uint_1 = OpConstant %uint 1
      %uint_3 = OpConstant %uint 3
         %int = OpTypeInt 32 1
       %int_1 = OpConstant %int 1
 %_ptr_Workgroup_v2half = OpTypePointer Workgroup %v2half
-         %57 = OpConstantNull %int
+         %61 = OpConstantNull %int
 %_ptr_Workgroup_half = OpTypePointer Workgroup %half
-         %60 = OpConstantNull %uint
+         %64 = OpConstantNull %uint
 %_ptr_Uniform_half = OpTypePointer Uniform %half
-         %64 = OpTypeFunction %void
+         %68 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %12
   %local_idx = OpFunctionParameter %uint
          %16 = OpLabel
-               OpStore %w %17
+         %18 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %20 None
+               OpBranchConditional %18 %21 %20
+         %21 = OpLabel
+               OpStore %w %22
+               OpBranch %20
+         %20 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%load_u_inner = OpFunction %mat4v2half None %21
-         %23 = OpLabel
-         %28 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0
-         %29 = OpLoad %v2half %28
-         %32 = OpAccessChain %_ptr_Uniform_v2half %u %uint_1
-         %33 = OpLoad %v2half %32
-         %35 = OpAccessChain %_ptr_Uniform_v2half %u %uint_2
-         %36 = OpLoad %v2half %35
-         %39 = OpAccessChain %_ptr_Uniform_v2half %u %uint_3
+%load_u_inner = OpFunction %mat4v2half None %26
+         %28 = OpLabel
+         %33 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0
+         %34 = OpLoad %v2half %33
+         %36 = OpAccessChain %_ptr_Uniform_v2half %u %uint_1
+         %37 = OpLoad %v2half %36
+         %39 = OpAccessChain %_ptr_Uniform_v2half %u %uint_2
          %40 = OpLoad %v2half %39
-         %41 = OpCompositeConstruct %mat4v2half %29 %33 %36 %40
-               OpReturnValue %41
+         %43 = OpAccessChain %_ptr_Uniform_v2half %u %uint_3
+         %44 = OpLoad %v2half %43
+         %45 = OpCompositeConstruct %mat4v2half %34 %37 %40 %44
+               OpReturnValue %45
                OpFunctionEnd
     %f_inner = OpFunction %void None %12
 %local_invocation_index = OpFunctionParameter %uint
-         %44 = OpLabel
-         %45 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %46 = OpFunctionCall %mat4v2half %load_u_inner
-               OpStore %w %46
-         %50 = OpAccessChain %_ptr_Workgroup_v2half %w %int_1
-         %51 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0
-         %52 = OpLoad %v2half %51
-               OpStore %50 %52
-         %53 = OpAccessChain %_ptr_Workgroup_v2half %w %int_1
-         %54 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0
-         %55 = OpLoad %v2half %54
-         %56 = OpVectorShuffle %v2half %55 %55 1 0
-               OpStore %53 %56
-         %59 = OpAccessChain %_ptr_Workgroup_half %w %57 %int_1
-         %62 = OpAccessChain %_ptr_Uniform_half %u %uint_1 %60
-         %63 = OpLoad %half %62
-               OpStore %59 %63
+         %48 = OpLabel
+         %49 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %50 = OpFunctionCall %mat4v2half %load_u_inner
+               OpStore %w %50
+         %54 = OpAccessChain %_ptr_Workgroup_v2half %w %int_1
+         %55 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0
+         %56 = OpLoad %v2half %55
+               OpStore %54 %56
+         %57 = OpAccessChain %_ptr_Workgroup_v2half %w %int_1
+         %58 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0
+         %59 = OpLoad %v2half %58
+         %60 = OpVectorShuffle %v2half %59 %59 1 0
+               OpStore %57 %60
+         %63 = OpAccessChain %_ptr_Workgroup_half %w %61 %int_1
+         %66 = OpAccessChain %_ptr_Uniform_half %u %uint_1 %64
+         %67 = OpLoad %half %66
+               OpStore %63 %67
                OpReturn
                OpFunctionEnd
-          %f = OpFunction %void None %64
-         %66 = OpLabel
-         %68 = OpLoad %uint %local_invocation_index_1
-         %67 = OpFunctionCall %void %f_inner %68
+          %f = OpFunction %void None %68
+         %70 = OpLabel
+         %72 = OpLoad %uint %local_invocation_index_1
+         %71 = OpFunctionCall %void %f_inner %72
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x2_f32/to_workgroup.wgsl.expected.dxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat4x2_f32/to_workgroup.wgsl.expected.dxc.hlsl
index f92af58..c26b523 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x2_f32/to_workgroup.wgsl.expected.dxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x2_f32/to_workgroup.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float4x2 w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x2_f32/to_workgroup.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat4x2_f32/to_workgroup.wgsl.expected.fxc.hlsl
index f92af58..c26b523 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x2_f32/to_workgroup.wgsl.expected.fxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x2_f32/to_workgroup.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float4x2 w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x2_f32/to_workgroup.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/unnested/mat4x2_f32/to_workgroup.wgsl.expected.glsl
index dcdf1ca..32177a2 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x2_f32/to_workgroup.wgsl.expected.glsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x2_f32/to_workgroup.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared mat4x2 w;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = mat4x2(vec2(0.0f), vec2(0.0f), vec2(0.0f), vec2(0.0f));
   }
   barrier();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x2_f32/to_workgroup.wgsl.expected.msl b/test/tint/buffer/uniform/std140/unnested/mat4x2_f32/to_workgroup.wgsl.expected.msl
index 30c4102..78f447b 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x2_f32/to_workgroup.wgsl.expected.msl
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x2_f32/to_workgroup.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float4x2* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = float4x2(float2(0.0f), float2(0.0f), float2(0.0f), float2(0.0f));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x2_f32/to_workgroup.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/unnested/mat4x2_f32/to_workgroup.wgsl.expected.spvasm
index defd9d7..f8856ed 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x2_f32/to_workgroup.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x2_f32/to_workgroup.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 69
+; Bound: 73
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -43,66 +43,73 @@
           %w = OpVariable %_ptr_Workgroup_mat4v2float Workgroup
        %void = OpTypeVoid
          %12 = OpTypeFunction %void %uint
-         %17 = OpConstantNull %mat4v2float
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %22 = OpConstantNull %mat4v2float
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %mat4v2float
+         %26 = OpTypeFunction %mat4v2float
      %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
-     %uint_1 = OpConstant %uint 1
      %uint_3 = OpConstant %uint 3
         %int = OpTypeInt 32 1
       %int_1 = OpConstant %int 1
 %_ptr_Workgroup_v2float = OpTypePointer Workgroup %v2float
-         %57 = OpConstantNull %int
+         %61 = OpConstantNull %int
 %_ptr_Workgroup_float = OpTypePointer Workgroup %float
-         %60 = OpConstantNull %uint
+         %64 = OpConstantNull %uint
 %_ptr_Uniform_float = OpTypePointer Uniform %float
-         %64 = OpTypeFunction %void
+         %68 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %12
   %local_idx = OpFunctionParameter %uint
          %16 = OpLabel
-               OpStore %w %17
+         %18 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %20 None
+               OpBranchConditional %18 %21 %20
+         %21 = OpLabel
+               OpStore %w %22
+               OpBranch %20
+         %20 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%load_u_inner = OpFunction %mat4v2float None %21
-         %23 = OpLabel
-         %28 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0
-         %29 = OpLoad %v2float %28
-         %32 = OpAccessChain %_ptr_Uniform_v2float %u %uint_1
-         %33 = OpLoad %v2float %32
-         %35 = OpAccessChain %_ptr_Uniform_v2float %u %uint_2
-         %36 = OpLoad %v2float %35
-         %39 = OpAccessChain %_ptr_Uniform_v2float %u %uint_3
+%load_u_inner = OpFunction %mat4v2float None %26
+         %28 = OpLabel
+         %33 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0
+         %34 = OpLoad %v2float %33
+         %36 = OpAccessChain %_ptr_Uniform_v2float %u %uint_1
+         %37 = OpLoad %v2float %36
+         %39 = OpAccessChain %_ptr_Uniform_v2float %u %uint_2
          %40 = OpLoad %v2float %39
-         %41 = OpCompositeConstruct %mat4v2float %29 %33 %36 %40
-               OpReturnValue %41
+         %43 = OpAccessChain %_ptr_Uniform_v2float %u %uint_3
+         %44 = OpLoad %v2float %43
+         %45 = OpCompositeConstruct %mat4v2float %34 %37 %40 %44
+               OpReturnValue %45
                OpFunctionEnd
     %f_inner = OpFunction %void None %12
 %local_invocation_index = OpFunctionParameter %uint
-         %44 = OpLabel
-         %45 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %46 = OpFunctionCall %mat4v2float %load_u_inner
-               OpStore %w %46
-         %50 = OpAccessChain %_ptr_Workgroup_v2float %w %int_1
-         %51 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0
-         %52 = OpLoad %v2float %51
-               OpStore %50 %52
-         %53 = OpAccessChain %_ptr_Workgroup_v2float %w %int_1
-         %54 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0
-         %55 = OpLoad %v2float %54
-         %56 = OpVectorShuffle %v2float %55 %55 1 0
-               OpStore %53 %56
-         %59 = OpAccessChain %_ptr_Workgroup_float %w %57 %int_1
-         %62 = OpAccessChain %_ptr_Uniform_float %u %uint_1 %60
-         %63 = OpLoad %float %62
-               OpStore %59 %63
+         %48 = OpLabel
+         %49 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %50 = OpFunctionCall %mat4v2float %load_u_inner
+               OpStore %w %50
+         %54 = OpAccessChain %_ptr_Workgroup_v2float %w %int_1
+         %55 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0
+         %56 = OpLoad %v2float %55
+               OpStore %54 %56
+         %57 = OpAccessChain %_ptr_Workgroup_v2float %w %int_1
+         %58 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0
+         %59 = OpLoad %v2float %58
+         %60 = OpVectorShuffle %v2float %59 %59 1 0
+               OpStore %57 %60
+         %63 = OpAccessChain %_ptr_Workgroup_float %w %61 %int_1
+         %66 = OpAccessChain %_ptr_Uniform_float %u %uint_1 %64
+         %67 = OpLoad %float %66
+               OpStore %63 %67
                OpReturn
                OpFunctionEnd
-          %f = OpFunction %void None %64
-         %66 = OpLabel
-         %68 = OpLoad %uint %local_invocation_index_1
-         %67 = OpFunctionCall %void %f_inner %68
+          %f = OpFunction %void None %68
+         %70 = OpLabel
+         %72 = OpLoad %uint %local_invocation_index_1
+         %71 = OpFunctionCall %void %f_inner %72
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x3_f16/to_workgroup.wgsl.expected.dxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat4x3_f16/to_workgroup.wgsl.expected.dxc.hlsl
index cc1ea4f..48933e7 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x3_f16/to_workgroup.wgsl.expected.dxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x3_f16/to_workgroup.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared matrix<float16_t, 4, 3> w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = matrix<float16_t, 4, 3>((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x3_f16/to_workgroup.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/unnested/mat4x3_f16/to_workgroup.wgsl.expected.glsl
index eb453c5..37155ab 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x3_f16/to_workgroup.wgsl.expected.glsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x3_f16/to_workgroup.wgsl.expected.glsl
@@ -3,7 +3,7 @@
 
 shared f16mat4x3 w;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = f16mat4x3(f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf), f16vec3(0.0hf));
   }
   barrier();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x3_f16/to_workgroup.wgsl.expected.msl b/test/tint/buffer/uniform/std140/unnested/mat4x3_f16/to_workgroup.wgsl.expected.msl
index 3b60cb2..858ab01 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x3_f16/to_workgroup.wgsl.expected.msl
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x3_f16/to_workgroup.wgsl.expected.msl
@@ -29,7 +29,7 @@
 }
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup half4x3* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = half4x3(half3(0.0h), half3(0.0h), half3(0.0h), half3(0.0h));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x3_f16/to_workgroup.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/unnested/mat4x3_f16/to_workgroup.wgsl.expected.spvasm
index 90c1b4e..0d306db 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x3_f16/to_workgroup.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x3_f16/to_workgroup.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 69
+; Bound: 73
 ; Schema: 0
                OpCapability Shader
                OpCapability Float16
@@ -46,66 +46,73 @@
           %w = OpVariable %_ptr_Workgroup_mat4v3half Workgroup
        %void = OpTypeVoid
          %12 = OpTypeFunction %void %uint
-         %17 = OpConstantNull %mat4v3half
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %22 = OpConstantNull %mat4v3half
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %mat4v3half
+         %26 = OpTypeFunction %mat4v3half
      %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_v3half = OpTypePointer Uniform %v3half
-     %uint_1 = OpConstant %uint 1
      %uint_3 = OpConstant %uint 3
         %int = OpTypeInt 32 1
       %int_1 = OpConstant %int 1
 %_ptr_Workgroup_v3half = OpTypePointer Workgroup %v3half
-         %57 = OpConstantNull %int
+         %61 = OpConstantNull %int
 %_ptr_Workgroup_half = OpTypePointer Workgroup %half
-         %60 = OpConstantNull %uint
+         %64 = OpConstantNull %uint
 %_ptr_Uniform_half = OpTypePointer Uniform %half
-         %64 = OpTypeFunction %void
+         %68 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %12
   %local_idx = OpFunctionParameter %uint
          %16 = OpLabel
-               OpStore %w %17
+         %18 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %20 None
+               OpBranchConditional %18 %21 %20
+         %21 = OpLabel
+               OpStore %w %22
+               OpBranch %20
+         %20 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%load_u_inner = OpFunction %mat4v3half None %21
-         %23 = OpLabel
-         %28 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0
-         %29 = OpLoad %v3half %28
-         %32 = OpAccessChain %_ptr_Uniform_v3half %u %uint_1
-         %33 = OpLoad %v3half %32
-         %35 = OpAccessChain %_ptr_Uniform_v3half %u %uint_2
-         %36 = OpLoad %v3half %35
-         %39 = OpAccessChain %_ptr_Uniform_v3half %u %uint_3
+%load_u_inner = OpFunction %mat4v3half None %26
+         %28 = OpLabel
+         %33 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0
+         %34 = OpLoad %v3half %33
+         %36 = OpAccessChain %_ptr_Uniform_v3half %u %uint_1
+         %37 = OpLoad %v3half %36
+         %39 = OpAccessChain %_ptr_Uniform_v3half %u %uint_2
          %40 = OpLoad %v3half %39
-         %41 = OpCompositeConstruct %mat4v3half %29 %33 %36 %40
-               OpReturnValue %41
+         %43 = OpAccessChain %_ptr_Uniform_v3half %u %uint_3
+         %44 = OpLoad %v3half %43
+         %45 = OpCompositeConstruct %mat4v3half %34 %37 %40 %44
+               OpReturnValue %45
                OpFunctionEnd
     %f_inner = OpFunction %void None %12
 %local_invocation_index = OpFunctionParameter %uint
-         %44 = OpLabel
-         %45 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %46 = OpFunctionCall %mat4v3half %load_u_inner
-               OpStore %w %46
-         %50 = OpAccessChain %_ptr_Workgroup_v3half %w %int_1
-         %51 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0
-         %52 = OpLoad %v3half %51
-               OpStore %50 %52
-         %53 = OpAccessChain %_ptr_Workgroup_v3half %w %int_1
-         %54 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0
-         %55 = OpLoad %v3half %54
-         %56 = OpVectorShuffle %v3half %55 %55 2 0 1
-               OpStore %53 %56
-         %59 = OpAccessChain %_ptr_Workgroup_half %w %57 %int_1
-         %62 = OpAccessChain %_ptr_Uniform_half %u %uint_1 %60
-         %63 = OpLoad %half %62
-               OpStore %59 %63
+         %48 = OpLabel
+         %49 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %50 = OpFunctionCall %mat4v3half %load_u_inner
+               OpStore %w %50
+         %54 = OpAccessChain %_ptr_Workgroup_v3half %w %int_1
+         %55 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0
+         %56 = OpLoad %v3half %55
+               OpStore %54 %56
+         %57 = OpAccessChain %_ptr_Workgroup_v3half %w %int_1
+         %58 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0
+         %59 = OpLoad %v3half %58
+         %60 = OpVectorShuffle %v3half %59 %59 2 0 1
+               OpStore %57 %60
+         %63 = OpAccessChain %_ptr_Workgroup_half %w %61 %int_1
+         %66 = OpAccessChain %_ptr_Uniform_half %u %uint_1 %64
+         %67 = OpLoad %half %66
+               OpStore %63 %67
                OpReturn
                OpFunctionEnd
-          %f = OpFunction %void None %64
-         %66 = OpLabel
-         %68 = OpLoad %uint %local_invocation_index_1
-         %67 = OpFunctionCall %void %f_inner %68
+          %f = OpFunction %void None %68
+         %70 = OpLabel
+         %72 = OpLoad %uint %local_invocation_index_1
+         %71 = OpFunctionCall %void %f_inner %72
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x3_f32/to_workgroup.wgsl.expected.dxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat4x3_f32/to_workgroup.wgsl.expected.dxc.hlsl
index abe1e3a..950278a 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x3_f32/to_workgroup.wgsl.expected.dxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x3_f32/to_workgroup.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float4x3 w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x3_f32/to_workgroup.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat4x3_f32/to_workgroup.wgsl.expected.fxc.hlsl
index abe1e3a..950278a 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x3_f32/to_workgroup.wgsl.expected.fxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x3_f32/to_workgroup.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float4x3 w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x3_f32/to_workgroup.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/unnested/mat4x3_f32/to_workgroup.wgsl.expected.glsl
index ba6d646..079a082 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x3_f32/to_workgroup.wgsl.expected.glsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x3_f32/to_workgroup.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared mat4x3 w;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = mat4x3(vec3(0.0f), vec3(0.0f), vec3(0.0f), vec3(0.0f));
   }
   barrier();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x3_f32/to_workgroup.wgsl.expected.msl b/test/tint/buffer/uniform/std140/unnested/mat4x3_f32/to_workgroup.wgsl.expected.msl
index 8201d22..37e9465 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x3_f32/to_workgroup.wgsl.expected.msl
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x3_f32/to_workgroup.wgsl.expected.msl
@@ -29,7 +29,7 @@
 }
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float4x3* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = float4x3(float3(0.0f), float3(0.0f), float3(0.0f), float3(0.0f));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x3_f32/to_workgroup.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/unnested/mat4x3_f32/to_workgroup.wgsl.expected.spvasm
index 1b409c5..59323e5 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x3_f32/to_workgroup.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x3_f32/to_workgroup.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 51
+; Bound: 56
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -38,7 +38,9 @@
           %w = OpVariable %_ptr_Workgroup_mat4v3float Workgroup
        %void = OpTypeVoid
          %12 = OpTypeFunction %void %uint
-         %17 = OpConstantNull %mat4v3float
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %22 = OpConstantNull %mat4v3float
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
      %uint_0 = OpConstant %uint 0
@@ -46,43 +48,49 @@
         %int = OpTypeInt 32 1
       %int_1 = OpConstant %int 1
 %_ptr_Workgroup_v3float = OpTypePointer Workgroup %v3float
-         %33 = OpConstantNull %int
+         %38 = OpConstantNull %int
 %_ptr_Uniform_v3float = OpTypePointer Uniform %v3float
 %_ptr_Workgroup_float = OpTypePointer Workgroup %float
 %_ptr_Uniform_float = OpTypePointer Uniform %float
-         %46 = OpTypeFunction %void
+         %51 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %12
   %local_idx = OpFunctionParameter %uint
          %16 = OpLabel
-               OpStore %w %17
+         %18 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %20 None
+               OpBranchConditional %18 %21 %20
+         %21 = OpLabel
+               OpStore %w %22
+               OpBranch %20
+         %20 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
     %f_inner = OpFunction %void None %12
 %local_invocation_index = OpFunctionParameter %uint
-         %23 = OpLabel
-         %24 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %27 = OpAccessChain %_ptr_Uniform_mat4v3float %u %uint_0
-         %28 = OpLoad %mat4v3float %27
-               OpStore %w %28
-         %32 = OpAccessChain %_ptr_Workgroup_v3float %w %int_1
-         %35 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %33
-         %36 = OpLoad %v3float %35
-               OpStore %32 %36
+         %28 = OpLabel
+         %29 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %32 = OpAccessChain %_ptr_Uniform_mat4v3float %u %uint_0
+         %33 = OpLoad %mat4v3float %32
+               OpStore %w %33
          %37 = OpAccessChain %_ptr_Workgroup_v3float %w %int_1
-         %38 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %33
-         %39 = OpLoad %v3float %38
-         %40 = OpVectorShuffle %v3float %39 %39 2 0 1
-               OpStore %37 %40
-         %42 = OpAccessChain %_ptr_Workgroup_float %w %33 %int_1
-         %44 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %int_1 %33
-         %45 = OpLoad %float %44
+         %40 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %38
+         %41 = OpLoad %v3float %40
+               OpStore %37 %41
+         %42 = OpAccessChain %_ptr_Workgroup_v3float %w %int_1
+         %43 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %38
+         %44 = OpLoad %v3float %43
+         %45 = OpVectorShuffle %v3float %44 %44 2 0 1
                OpStore %42 %45
+         %47 = OpAccessChain %_ptr_Workgroup_float %w %38 %int_1
+         %49 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %int_1 %38
+         %50 = OpLoad %float %49
+               OpStore %47 %50
                OpReturn
                OpFunctionEnd
-          %f = OpFunction %void None %46
-         %48 = OpLabel
-         %50 = OpLoad %uint %local_invocation_index_1
-         %49 = OpFunctionCall %void %f_inner %50
+          %f = OpFunction %void None %51
+         %53 = OpLabel
+         %55 = OpLoad %uint %local_invocation_index_1
+         %54 = OpFunctionCall %void %f_inner %55
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x4_f16/to_workgroup.wgsl.expected.dxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat4x4_f16/to_workgroup.wgsl.expected.dxc.hlsl
index 61509fd..c89f4da 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x4_f16/to_workgroup.wgsl.expected.dxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x4_f16/to_workgroup.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared matrix<float16_t, 4, 4> w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = matrix<float16_t, 4, 4>((float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx, (float16_t(0.0h)).xxxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x4_f16/to_workgroup.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/unnested/mat4x4_f16/to_workgroup.wgsl.expected.glsl
index 58ebc03..981dea0 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x4_f16/to_workgroup.wgsl.expected.glsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x4_f16/to_workgroup.wgsl.expected.glsl
@@ -3,7 +3,7 @@
 
 shared f16mat4 w;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = f16mat4(f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf), f16vec4(0.0hf));
   }
   barrier();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x4_f16/to_workgroup.wgsl.expected.msl b/test/tint/buffer/uniform/std140/unnested/mat4x4_f16/to_workgroup.wgsl.expected.msl
index 635f912..3ea1b4d 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x4_f16/to_workgroup.wgsl.expected.msl
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x4_f16/to_workgroup.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup half4x4* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = half4x4(half4(0.0h), half4(0.0h), half4(0.0h), half4(0.0h));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x4_f16/to_workgroup.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/unnested/mat4x4_f16/to_workgroup.wgsl.expected.spvasm
index 6190370..62981fb 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x4_f16/to_workgroup.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x4_f16/to_workgroup.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 69
+; Bound: 73
 ; Schema: 0
                OpCapability Shader
                OpCapability Float16
@@ -46,66 +46,73 @@
           %w = OpVariable %_ptr_Workgroup_mat4v4half Workgroup
        %void = OpTypeVoid
          %12 = OpTypeFunction %void %uint
-         %17 = OpConstantNull %mat4v4half
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %22 = OpConstantNull %mat4v4half
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %mat4v4half
+         %26 = OpTypeFunction %mat4v4half
      %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_v4half = OpTypePointer Uniform %v4half
-     %uint_1 = OpConstant %uint 1
      %uint_3 = OpConstant %uint 3
         %int = OpTypeInt 32 1
       %int_1 = OpConstant %int 1
 %_ptr_Workgroup_v4half = OpTypePointer Workgroup %v4half
-         %57 = OpConstantNull %int
+         %61 = OpConstantNull %int
 %_ptr_Workgroup_half = OpTypePointer Workgroup %half
-         %60 = OpConstantNull %uint
+         %64 = OpConstantNull %uint
 %_ptr_Uniform_half = OpTypePointer Uniform %half
-         %64 = OpTypeFunction %void
+         %68 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %12
   %local_idx = OpFunctionParameter %uint
          %16 = OpLabel
-               OpStore %w %17
+         %18 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %20 None
+               OpBranchConditional %18 %21 %20
+         %21 = OpLabel
+               OpStore %w %22
+               OpBranch %20
+         %20 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%load_u_inner = OpFunction %mat4v4half None %21
-         %23 = OpLabel
-         %28 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0
-         %29 = OpLoad %v4half %28
-         %32 = OpAccessChain %_ptr_Uniform_v4half %u %uint_1
-         %33 = OpLoad %v4half %32
-         %35 = OpAccessChain %_ptr_Uniform_v4half %u %uint_2
-         %36 = OpLoad %v4half %35
-         %39 = OpAccessChain %_ptr_Uniform_v4half %u %uint_3
+%load_u_inner = OpFunction %mat4v4half None %26
+         %28 = OpLabel
+         %33 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0
+         %34 = OpLoad %v4half %33
+         %36 = OpAccessChain %_ptr_Uniform_v4half %u %uint_1
+         %37 = OpLoad %v4half %36
+         %39 = OpAccessChain %_ptr_Uniform_v4half %u %uint_2
          %40 = OpLoad %v4half %39
-         %41 = OpCompositeConstruct %mat4v4half %29 %33 %36 %40
-               OpReturnValue %41
+         %43 = OpAccessChain %_ptr_Uniform_v4half %u %uint_3
+         %44 = OpLoad %v4half %43
+         %45 = OpCompositeConstruct %mat4v4half %34 %37 %40 %44
+               OpReturnValue %45
                OpFunctionEnd
     %f_inner = OpFunction %void None %12
 %local_invocation_index = OpFunctionParameter %uint
-         %44 = OpLabel
-         %45 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %46 = OpFunctionCall %mat4v4half %load_u_inner
-               OpStore %w %46
-         %50 = OpAccessChain %_ptr_Workgroup_v4half %w %int_1
-         %51 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0
-         %52 = OpLoad %v4half %51
-               OpStore %50 %52
-         %53 = OpAccessChain %_ptr_Workgroup_v4half %w %int_1
-         %54 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0
-         %55 = OpLoad %v4half %54
-         %56 = OpVectorShuffle %v4half %55 %55 1 3 0 2
-               OpStore %53 %56
-         %59 = OpAccessChain %_ptr_Workgroup_half %w %57 %int_1
-         %62 = OpAccessChain %_ptr_Uniform_half %u %uint_1 %60
-         %63 = OpLoad %half %62
-               OpStore %59 %63
+         %48 = OpLabel
+         %49 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %50 = OpFunctionCall %mat4v4half %load_u_inner
+               OpStore %w %50
+         %54 = OpAccessChain %_ptr_Workgroup_v4half %w %int_1
+         %55 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0
+         %56 = OpLoad %v4half %55
+               OpStore %54 %56
+         %57 = OpAccessChain %_ptr_Workgroup_v4half %w %int_1
+         %58 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0
+         %59 = OpLoad %v4half %58
+         %60 = OpVectorShuffle %v4half %59 %59 1 3 0 2
+               OpStore %57 %60
+         %63 = OpAccessChain %_ptr_Workgroup_half %w %61 %int_1
+         %66 = OpAccessChain %_ptr_Uniform_half %u %uint_1 %64
+         %67 = OpLoad %half %66
+               OpStore %63 %67
                OpReturn
                OpFunctionEnd
-          %f = OpFunction %void None %64
-         %66 = OpLabel
-         %68 = OpLoad %uint %local_invocation_index_1
-         %67 = OpFunctionCall %void %f_inner %68
+          %f = OpFunction %void None %68
+         %70 = OpLabel
+         %72 = OpLoad %uint %local_invocation_index_1
+         %71 = OpFunctionCall %void %f_inner %72
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x4_f32/to_workgroup.wgsl.expected.dxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat4x4_f32/to_workgroup.wgsl.expected.dxc.hlsl
index c6d3085..246cf16 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x4_f32/to_workgroup.wgsl.expected.dxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x4_f32/to_workgroup.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float4x4 w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x4_f32/to_workgroup.wgsl.expected.fxc.hlsl b/test/tint/buffer/uniform/std140/unnested/mat4x4_f32/to_workgroup.wgsl.expected.fxc.hlsl
index c6d3085..246cf16 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x4_f32/to_workgroup.wgsl.expected.fxc.hlsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x4_f32/to_workgroup.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float4x4 w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x4_f32/to_workgroup.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/unnested/mat4x4_f32/to_workgroup.wgsl.expected.glsl
index 33dff54..2be9e2d 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x4_f32/to_workgroup.wgsl.expected.glsl
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x4_f32/to_workgroup.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared mat4 w;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f));
   }
   barrier();
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x4_f32/to_workgroup.wgsl.expected.msl b/test/tint/buffer/uniform/std140/unnested/mat4x4_f32/to_workgroup.wgsl.expected.msl
index f9a6bf7..992723b 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x4_f32/to_workgroup.wgsl.expected.msl
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x4_f32/to_workgroup.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float4x4* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/buffer/uniform/std140/unnested/mat4x4_f32/to_workgroup.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/unnested/mat4x4_f32/to_workgroup.wgsl.expected.spvasm
index 78319f9..8c6fbe7 100644
--- a/test/tint/buffer/uniform/std140/unnested/mat4x4_f32/to_workgroup.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/unnested/mat4x4_f32/to_workgroup.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 51
+; Bound: 56
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -38,7 +38,9 @@
           %w = OpVariable %_ptr_Workgroup_mat4v4float Workgroup
        %void = OpTypeVoid
          %12 = OpTypeFunction %void %uint
-         %17 = OpConstantNull %mat4v4float
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %22 = OpConstantNull %mat4v4float
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
      %uint_0 = OpConstant %uint 0
@@ -46,43 +48,49 @@
         %int = OpTypeInt 32 1
       %int_1 = OpConstant %int 1
 %_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float
-         %33 = OpConstantNull %int
+         %38 = OpConstantNull %int
 %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
 %_ptr_Workgroup_float = OpTypePointer Workgroup %float
 %_ptr_Uniform_float = OpTypePointer Uniform %float
-         %46 = OpTypeFunction %void
+         %51 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %12
   %local_idx = OpFunctionParameter %uint
          %16 = OpLabel
-               OpStore %w %17
+         %18 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %20 None
+               OpBranchConditional %18 %21 %20
+         %21 = OpLabel
+               OpStore %w %22
+               OpBranch %20
+         %20 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
     %f_inner = OpFunction %void None %12
 %local_invocation_index = OpFunctionParameter %uint
-         %23 = OpLabel
-         %24 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %27 = OpAccessChain %_ptr_Uniform_mat4v4float %u %uint_0
-         %28 = OpLoad %mat4v4float %27
-               OpStore %w %28
-         %32 = OpAccessChain %_ptr_Workgroup_v4float %w %int_1
-         %35 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %33
-         %36 = OpLoad %v4float %35
-               OpStore %32 %36
+         %28 = OpLabel
+         %29 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %32 = OpAccessChain %_ptr_Uniform_mat4v4float %u %uint_0
+         %33 = OpLoad %mat4v4float %32
+               OpStore %w %33
          %37 = OpAccessChain %_ptr_Workgroup_v4float %w %int_1
-         %38 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %33
-         %39 = OpLoad %v4float %38
-         %40 = OpVectorShuffle %v4float %39 %39 1 3 0 2
-               OpStore %37 %40
-         %42 = OpAccessChain %_ptr_Workgroup_float %w %33 %int_1
-         %44 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %int_1 %33
-         %45 = OpLoad %float %44
+         %40 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %38
+         %41 = OpLoad %v4float %40
+               OpStore %37 %41
+         %42 = OpAccessChain %_ptr_Workgroup_v4float %w %int_1
+         %43 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %38
+         %44 = OpLoad %v4float %43
+         %45 = OpVectorShuffle %v4float %44 %44 1 3 0 2
                OpStore %42 %45
+         %47 = OpAccessChain %_ptr_Workgroup_float %w %38 %int_1
+         %49 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %int_1 %38
+         %50 = OpLoad %float %49
+               OpStore %47 %50
                OpReturn
                OpFunctionEnd
-          %f = OpFunction %void None %46
-         %48 = OpLabel
-         %50 = OpLoad %uint %local_invocation_index_1
-         %49 = OpFunctionCall %void %f_inner %50
+          %f = OpFunction %void None %51
+         %53 = OpLabel
+         %55 = OpLoad %uint %local_invocation_index_1
+         %54 = OpFunctionCall %void %f_inner %55
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/bug/chromium/40943165.wgsl.expected.dxc.hlsl b/test/tint/bug/chromium/40943165.wgsl.expected.dxc.hlsl
index 024f466..9c1291a 100644
--- a/test/tint/bug/chromium/40943165.wgsl.expected.dxc.hlsl
+++ b/test/tint/bug/chromium/40943165.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float2x2 W;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     W = float2x2((0.0f).xx, (0.0f).xx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/bug/chromium/40943165.wgsl.expected.fxc.hlsl b/test/tint/bug/chromium/40943165.wgsl.expected.fxc.hlsl
index 024f466..9c1291a 100644
--- a/test/tint/bug/chromium/40943165.wgsl.expected.fxc.hlsl
+++ b/test/tint/bug/chromium/40943165.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float2x2 W;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     W = float2x2((0.0f).xx, (0.0f).xx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/bug/chromium/40943165.wgsl.expected.glsl b/test/tint/bug/chromium/40943165.wgsl.expected.glsl
index d5fc9b0..a43dc20 100644
--- a/test/tint/bug/chromium/40943165.wgsl.expected.glsl
+++ b/test/tint/bug/chromium/40943165.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared mat2 W;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     W = mat2(vec2(0.0f), vec2(0.0f));
   }
   barrier();
diff --git a/test/tint/bug/chromium/40943165.wgsl.expected.msl b/test/tint/bug/chromium/40943165.wgsl.expected.msl
index e15620c..0aceade 100644
--- a/test/tint/bug/chromium/40943165.wgsl.expected.msl
+++ b/test/tint/bug/chromium/40943165.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float2x2* const tint_symbol_1) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol_1) = float2x2(float2(0.0f), float2(0.0f));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/bug/chromium/40943165.wgsl.expected.spvasm b/test/tint/bug/chromium/40943165.wgsl.expected.spvasm
index 03ece6a..7f784f4 100644
--- a/test/tint/bug/chromium/40943165.wgsl.expected.spvasm
+++ b/test/tint/bug/chromium/40943165.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 39
+; Bound: 44
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -25,39 +25,47 @@
           %W = OpVariable %_ptr_Workgroup_mat2v2float Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
-         %14 = OpConstantNull %mat2v2float
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %19 = OpConstantNull %mat2v2float
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
         %int = OpTypeInt 32 1
-         %23 = OpConstantNull %int
+         %28 = OpConstantNull %int
 %_ptr_Workgroup_v2float = OpTypePointer Workgroup %v2float
-         %28 = OpConstantNull %float
+         %33 = OpConstantNull %float
 %_ptr_Function_v2float = OpTypePointer Function %v2float
-         %32 = OpConstantNull %v2float
-         %34 = OpTypeFunction %void
+         %37 = OpConstantNull %v2float
+         %39 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpStore %W %14
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpStore %W %19
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
     %F_inner = OpFunction %void None %9
      %mat2x2 = OpFunctionParameter %uint
-         %20 = OpLabel
-         %30 = OpVariable %_ptr_Function_v2float Function %32
-         %21 = OpFunctionCall %void %tint_zero_workgroup_memory %mat2x2
-         %25 = OpAccessChain %_ptr_Workgroup_v2float %W %23
-         %26 = OpAccessChain %_ptr_Workgroup_v2float %W %23
-         %27 = OpLoad %v2float %26
-         %33 = OpCompositeConstruct %v2float %28 %28
-         %29 = OpFAdd %v2float %27 %33
-               OpStore %25 %29
+         %25 = OpLabel
+         %35 = OpVariable %_ptr_Function_v2float Function %37
+         %26 = OpFunctionCall %void %tint_zero_workgroup_memory %mat2x2
+         %30 = OpAccessChain %_ptr_Workgroup_v2float %W %28
+         %31 = OpAccessChain %_ptr_Workgroup_v2float %W %28
+         %32 = OpLoad %v2float %31
+         %38 = OpCompositeConstruct %v2float %33 %33
+         %34 = OpFAdd %v2float %32 %38
+               OpStore %30 %34
                OpReturn
                OpFunctionEnd
-          %F = OpFunction %void None %34
-         %36 = OpLabel
-         %38 = OpLoad %uint %mat2x2_1
-         %37 = OpFunctionCall %void %F_inner %38
+          %F = OpFunction %void None %39
+         %41 = OpLabel
+         %43 = OpLoad %uint %mat2x2_1
+         %42 = OpFunctionCall %void %F_inner %43
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/bug/tint/2063.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/2063.wgsl.expected.dxc.hlsl
index 9f5f7b1..919b0bb 100644
--- a/test/tint/bug/tint/2063.wgsl.expected.dxc.hlsl
+++ b/test/tint/bug/tint/2063.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/bug/tint/2063.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/2063.wgsl.expected.fxc.hlsl
index 9f5f7b1..919b0bb 100644
--- a/test/tint/bug/tint/2063.wgsl.expected.fxc.hlsl
+++ b/test/tint/bug/tint/2063.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/bug/tint/2063.wgsl.expected.glsl b/test/tint/bug/tint/2063.wgsl.expected.glsl
index f1ee5f1..a9c1f53 100644
--- a/test/tint/bug/tint/2063.wgsl.expected.glsl
+++ b/test/tint/bug/tint/2063.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/bug/tint/2063.wgsl.expected.msl b/test/tint/bug/tint/2063.wgsl.expected.msl
index cb7248c..6b4e30e 100644
--- a/test/tint/bug/tint/2063.wgsl.expected.msl
+++ b/test/tint/bug/tint/2063.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/bug/tint/2063.wgsl.expected.spvasm b/test/tint/bug/tint/2063.wgsl.expected.spvasm
index bdc5824..7267bde 100644
--- a/test/tint/bug/tint/2063.wgsl.expected.spvasm
+++ b/test/tint/bug/tint/2063.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 33
+; Bound: 38
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -24,32 +24,40 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
           %7 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %16 = OpConstantNull %int
+         %21 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
      %int_n1 = OpConstant %int -1
 %_ptr_Function_int = OpTypePointer Function %int
-         %28 = OpTypeFunction %void
+         %33 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %7
   %local_idx = OpFunctionParameter %uint
          %11 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %16
+         %13 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %15 None
+               OpBranchConditional %13 %16 %15
+         %16 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %21
+               OpBranch %15
+         %15 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %7
 %local_invocation_index = OpFunctionParameter %uint
-         %21 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %16
-         %22 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %23 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %int_n1
-               OpStore %res %23
+         %26 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %21
+         %27 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %28 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %int_n1
+               OpStore %res %28
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %28
-         %30 = OpLabel
-         %32 = OpLoad %uint %local_invocation_index_1
-         %31 = OpFunctionCall %void %compute_main_inner %32
+%compute_main = OpFunction %void None %33
+         %35 = OpLabel
+         %37 = OpLoad %uint %local_invocation_index_1
+         %36 = OpFunctionCall %void %compute_main_inner %37
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.dxc.hlsl
index 7c28541..bf8e778 100644
--- a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.dxc.hlsl
@@ -7,7 +7,7 @@
 groupshared S_atomic wg;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     uint atomic_result = 0u;
     InterlockedExchange(wg.a, 0u, atomic_result);
diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.fxc.hlsl
index 7c28541..bf8e778 100644
--- a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.fxc.hlsl
@@ -7,7 +7,7 @@
 groupshared S_atomic wg;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     uint atomic_result = 0u;
     InterlockedExchange(wg.a, 0u, atomic_result);
diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.glsl b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.glsl
index 6ed26d3..f5bf542 100644
--- a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.glsl
+++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.glsl
@@ -8,7 +8,7 @@
 
 shared S_atomic wg;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     atomicExchange(wg.a, 0u);
     atomicExchange(wg.b, 0u);
diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.msl b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.msl
index 9ca27b8..25e3e46 100644
--- a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.msl
+++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.msl
@@ -12,7 +12,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup S_atomic* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     (*(tint_symbol)).x = 0;
     atomic_store_explicit(&((*(tint_symbol)).a), 0u, memory_order_relaxed);
     atomic_store_explicit(&((*(tint_symbol)).b), 0u, memory_order_relaxed);
diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.spvasm b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.spvasm
index fb4b0ac..f3447de 100644
--- a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 62
+; Bound: 66
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -38,59 +38,66 @@
          %wg = OpVariable %_ptr_Workgroup_S_atomic Workgroup
        %void = OpTypeVoid
          %11 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_0 = OpConstant %uint 0
 %_ptr_Workgroup_int = OpTypePointer Workgroup %int
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
      %uint_2 = OpConstant %uint 2
-     %uint_1 = OpConstant %uint 1
 %_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
    %uint_264 = OpConstant %uint 264
-         %48 = OpTypeFunction %void
+         %52 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %11
   %local_idx = OpFunctionParameter %uint
          %15 = OpLabel
-         %18 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
-               OpStore %18 %19
-         %25 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
-               OpAtomicStore %25 %uint_2 %uint_0 %6
-         %28 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2
-               OpAtomicStore %28 %uint_2 %uint_0 %6
+         %17 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %19 None
+               OpBranchConditional %17 %20 %19
+         %20 = OpLabel
+         %23 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
+               OpStore %23 %24
+         %29 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
+               OpAtomicStore %29 %uint_2 %uint_0 %6
+         %32 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2
+               OpAtomicStore %32 %uint_2 %uint_0 %6
+               OpBranch %19
+         %19 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %11
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %33 = OpLabel
-         %34 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
-               OpStore %34 %19
-         %37 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
-               OpAtomicStore %37 %uint_2 %uint_0 %6
-         %40 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2
-               OpAtomicStore %40 %uint_2 %uint_0 %6
+         %37 = OpLabel
+         %38 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
+               OpStore %38 %24
+         %41 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
+               OpAtomicStore %41 %uint_2 %uint_0 %6
+         %44 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2
+               OpAtomicStore %44 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %44 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
-               OpAtomicStore %44 %uint_2 %uint_0 %uint_1
-         %47 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2
-               OpAtomicStore %47 %uint_2 %uint_0 %uint_2
+         %48 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
+               OpAtomicStore %48 %uint_2 %uint_0 %uint_1
+         %51 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2
+               OpAtomicStore %51 %uint_2 %uint_0 %uint_2
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %48
-         %50 = OpLabel
-         %51 = OpLoad %uint %local_invocation_index_1
-         %52 = OpFunctionCall %void %compute_main_inner %51
+%compute_main_1 = OpFunction %void None %52
+         %54 = OpLabel
+         %55 = OpLoad %uint %local_invocation_index_1
+         %56 = OpFunctionCall %void %compute_main_inner %55
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %11
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %55 = OpLabel
-         %56 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %59 = OpLabel
+         %60 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %57 = OpFunctionCall %void %compute_main_1
+         %61 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %48
-         %59 = OpLabel
-         %61 = OpLoad %uint %local_invocation_index_1_param_1
-         %60 = OpFunctionCall %void %compute_main_inner_1 %61
+%compute_main = OpFunction %void None %52
+         %63 = OpLabel
+         %65 = OpLoad %uint %local_invocation_index_1_param_1
+         %64 = OpFunctionCall %void %compute_main_inner_1 %65
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.dxc.hlsl b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.dxc.hlsl
index cff330a..cbbcd85 100644
--- a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.dxc.hlsl
@@ -7,7 +7,7 @@
 groupshared S wg;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     uint atomic_result = 0u;
     InterlockedExchange(wg.a, 0u, atomic_result);
diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.fxc.hlsl b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.fxc.hlsl
index cff330a..cbbcd85 100644
--- a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.fxc.hlsl
@@ -7,7 +7,7 @@
 groupshared S wg;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     uint atomic_result = 0u;
     InterlockedExchange(wg.a, 0u, atomic_result);
diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.glsl b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.glsl
index 73f634b..e58e0f5 100644
--- a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.glsl
+++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.glsl
@@ -8,7 +8,7 @@
 
 shared S wg;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     atomicExchange(wg.a, 0u);
     atomicExchange(wg.b, 0u);
diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.msl b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.msl
index f359c8f..b334290 100644
--- a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.msl
+++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.msl
@@ -8,7 +8,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup S* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     (*(tint_symbol)).x = 0;
     atomic_store_explicit(&((*(tint_symbol)).a), 0u, memory_order_relaxed);
     atomic_store_explicit(&((*(tint_symbol)).b), 0u, memory_order_relaxed);
diff --git a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.spvasm b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.spvasm
index 1444f07..2689b63 100644
--- a/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.spvasm
+++ b/test/tint/builtins/atomicStore/struct/flat_multiple_atomics.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 44
+; Bound: 48
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -31,40 +31,47 @@
          %wg = OpVariable %_ptr_Workgroup_S Workgroup
        %void = OpTypeVoid
           %8 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_0 = OpConstant %uint 0
 %_ptr_Workgroup_int = OpTypePointer Workgroup %int
-         %16 = OpConstantNull %int
+         %21 = OpConstantNull %int
      %uint_2 = OpConstant %uint 2
-     %uint_1 = OpConstant %uint 1
 %_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
-         %23 = OpConstantNull %uint
+         %27 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %39 = OpTypeFunction %void
+         %43 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %8
   %local_idx = OpFunctionParameter %uint
          %12 = OpLabel
-         %15 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
-               OpStore %15 %16
-         %22 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
-               OpAtomicStore %22 %uint_2 %uint_0 %23
-         %26 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2
-               OpAtomicStore %26 %uint_2 %uint_0 %23
+         %14 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %16 None
+               OpBranchConditional %14 %17 %16
+         %17 = OpLabel
+         %20 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
+               OpStore %20 %21
+         %26 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
+               OpAtomicStore %26 %uint_2 %uint_0 %27
+         %30 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2
+               OpAtomicStore %30 %uint_2 %uint_0 %27
+               OpBranch %16
+         %16 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %8
 %local_invocation_index = OpFunctionParameter %uint
-         %31 = OpLabel
-         %32 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %35 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
-               OpAtomicStore %35 %uint_2 %uint_0 %uint_1
-         %38 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2
-               OpAtomicStore %38 %uint_2 %uint_0 %uint_2
+         %35 = OpLabel
+         %36 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %39 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
+               OpAtomicStore %39 %uint_2 %uint_0 %uint_1
+         %42 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2
+               OpAtomicStore %42 %uint_2 %uint_0 %uint_2
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %39
-         %41 = OpLabel
-         %43 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %43
+%compute_main = OpFunction %void None %43
+         %45 = OpLabel
+         %47 = OpLoad %uint %local_invocation_index_1
+         %46 = OpFunctionCall %void %compute_main_inner %47
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.dxc.hlsl
index 3be7f48..8b9f8bd 100644
--- a/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.dxc.hlsl
@@ -7,7 +7,7 @@
 groupshared S_atomic wg;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     uint atomic_result = 0u;
     InterlockedExchange(wg.a, 0u, atomic_result);
diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.fxc.hlsl
index 3be7f48..8b9f8bd 100644
--- a/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.fxc.hlsl
@@ -7,7 +7,7 @@
 groupshared S_atomic wg;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     uint atomic_result = 0u;
     InterlockedExchange(wg.a, 0u, atomic_result);
diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.glsl b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.glsl
index 0687877..07d6d58 100644
--- a/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.glsl
+++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.glsl
@@ -8,7 +8,7 @@
 
 shared S_atomic wg;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     atomicExchange(wg.a, 0u);
     wg.y = 0u;
diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.msl b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.msl
index 9a00b905..6bcb104 100644
--- a/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.msl
+++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.msl
@@ -12,7 +12,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup S_atomic* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     (*(tint_symbol)).x = 0;
     atomic_store_explicit(&((*(tint_symbol)).a), 0u, memory_order_relaxed);
     (*(tint_symbol)).y = 0u;
diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.spvasm b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.spvasm
index e1862bf..25acdc4 100644
--- a/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 56
+; Bound: 60
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -38,58 +38,65 @@
          %wg = OpVariable %_ptr_Workgroup_S_atomic Workgroup
        %void = OpTypeVoid
          %11 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_0 = OpConstant %uint 0
 %_ptr_Workgroup_int = OpTypePointer Workgroup %int
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
      %uint_2 = OpConstant %uint 2
-     %uint_1 = OpConstant %uint 1
 %_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
 %_ptr_Workgroup_uint_0 = OpTypePointer Workgroup %uint
    %uint_264 = OpConstant %uint 264
-         %42 = OpTypeFunction %void
+         %46 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %11
   %local_idx = OpFunctionParameter %uint
          %15 = OpLabel
-         %18 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
-               OpStore %18 %19
-         %25 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
-               OpAtomicStore %25 %uint_2 %uint_0 %6
-         %27 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_2
-               OpStore %27 %6
+         %17 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %19 None
+               OpBranchConditional %17 %20 %19
+         %20 = OpLabel
+         %23 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
+               OpStore %23 %24
+         %29 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
+               OpAtomicStore %29 %uint_2 %uint_0 %6
+         %31 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_2
+               OpStore %31 %6
+               OpBranch %19
+         %19 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %11
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %32 = OpLabel
-         %33 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
-               OpStore %33 %19
-         %36 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
-               OpAtomicStore %36 %uint_2 %uint_0 %6
-         %37 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_2
-               OpStore %37 %6
+         %36 = OpLabel
+         %37 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
+               OpStore %37 %24
+         %40 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
+               OpAtomicStore %40 %uint_2 %uint_0 %6
+         %41 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_2
+               OpStore %41 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %41 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
-               OpAtomicStore %41 %uint_2 %uint_0 %uint_1
+         %45 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
+               OpAtomicStore %45 %uint_2 %uint_0 %uint_1
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %42
-         %44 = OpLabel
-         %45 = OpLoad %uint %local_invocation_index_1
-         %46 = OpFunctionCall %void %compute_main_inner %45
+%compute_main_1 = OpFunction %void None %46
+         %48 = OpLabel
+         %49 = OpLoad %uint %local_invocation_index_1
+         %50 = OpFunctionCall %void %compute_main_inner %49
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %11
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %49 = OpLabel
-         %50 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %53 = OpLabel
+         %54 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %51 = OpFunctionCall %void %compute_main_1
+         %55 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %42
-         %53 = OpLabel
-         %55 = OpLoad %uint %local_invocation_index_1_param_1
-         %54 = OpFunctionCall %void %compute_main_inner_1 %55
+%compute_main = OpFunction %void None %46
+         %57 = OpLabel
+         %59 = OpLoad %uint %local_invocation_index_1_param_1
+         %58 = OpFunctionCall %void %compute_main_inner_1 %59
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.dxc.hlsl b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.dxc.hlsl
index 0b962fc..efc620b 100644
--- a/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.dxc.hlsl
@@ -7,7 +7,7 @@
 groupshared S wg;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     uint atomic_result = 0u;
     InterlockedExchange(wg.a, 0u, atomic_result);
diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.fxc.hlsl b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.fxc.hlsl
index 0b962fc..efc620b 100644
--- a/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.fxc.hlsl
@@ -7,7 +7,7 @@
 groupshared S wg;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     uint atomic_result = 0u;
     InterlockedExchange(wg.a, 0u, atomic_result);
diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.glsl b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.glsl
index 1c517b9..69f2985 100644
--- a/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.glsl
+++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.glsl
@@ -8,7 +8,7 @@
 
 shared S wg;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     atomicExchange(wg.a, 0u);
     wg.y = 0u;
diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.msl b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.msl
index dec75d6..7abda91 100644
--- a/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.msl
+++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.msl
@@ -8,7 +8,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup S* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     (*(tint_symbol)).x = 0;
     atomic_store_explicit(&((*(tint_symbol)).a), 0u, memory_order_relaxed);
     (*(tint_symbol)).y = 0u;
diff --git a/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.spvasm b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.spvasm
index 0d1d436..909fd68 100644
--- a/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.spvasm
+++ b/test/tint/builtins/atomicStore/struct/flat_single_atomic.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 40
+; Bound: 44
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -31,39 +31,46 @@
          %wg = OpVariable %_ptr_Workgroup_S Workgroup
        %void = OpTypeVoid
           %8 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_0 = OpConstant %uint 0
 %_ptr_Workgroup_int = OpTypePointer Workgroup %int
-         %16 = OpConstantNull %int
+         %21 = OpConstantNull %int
      %uint_2 = OpConstant %uint 2
-     %uint_1 = OpConstant %uint 1
 %_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
-         %23 = OpConstantNull %uint
+         %27 = OpConstantNull %uint
 %_ptr_Workgroup_uint_0 = OpTypePointer Workgroup %uint
    %uint_264 = OpConstant %uint 264
-         %35 = OpTypeFunction %void
+         %39 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %8
   %local_idx = OpFunctionParameter %uint
          %12 = OpLabel
-         %15 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
-               OpStore %15 %16
-         %22 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
-               OpAtomicStore %22 %uint_2 %uint_0 %23
-         %25 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_2
-               OpStore %25 %23
+         %14 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %16 None
+               OpBranchConditional %14 %17 %16
+         %17 = OpLabel
+         %20 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
+               OpStore %20 %21
+         %26 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
+               OpAtomicStore %26 %uint_2 %uint_0 %27
+         %29 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_2
+               OpStore %29 %27
+               OpBranch %16
+         %16 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %8
 %local_invocation_index = OpFunctionParameter %uint
-         %30 = OpLabel
-         %31 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %34 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
-               OpAtomicStore %34 %uint_2 %uint_0 %uint_1
+         %34 = OpLabel
+         %35 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %38 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
+               OpAtomicStore %38 %uint_2 %uint_0 %uint_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %35
-         %37 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %38 = OpFunctionCall %void %compute_main_inner %39
+%compute_main = OpFunction %void None %39
+         %41 = OpLabel
+         %43 = OpLoad %uint %local_invocation_index_1
+         %42 = OpFunctionCall %void %compute_main_inner %43
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.dxc.hlsl
index d6b5a13..04c960d 100644
--- a/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.dxc.hlsl
@@ -20,7 +20,7 @@
 groupshared S2_atomic wg;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     wg.y = 0;
     wg.z = 0;
diff --git a/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.fxc.hlsl
index d6b5a13..04c960d 100644
--- a/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.fxc.hlsl
@@ -20,7 +20,7 @@
 groupshared S2_atomic wg;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     wg.y = 0;
     wg.z = 0;
diff --git a/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.glsl b/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.glsl
index 3c24972..9712149 100644
--- a/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.glsl
+++ b/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.glsl
@@ -23,7 +23,7 @@
 
 shared S2_atomic wg;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     wg.y = 0;
     wg.z = 0;
diff --git a/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.msl b/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.msl
index a981566..9d93692 100644
--- a/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.msl
+++ b/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.msl
@@ -27,7 +27,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup S2_atomic* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     (*(tint_symbol)).x = 0;
     (*(tint_symbol)).y = 0;
     (*(tint_symbol)).z = 0;
diff --git a/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.spvasm b/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.spvasm
index e008212..33969fe 100644
--- a/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomicStore/struct/nested.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 72
+; Bound: 76
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -60,86 +60,93 @@
          %wg = OpVariable %_ptr_Workgroup_S2_atomic Workgroup
        %void = OpTypeVoid
          %13 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_0 = OpConstant %uint 0
 %_ptr_Workgroup_int = OpTypePointer Workgroup %int
-         %21 = OpConstantNull %int
-     %uint_1 = OpConstant %uint 1
+         %26 = OpConstantNull %int
      %uint_2 = OpConstant %uint 2
      %uint_3 = OpConstant %uint 3
 %_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
    %uint_264 = OpConstant %uint 264
-         %58 = OpTypeFunction %void
+         %62 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %13
   %local_idx = OpFunctionParameter %uint
          %17 = OpLabel
-         %20 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
-               OpStore %20 %21
-         %23 = OpAccessChain %_ptr_Workgroup_int %wg %uint_1
-               OpStore %23 %21
-         %25 = OpAccessChain %_ptr_Workgroup_int %wg %uint_2
-               OpStore %25 %21
-         %27 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_0
-               OpStore %27 %21
-         %28 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_0
-               OpStore %28 %21
-         %32 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_3 %uint_1 %uint_1
-               OpAtomicStore %32 %uint_2 %uint_0 %6
-         %33 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_2
-               OpStore %33 %21
-         %34 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_3
-               OpStore %34 %21
-         %35 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_2
-               OpStore %35 %21
-         %36 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_3
-               OpStore %36 %21
+         %19 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %21 None
+               OpBranchConditional %19 %22 %21
+         %22 = OpLabel
+         %25 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
+               OpStore %25 %26
+         %27 = OpAccessChain %_ptr_Workgroup_int %wg %uint_1
+               OpStore %27 %26
+         %29 = OpAccessChain %_ptr_Workgroup_int %wg %uint_2
+               OpStore %29 %26
+         %31 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_0
+               OpStore %31 %26
+         %32 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_0
+               OpStore %32 %26
+         %36 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_3 %uint_1 %uint_1
+               OpAtomicStore %36 %uint_2 %uint_0 %6
+         %37 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_2
+               OpStore %37 %26
+         %38 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_3
+               OpStore %38 %26
+         %39 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_2
+               OpStore %39 %26
+         %40 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_3
+               OpStore %40 %26
+               OpBranch %21
+         %21 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %13
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %41 = OpLabel
-         %42 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
-               OpStore %42 %21
-         %43 = OpAccessChain %_ptr_Workgroup_int %wg %uint_1
-               OpStore %43 %21
-         %44 = OpAccessChain %_ptr_Workgroup_int %wg %uint_2
-               OpStore %44 %21
-         %45 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_0
-               OpStore %45 %21
-         %46 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_0
-               OpStore %46 %21
-         %49 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_3 %uint_1 %uint_1
-               OpAtomicStore %49 %uint_2 %uint_0 %6
-         %50 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_2
-               OpStore %50 %21
-         %51 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_3
-               OpStore %51 %21
-         %52 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_2
-               OpStore %52 %21
-         %53 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_3
-               OpStore %53 %21
+         %45 = OpLabel
+         %46 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
+               OpStore %46 %26
+         %47 = OpAccessChain %_ptr_Workgroup_int %wg %uint_1
+               OpStore %47 %26
+         %48 = OpAccessChain %_ptr_Workgroup_int %wg %uint_2
+               OpStore %48 %26
+         %49 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_0
+               OpStore %49 %26
+         %50 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_0
+               OpStore %50 %26
+         %53 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_3 %uint_1 %uint_1
+               OpAtomicStore %53 %uint_2 %uint_0 %6
+         %54 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_2
+               OpStore %54 %26
+         %55 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_3
+               OpStore %55 %26
+         %56 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_2
+               OpStore %56 %26
+         %57 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_3
+               OpStore %57 %26
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %57 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_3 %uint_1 %uint_1
-               OpAtomicStore %57 %uint_2 %uint_0 %uint_1
+         %61 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_3 %uint_1 %uint_1
+               OpAtomicStore %61 %uint_2 %uint_0 %uint_1
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %58
-         %60 = OpLabel
-         %61 = OpLoad %uint %local_invocation_index_1
-         %62 = OpFunctionCall %void %compute_main_inner %61
+%compute_main_1 = OpFunction %void None %62
+         %64 = OpLabel
+         %65 = OpLoad %uint %local_invocation_index_1
+         %66 = OpFunctionCall %void %compute_main_inner %65
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %13
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %65 = OpLabel
-         %66 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %69 = OpLabel
+         %70 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %67 = OpFunctionCall %void %compute_main_1
+         %71 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %58
-         %69 = OpLabel
-         %71 = OpLoad %uint %local_invocation_index_1_param_1
-         %70 = OpFunctionCall %void %compute_main_inner_1 %71
+%compute_main = OpFunction %void None %62
+         %73 = OpLabel
+         %75 = OpLoad %uint %local_invocation_index_1_param_1
+         %74 = OpFunctionCall %void %compute_main_inner_1 %75
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.dxc.hlsl b/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.dxc.hlsl
index 7f3ebb5..e1c5868 100644
--- a/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.dxc.hlsl
@@ -20,7 +20,7 @@
 groupshared S2 wg;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     wg.y = 0;
     wg.z = 0;
diff --git a/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.fxc.hlsl b/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.fxc.hlsl
index 7f3ebb5..e1c5868 100644
--- a/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.fxc.hlsl
@@ -20,7 +20,7 @@
 groupshared S2 wg;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     wg.y = 0;
     wg.z = 0;
diff --git a/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.glsl b/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.glsl
index b17ac3d..121620b 100644
--- a/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.glsl
+++ b/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.glsl
@@ -23,7 +23,7 @@
 
 shared S2 wg;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     wg.y = 0;
     wg.z = 0;
diff --git a/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.msl b/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.msl
index e16c219..717132e 100644
--- a/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.msl
+++ b/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.msl
@@ -23,7 +23,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup S2* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     (*(tint_symbol)).x = 0;
     (*(tint_symbol)).y = 0;
     (*(tint_symbol)).z = 0;
diff --git a/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.spvasm b/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.spvasm
index 252a8426..7786a1e 100644
--- a/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.spvasm
+++ b/test/tint/builtins/atomicStore/struct/nested.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 49
+; Bound: 53
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -53,53 +53,60 @@
          %wg = OpVariable %_ptr_Workgroup_S2 Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_0 = OpConstant %uint 0
 %_ptr_Workgroup_int = OpTypePointer Workgroup %int
-         %18 = OpConstantNull %int
-     %uint_1 = OpConstant %uint 1
+         %23 = OpConstantNull %int
      %uint_2 = OpConstant %uint 2
      %uint_3 = OpConstant %uint 3
 %_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
-         %30 = OpConstantNull %uint
+         %34 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %44 = OpTypeFunction %void
+         %48 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-         %17 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
-               OpStore %17 %18
-         %20 = OpAccessChain %_ptr_Workgroup_int %wg %uint_1
-               OpStore %20 %18
-         %22 = OpAccessChain %_ptr_Workgroup_int %wg %uint_2
-               OpStore %22 %18
-         %24 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_0
-               OpStore %24 %18
-         %25 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_0
-               OpStore %25 %18
-         %29 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_3 %uint_1 %uint_1
-               OpAtomicStore %29 %uint_2 %uint_0 %30
-         %31 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_2
-               OpStore %31 %18
-         %32 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_3
-               OpStore %32 %18
-         %33 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_2
-               OpStore %33 %18
-         %34 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_3
-               OpStore %34 %18
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+         %22 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
+               OpStore %22 %23
+         %24 = OpAccessChain %_ptr_Workgroup_int %wg %uint_1
+               OpStore %24 %23
+         %26 = OpAccessChain %_ptr_Workgroup_int %wg %uint_2
+               OpStore %26 %23
+         %28 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_0
+               OpStore %28 %23
+         %29 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_0
+               OpStore %29 %23
+         %33 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_3 %uint_1 %uint_1
+               OpAtomicStore %33 %uint_2 %uint_0 %34
+         %35 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_2
+               OpStore %35 %23
+         %36 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_1 %uint_3
+               OpStore %36 %23
+         %37 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_2
+               OpStore %37 %23
+         %38 = OpAccessChain %_ptr_Workgroup_int %wg %uint_3 %uint_3
+               OpStore %38 %23
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %39 = OpLabel
-         %40 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %43 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_3 %uint_1 %uint_1
-               OpAtomicStore %43 %uint_2 %uint_0 %uint_1
+         %43 = OpLabel
+         %44 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %47 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_3 %uint_1 %uint_1
+               OpAtomicStore %47 %uint_2 %uint_0 %uint_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %44
-         %46 = OpLabel
-         %48 = OpLoad %uint %local_invocation_index_1
-         %47 = OpFunctionCall %void %compute_main_inner %48
+%compute_main = OpFunction %void None %48
+         %50 = OpLabel
+         %52 = OpLoad %uint %local_invocation_index_1
+         %51 = OpFunctionCall %void %compute_main_inner %52
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.dxc.hlsl
index b2599b2..ec5fa72 100644
--- a/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.dxc.hlsl
@@ -7,7 +7,7 @@
 groupshared S_atomic wg;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     wg.y = 0u;
   }
diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.fxc.hlsl
index b2599b2..ec5fa72 100644
--- a/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.fxc.hlsl
@@ -7,7 +7,7 @@
 groupshared S_atomic wg;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     wg.y = 0u;
   }
diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.glsl b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.glsl
index 084a9de..e50f3de 100644
--- a/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.glsl
+++ b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.glsl
@@ -8,7 +8,7 @@
 
 shared S_atomic wg;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     wg.y = 0u;
   }
diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.msl b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.msl
index 437dda5..d5e8aca 100644
--- a/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.msl
+++ b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.msl
@@ -29,7 +29,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup S_atomic* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     (*(tint_symbol)).x = 0;
     (*(tint_symbol)).y = 0u;
   }
diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.spvasm b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.spvasm
index 6bfef89..419fcb1 100644
--- a/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomicStore/struct/struct_of_array.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 87
+; Bound: 90
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -43,108 +43,114 @@
          %wg = OpVariable %_ptr_Workgroup_S_atomic Workgroup
        %void = OpTypeVoid
          %13 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_0 = OpConstant %uint 0
 %_ptr_Workgroup_int = OpTypePointer Workgroup %int
-         %21 = OpConstantNull %int
+         %26 = OpConstantNull %int
      %uint_2 = OpConstant %uint 2
 %_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
 %_ptr_Function_uint = OpTypePointer Function %uint
-       %bool = OpTypeBool
-     %uint_1 = OpConstant %uint 1
 %_ptr_Workgroup_uint_0 = OpTypePointer Workgroup %uint
    %uint_264 = OpConstant %uint 264
       %int_4 = OpConstant %int 4
-         %73 = OpTypeFunction %void
+         %76 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %13
   %local_idx = OpFunctionParameter %uint
          %17 = OpLabel
       %idx_1 = OpVariable %_ptr_Function_uint Function %6
-         %20 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
-               OpStore %20 %21
-         %24 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2
-               OpStore %24 %6
+         %19 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %21 None
+               OpBranchConditional %19 %22 %21
+         %22 = OpLabel
+         %25 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
+               OpStore %25 %26
+         %29 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2
+               OpStore %29 %6
+               OpBranch %21
+         %21 = OpLabel
                OpStore %idx_1 %local_idx
-               OpBranch %27
-         %27 = OpLabel
-               OpLoopMerge %28 %29 None
-               OpBranch %30
-         %30 = OpLabel
-         %32 = OpLoad %uint %idx_1
-         %33 = OpULessThan %bool %32 %uint_10
-         %31 = OpLogicalNot %bool %33
-               OpSelectionMerge %35 None
-               OpBranchConditional %31 %36 %35
-         %36 = OpLabel
-               OpBranch %28
+               OpBranch %32
+         %32 = OpLabel
+               OpLoopMerge %33 %34 None
+               OpBranch %35
          %35 = OpLabel
          %37 = OpLoad %uint %idx_1
-         %42 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_1 %37
-               OpAtomicStore %42 %uint_2 %uint_0 %6
-               OpBranch %29
-         %29 = OpLabel
-         %43 = OpLoad %uint %idx_1
-         %44 = OpIAdd %uint %43 %uint_1
-               OpStore %idx_1 %44
-               OpBranch %27
-         %28 = OpLabel
+         %38 = OpULessThan %bool %37 %uint_10
+         %36 = OpLogicalNot %bool %38
+               OpSelectionMerge %39 None
+               OpBranchConditional %36 %40 %39
+         %40 = OpLabel
+               OpBranch %33
+         %39 = OpLabel
+         %41 = OpLoad %uint %idx_1
+         %45 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_1 %41
+               OpAtomicStore %45 %uint_2 %uint_0 %6
+               OpBranch %34
+         %34 = OpLabel
+         %46 = OpLoad %uint %idx_1
+         %47 = OpIAdd %uint %46 %uint_1
+               OpStore %idx_1 %47
+               OpBranch %32
+         %33 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %13
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %49 = OpLabel
+         %52 = OpLabel
         %idx = OpVariable %_ptr_Function_uint Function %6
                OpStore %idx %6
-         %51 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
-               OpStore %51 %21
-         %52 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2
-               OpStore %52 %6
+         %54 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
+               OpStore %54 %26
+         %55 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2
+               OpStore %55 %6
                OpStore %idx %local_invocation_index_2
-               OpBranch %53
-         %53 = OpLabel
-               OpLoopMerge %54 %55 None
                OpBranch %56
          %56 = OpLabel
-         %58 = OpLoad %uint %idx
-         %59 = OpULessThan %bool %58 %uint_10
-         %57 = OpLogicalNot %bool %59
-               OpSelectionMerge %60 None
-               OpBranchConditional %57 %61 %60
-         %61 = OpLabel
-               OpBranch %54
-         %60 = OpLabel
-         %62 = OpLoad %uint %idx
-         %65 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_1 %62
-               OpAtomicStore %65 %uint_2 %uint_0 %6
-               OpBranch %55
-         %55 = OpLabel
-         %66 = OpLoad %uint %idx
-         %67 = OpIAdd %uint %66 %uint_1
-               OpStore %idx %67
-               OpBranch %53
-         %54 = OpLabel
+               OpLoopMerge %57 %58 None
+               OpBranch %59
+         %59 = OpLabel
+         %61 = OpLoad %uint %idx
+         %62 = OpULessThan %bool %61 %uint_10
+         %60 = OpLogicalNot %bool %62
+               OpSelectionMerge %63 None
+               OpBranchConditional %60 %64 %63
+         %64 = OpLabel
+               OpBranch %57
+         %63 = OpLabel
+         %65 = OpLoad %uint %idx
+         %68 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_1 %65
+               OpAtomicStore %68 %uint_2 %uint_0 %6
+               OpBranch %58
+         %58 = OpLabel
+         %69 = OpLoad %uint %idx
+         %70 = OpIAdd %uint %69 %uint_1
+               OpStore %idx %70
+               OpBranch %56
+         %57 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %72 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_1 %int_4
-               OpAtomicStore %72 %uint_2 %uint_0 %uint_1
+         %75 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_1 %int_4
+               OpAtomicStore %75 %uint_2 %uint_0 %uint_1
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %73
-         %75 = OpLabel
-         %76 = OpLoad %uint %local_invocation_index_1
-         %77 = OpFunctionCall %void %compute_main_inner %76
+%compute_main_1 = OpFunction %void None %76
+         %78 = OpLabel
+         %79 = OpLoad %uint %local_invocation_index_1
+         %80 = OpFunctionCall %void %compute_main_inner %79
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %13
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %80 = OpLabel
-         %81 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %83 = OpLabel
+         %84 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %82 = OpFunctionCall %void %compute_main_1
+         %85 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %73
-         %84 = OpLabel
-         %86 = OpLoad %uint %local_invocation_index_1_param_1
-         %85 = OpFunctionCall %void %compute_main_inner_1 %86
+%compute_main = OpFunction %void None %76
+         %87 = OpLabel
+         %89 = OpLoad %uint %local_invocation_index_1_param_1
+         %88 = OpFunctionCall %void %compute_main_inner_1 %89
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.dxc.hlsl b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.dxc.hlsl
index ff3b757..c2c3fda 100644
--- a/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.dxc.hlsl
@@ -7,7 +7,7 @@
 groupshared S wg;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     wg.y = 0u;
   }
diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.fxc.hlsl b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.fxc.hlsl
index ff3b757..c2c3fda 100644
--- a/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.fxc.hlsl
@@ -7,7 +7,7 @@
 groupshared S wg;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     wg.y = 0u;
   }
diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.glsl b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.glsl
index 9d04c7c..606b7e1 100644
--- a/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.glsl
+++ b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.glsl
@@ -8,7 +8,7 @@
 
 shared S wg;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     wg.y = 0u;
   }
diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.msl b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.msl
index 9d54573..a8acff4 100644
--- a/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.msl
+++ b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.msl
@@ -25,7 +25,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup S* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     (*(tint_symbol)).x = 0;
     (*(tint_symbol)).y = 0u;
   }
diff --git a/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.spvasm b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.spvasm
index 41c60ef..45f6805 100644
--- a/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.spvasm
+++ b/test/tint/builtins/atomicStore/struct/struct_of_array.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 58
+; Bound: 61
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -35,65 +35,71 @@
          %wg = OpVariable %_ptr_Workgroup_S Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_0 = OpConstant %uint 0
 %_ptr_Workgroup_int = OpTypePointer Workgroup %int
-         %18 = OpConstantNull %int
+         %23 = OpConstantNull %int
      %uint_2 = OpConstant %uint 2
 %_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
-         %22 = OpConstantNull %uint
+         %27 = OpConstantNull %uint
 %_ptr_Function_uint = OpTypePointer Function %uint
-       %bool = OpTypeBool
-     %uint_1 = OpConstant %uint 1
 %_ptr_Workgroup_uint_0 = OpTypePointer Workgroup %uint
    %uint_264 = OpConstant %uint 264
       %int_4 = OpConstant %int 4
-         %53 = OpTypeFunction %void
+         %56 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-        %idx = OpVariable %_ptr_Function_uint Function %22
-         %17 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
-               OpStore %17 %18
-         %21 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2
-               OpStore %21 %22
+        %idx = OpVariable %_ptr_Function_uint Function %27
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+         %22 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
+               OpStore %22 %23
+         %26 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_2
+               OpStore %26 %27
+               OpBranch %18
+         %18 = OpLabel
                OpStore %idx %local_idx
-               OpBranch %25
-         %25 = OpLabel
-               OpLoopMerge %26 %27 None
-               OpBranch %28
-         %28 = OpLabel
-         %30 = OpLoad %uint %idx
-         %31 = OpULessThan %bool %30 %uint_10
-         %29 = OpLogicalNot %bool %31
-               OpSelectionMerge %33 None
-               OpBranchConditional %29 %34 %33
-         %34 = OpLabel
-               OpBranch %26
+               OpBranch %30
+         %30 = OpLabel
+               OpLoopMerge %31 %32 None
+               OpBranch %33
          %33 = OpLabel
          %35 = OpLoad %uint %idx
-         %40 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_1 %35
-               OpAtomicStore %40 %uint_2 %uint_0 %22
-               OpBranch %27
-         %27 = OpLabel
-         %41 = OpLoad %uint %idx
-         %42 = OpIAdd %uint %41 %uint_1
-               OpStore %idx %42
-               OpBranch %25
-         %26 = OpLabel
+         %36 = OpULessThan %bool %35 %uint_10
+         %34 = OpLogicalNot %bool %36
+               OpSelectionMerge %37 None
+               OpBranchConditional %34 %38 %37
+         %38 = OpLabel
+               OpBranch %31
+         %37 = OpLabel
+         %39 = OpLoad %uint %idx
+         %43 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_1 %39
+               OpAtomicStore %43 %uint_2 %uint_0 %27
+               OpBranch %32
+         %32 = OpLabel
+         %44 = OpLoad %uint %idx
+         %45 = OpIAdd %uint %44 %uint_1
+               OpStore %idx %45
+               OpBranch %30
+         %31 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %47 = OpLabel
-         %48 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %52 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_1 %int_4
-               OpAtomicStore %52 %uint_2 %uint_0 %uint_1
+         %50 = OpLabel
+         %51 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %55 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_1 %int_4
+               OpAtomicStore %55 %uint_2 %uint_0 %uint_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %53
-         %55 = OpLabel
-         %57 = OpLoad %uint %local_invocation_index_1
-         %56 = OpFunctionCall %void %compute_main_inner %57
+%compute_main = OpFunction %void None %56
+         %58 = OpLabel
+         %60 = OpLoad %uint %local_invocation_index_1
+         %59 = OpFunctionCall %void %compute_main_inner %60
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.dxc.hlsl
index 3be7f48..8b9f8bd 100644
--- a/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.dxc.hlsl
@@ -7,7 +7,7 @@
 groupshared S_atomic wg;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     uint atomic_result = 0u;
     InterlockedExchange(wg.a, 0u, atomic_result);
diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.fxc.hlsl
index 3be7f48..8b9f8bd 100644
--- a/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.fxc.hlsl
@@ -7,7 +7,7 @@
 groupshared S_atomic wg;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     uint atomic_result = 0u;
     InterlockedExchange(wg.a, 0u, atomic_result);
diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.glsl b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.glsl
index 0687877..07d6d58 100644
--- a/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.glsl
+++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.glsl
@@ -8,7 +8,7 @@
 
 shared S_atomic wg;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     atomicExchange(wg.a, 0u);
     wg.y = 0u;
diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.msl b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.msl
index 9a00b905..6bcb104 100644
--- a/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.msl
+++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.msl
@@ -12,7 +12,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup S_atomic* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     (*(tint_symbol)).x = 0;
     atomic_store_explicit(&((*(tint_symbol)).a), 0u, memory_order_relaxed);
     (*(tint_symbol)).y = 0u;
diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.spvasm b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.spvasm
index e1862bf..25acdc4 100644
--- a/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 56
+; Bound: 60
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -38,58 +38,65 @@
          %wg = OpVariable %_ptr_Workgroup_S_atomic Workgroup
        %void = OpTypeVoid
          %11 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_0 = OpConstant %uint 0
 %_ptr_Workgroup_int = OpTypePointer Workgroup %int
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
      %uint_2 = OpConstant %uint 2
-     %uint_1 = OpConstant %uint 1
 %_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
 %_ptr_Workgroup_uint_0 = OpTypePointer Workgroup %uint
    %uint_264 = OpConstant %uint 264
-         %42 = OpTypeFunction %void
+         %46 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %11
   %local_idx = OpFunctionParameter %uint
          %15 = OpLabel
-         %18 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
-               OpStore %18 %19
-         %25 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
-               OpAtomicStore %25 %uint_2 %uint_0 %6
-         %27 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_2
-               OpStore %27 %6
+         %17 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %19 None
+               OpBranchConditional %17 %20 %19
+         %20 = OpLabel
+         %23 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
+               OpStore %23 %24
+         %29 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
+               OpAtomicStore %29 %uint_2 %uint_0 %6
+         %31 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_2
+               OpStore %31 %6
+               OpBranch %19
+         %19 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %11
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %32 = OpLabel
-         %33 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
-               OpStore %33 %19
-         %36 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
-               OpAtomicStore %36 %uint_2 %uint_0 %6
-         %37 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_2
-               OpStore %37 %6
+         %36 = OpLabel
+         %37 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
+               OpStore %37 %24
+         %40 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
+               OpAtomicStore %40 %uint_2 %uint_0 %6
+         %41 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_2
+               OpStore %41 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %41 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
-               OpAtomicStore %41 %uint_2 %uint_0 %uint_1
+         %45 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
+               OpAtomicStore %45 %uint_2 %uint_0 %uint_1
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %42
-         %44 = OpLabel
-         %45 = OpLoad %uint %local_invocation_index_1
-         %46 = OpFunctionCall %void %compute_main_inner %45
+%compute_main_1 = OpFunction %void None %46
+         %48 = OpLabel
+         %49 = OpLoad %uint %local_invocation_index_1
+         %50 = OpFunctionCall %void %compute_main_inner %49
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %11
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %49 = OpLabel
-         %50 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %53 = OpLabel
+         %54 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %51 = OpFunctionCall %void %compute_main_1
+         %55 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %42
-         %53 = OpLabel
-         %55 = OpLoad %uint %local_invocation_index_1_param_1
-         %54 = OpFunctionCall %void %compute_main_inner_1 %55
+%compute_main = OpFunction %void None %46
+         %57 = OpLabel
+         %59 = OpLoad %uint %local_invocation_index_1_param_1
+         %58 = OpFunctionCall %void %compute_main_inner_1 %59
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.dxc.hlsl b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.dxc.hlsl
index 0b962fc..efc620b 100644
--- a/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.dxc.hlsl
@@ -7,7 +7,7 @@
 groupshared S wg;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     uint atomic_result = 0u;
     InterlockedExchange(wg.a, 0u, atomic_result);
diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.fxc.hlsl b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.fxc.hlsl
index 0b962fc..efc620b 100644
--- a/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.fxc.hlsl
@@ -7,7 +7,7 @@
 groupshared S wg;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     uint atomic_result = 0u;
     InterlockedExchange(wg.a, 0u, atomic_result);
diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.glsl b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.glsl
index 1c517b9..69f2985 100644
--- a/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.glsl
+++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.glsl
@@ -8,7 +8,7 @@
 
 shared S wg;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg.x = 0;
     atomicExchange(wg.a, 0u);
     wg.y = 0u;
diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.msl b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.msl
index dec75d6..7abda91 100644
--- a/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.msl
+++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.msl
@@ -8,7 +8,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup S* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     (*(tint_symbol)).x = 0;
     atomic_store_explicit(&((*(tint_symbol)).a), 0u, memory_order_relaxed);
     (*(tint_symbol)).y = 0u;
diff --git a/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.spvasm b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.spvasm
index 0d1d436..909fd68 100644
--- a/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.spvasm
+++ b/test/tint/builtins/atomicStore/struct/via_ptr_let.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 40
+; Bound: 44
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -31,39 +31,46 @@
          %wg = OpVariable %_ptr_Workgroup_S Workgroup
        %void = OpTypeVoid
           %8 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_0 = OpConstant %uint 0
 %_ptr_Workgroup_int = OpTypePointer Workgroup %int
-         %16 = OpConstantNull %int
+         %21 = OpConstantNull %int
      %uint_2 = OpConstant %uint 2
-     %uint_1 = OpConstant %uint 1
 %_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
-         %23 = OpConstantNull %uint
+         %27 = OpConstantNull %uint
 %_ptr_Workgroup_uint_0 = OpTypePointer Workgroup %uint
    %uint_264 = OpConstant %uint 264
-         %35 = OpTypeFunction %void
+         %39 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %8
   %local_idx = OpFunctionParameter %uint
          %12 = OpLabel
-         %15 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
-               OpStore %15 %16
-         %22 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
-               OpAtomicStore %22 %uint_2 %uint_0 %23
-         %25 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_2
-               OpStore %25 %23
+         %14 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %16 None
+               OpBranchConditional %14 %17 %16
+         %17 = OpLabel
+         %20 = OpAccessChain %_ptr_Workgroup_int %wg %uint_0
+               OpStore %20 %21
+         %26 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
+               OpAtomicStore %26 %uint_2 %uint_0 %27
+         %29 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %uint_2
+               OpStore %29 %27
+               OpBranch %16
+         %16 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %8
 %local_invocation_index = OpFunctionParameter %uint
-         %30 = OpLabel
-         %31 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %34 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
-               OpAtomicStore %34 %uint_2 %uint_0 %uint_1
+         %34 = OpLabel
+         %35 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %38 = OpAccessChain %_ptr_Workgroup_uint %wg %uint_1
+               OpAtomicStore %38 %uint_2 %uint_0 %uint_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %35
-         %37 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %38 = OpFunctionCall %void %compute_main_inner %39
+%compute_main = OpFunction %void None %39
+         %41 = OpLabel
+         %43 = OpLoad %uint %local_invocation_index_1
+         %42 = OpFunctionCall %void %compute_main_inner %43
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.dxc.hlsl
index 84a5765..bfcb3ee 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.fxc.hlsl
index 84a5765..bfcb3ee 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.glsl
index 4ca850a..2fd2fac 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.msl
index e11ec06..e7d8db8 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.spvasm
index 86e88a1..88d9a19 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 50
+; Bound: 55
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,53 +32,61 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAdd_794055 = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %19
-               OpStore %res %19
-         %27 = OpAtomicIAdd %int %arg_0 %uint_2 %uint_0 %int_1
-               OpStore %res %27
+%atomicAdd_794055 = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %24
+               OpStore %res %24
+         %32 = OpAtomicIAdd %int %arg_0 %uint_2 %uint_0 %int_1
+               OpStore %res %32
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %32 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %37 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %36 = OpFunctionCall %void %atomicAdd_794055
+         %41 = OpFunctionCall %void %atomicAdd_794055
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %38 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %39
+%compute_main_1 = OpFunction %void None %27
+         %43 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %44
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %43 = OpLabel
-         %44 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %48 = OpLabel
+         %49 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %45 = OpFunctionCall %void %compute_main_1
+         %50 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %47 = OpLabel
-         %49 = OpLoad %uint %local_invocation_index_1_param_1
-         %48 = OpFunctionCall %void %compute_main_inner_1 %49
+%compute_main = OpFunction %void None %27
+         %52 = OpLabel
+         %54 = OpLoad %uint %local_invocation_index_1_param_1
+         %53 = OpFunctionCall %void %compute_main_inner_1 %54
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.dxc.hlsl
index 7e2d4ee..f3c710a 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.fxc.hlsl
index 7e2d4ee..f3c710a 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.glsl
index 87fb3fd..16f2f43 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.msl
index dfc2d5b..9095a82 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.spvasm
index 5f4d6de..f71a715 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 48
+; Bound: 52
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -31,52 +31,59 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-     %uint_1 = OpConstant %uint 1
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAdd_d5db1d = OpFunction %void None %20
-         %22 = OpLabel
+%atomicAdd_d5db1d = OpFunction %void None %25
+         %27 = OpLabel
         %res = OpVariable %_ptr_Function_uint Function %6
                OpStore %res %6
-         %25 = OpAtomicIAdd %uint %arg_0 %uint_2 %uint_0 %uint_1
-               OpStore %res %25
+         %30 = OpAtomicIAdd %uint %arg_0 %uint_2 %uint_0 %uint_1
+               OpStore %res %30
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %30 = OpLabel
+         %34 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %34 = OpFunctionCall %void %atomicAdd_d5db1d
+         %38 = OpFunctionCall %void %atomicAdd_d5db1d
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %36 = OpLabel
-         %37 = OpLoad %uint %local_invocation_index_1
-         %38 = OpFunctionCall %void %compute_main_inner %37
+%compute_main_1 = OpFunction %void None %25
+         %40 = OpLabel
+         %41 = OpLoad %uint %local_invocation_index_1
+         %42 = OpFunctionCall %void %compute_main_inner %41
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %41 = OpLabel
-         %42 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %45 = OpLabel
+         %46 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %43 = OpFunctionCall %void %compute_main_1
+         %47 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %45 = OpLabel
-         %47 = OpLoad %uint %local_invocation_index_1_param_1
-         %46 = OpFunctionCall %void %compute_main_inner_1 %47
+%compute_main = OpFunction %void None %25
+         %49 = OpLabel
+         %51 = OpLoad %uint %local_invocation_index_1_param_1
+         %50 = OpFunctionCall %void %compute_main_inner_1 %51
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.dxc.hlsl
index 9c9f63c..1c357d7 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.fxc.hlsl
index 9c9f63c..1c357d7 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.glsl
index d2189f7..bfc229b 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.msl
index 4bb9413..d9cd9d3 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.spvasm
index bbbc7e1..7544c96 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 50
+; Bound: 55
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,53 +32,61 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAnd_45a819 = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %19
-               OpStore %res %19
-         %27 = OpAtomicAnd %int %arg_0 %uint_2 %uint_0 %int_1
-               OpStore %res %27
+%atomicAnd_45a819 = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %24
+               OpStore %res %24
+         %32 = OpAtomicAnd %int %arg_0 %uint_2 %uint_0 %int_1
+               OpStore %res %32
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %32 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %37 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %36 = OpFunctionCall %void %atomicAnd_45a819
+         %41 = OpFunctionCall %void %atomicAnd_45a819
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %38 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %39
+%compute_main_1 = OpFunction %void None %27
+         %43 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %44
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %43 = OpLabel
-         %44 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %48 = OpLabel
+         %49 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %45 = OpFunctionCall %void %compute_main_1
+         %50 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %47 = OpLabel
-         %49 = OpLoad %uint %local_invocation_index_1_param_1
-         %48 = OpFunctionCall %void %compute_main_inner_1 %49
+%compute_main = OpFunction %void None %27
+         %52 = OpLabel
+         %54 = OpLoad %uint %local_invocation_index_1_param_1
+         %53 = OpFunctionCall %void %compute_main_inner_1 %54
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.dxc.hlsl
index cb47920..684e133 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.fxc.hlsl
index cb47920..684e133 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.glsl
index 8d8843c..38d645d 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.msl
index 03d6ac7..22670ec 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.spvasm
index 091a501..f4e1b1a 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 48
+; Bound: 52
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -31,52 +31,59 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-     %uint_1 = OpConstant %uint 1
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAnd_34edd3 = OpFunction %void None %20
-         %22 = OpLabel
+%atomicAnd_34edd3 = OpFunction %void None %25
+         %27 = OpLabel
         %res = OpVariable %_ptr_Function_uint Function %6
                OpStore %res %6
-         %25 = OpAtomicAnd %uint %arg_0 %uint_2 %uint_0 %uint_1
-               OpStore %res %25
+         %30 = OpAtomicAnd %uint %arg_0 %uint_2 %uint_0 %uint_1
+               OpStore %res %30
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %30 = OpLabel
+         %34 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %34 = OpFunctionCall %void %atomicAnd_34edd3
+         %38 = OpFunctionCall %void %atomicAnd_34edd3
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %36 = OpLabel
-         %37 = OpLoad %uint %local_invocation_index_1
-         %38 = OpFunctionCall %void %compute_main_inner %37
+%compute_main_1 = OpFunction %void None %25
+         %40 = OpLabel
+         %41 = OpLoad %uint %local_invocation_index_1
+         %42 = OpFunctionCall %void %compute_main_inner %41
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %41 = OpLabel
-         %42 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %45 = OpLabel
+         %46 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %43 = OpFunctionCall %void %compute_main_1
+         %47 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %45 = OpLabel
-         %47 = OpLoad %uint %local_invocation_index_1_param_1
-         %46 = OpFunctionCall %void %compute_main_inner_1 %47
+%compute_main = OpFunction %void None %25
+         %49 = OpLabel
+         %51 = OpLoad %uint %local_invocation_index_1_param_1
+         %50 = OpFunctionCall %void %compute_main_inner_1 %51
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.dxc.hlsl
index 44bd4c0..61abde0 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -5,7 +5,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.fxc.hlsl
index 44bd4c0..61abde0 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -5,7 +5,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.glsl
index 140191f..d112ac0 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.glsl
@@ -8,7 +8,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.msl
index 6bd1518..0f57ced 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.msl
@@ -17,7 +17,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol_2) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol_2, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.spvasm
index bf85296..79e3f31 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 59
+; Bound: 63
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -42,62 +42,69 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
-       %bool = OpTypeBool
+         %27 = OpTypeFunction %void
 %x__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool
-         %27 = OpConstantNull %x__atomic_compare_exchange_resulti32
+         %31 = OpConstantNull %x__atomic_compare_exchange_resulti32
 %_ptr_Function_x__atomic_compare_exchange_resulti32 = OpTypePointer Function %x__atomic_compare_exchange_resulti32
 %__atomic_compare_exchange_result_i32 = OpTypeStruct %int %bool
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicCompareExchangeWeak_e88938 = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resulti32 Function %27
-               OpStore %res %27
-         %34 = OpAtomicCompareExchange %int %arg_0 %uint_2 %uint_0 %uint_0 %int_1 %int_1
-         %35 = OpIEqual %bool %34 %int_1
-         %30 = OpCompositeConstruct %__atomic_compare_exchange_result_i32 %34 %35
-         %36 = OpCompositeExtract %int %30 0
-         %37 = OpIEqual %bool %36 %int_1
-         %38 = OpCompositeConstruct %x__atomic_compare_exchange_resulti32 %36 %37
-               OpStore %res %38
+%atomicCompareExchangeWeak_e88938 = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resulti32 Function %31
+               OpStore %res %31
+         %38 = OpAtomicCompareExchange %int %arg_0 %uint_2 %uint_0 %uint_0 %int_1 %int_1
+         %39 = OpIEqual %bool %38 %int_1
+         %34 = OpCompositeConstruct %__atomic_compare_exchange_result_i32 %38 %39
+         %40 = OpCompositeExtract %int %34 0
+         %41 = OpIEqual %bool %40 %int_1
+         %42 = OpCompositeConstruct %x__atomic_compare_exchange_resulti32 %40 %41
+               OpStore %res %42
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %41 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %45 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %45 = OpFunctionCall %void %atomicCompareExchangeWeak_e88938
+         %49 = OpFunctionCall %void %atomicCompareExchangeWeak_e88938
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %47 = OpLabel
-         %48 = OpLoad %uint %local_invocation_index_1
-         %49 = OpFunctionCall %void %compute_main_inner %48
+%compute_main_1 = OpFunction %void None %27
+         %51 = OpLabel
+         %52 = OpLoad %uint %local_invocation_index_1
+         %53 = OpFunctionCall %void %compute_main_inner %52
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %52 = OpLabel
-         %53 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %56 = OpLabel
+         %57 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %54 = OpFunctionCall %void %compute_main_1
+         %58 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %56 = OpLabel
-         %58 = OpLoad %uint %local_invocation_index_1_param_1
-         %57 = OpFunctionCall %void %compute_main_inner_1 %58
+%compute_main = OpFunction %void None %27
+         %60 = OpLabel
+         %62 = OpLoad %uint %local_invocation_index_1_param_1
+         %61 = OpFunctionCall %void %compute_main_inner_1 %62
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.dxc.hlsl
index 34850f7..a005ee0 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -5,7 +5,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.fxc.hlsl
index 34850f7..a005ee0 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -5,7 +5,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.glsl
index 0617d4a..af84d7b 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.glsl
@@ -8,7 +8,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.msl
index 730082a..1988e2f 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.msl
@@ -17,7 +17,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol_2) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol_2, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.spvasm
index d6f47a8..ea1b3de 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 57
+; Bound: 60
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -41,61 +41,67 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
-       %bool = OpTypeBool
+         %25 = OpTypeFunction %void
 %x__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool
-         %25 = OpConstantNull %x__atomic_compare_exchange_resultu32
+         %29 = OpConstantNull %x__atomic_compare_exchange_resultu32
 %_ptr_Function_x__atomic_compare_exchange_resultu32 = OpTypePointer Function %x__atomic_compare_exchange_resultu32
 %__atomic_compare_exchange_result_u32 = OpTypeStruct %uint %bool
-     %uint_1 = OpConstant %uint 1
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicCompareExchangeWeak_83580d = OpFunction %void None %20
-         %22 = OpLabel
-        %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resultu32 Function %25
-               OpStore %res %25
-         %32 = OpAtomicCompareExchange %uint %arg_0 %uint_2 %uint_0 %uint_0 %uint_1 %uint_1
-         %33 = OpIEqual %bool %32 %uint_1
-         %28 = OpCompositeConstruct %__atomic_compare_exchange_result_u32 %32 %33
-         %34 = OpCompositeExtract %uint %28 0
-         %35 = OpIEqual %bool %34 %uint_1
-         %36 = OpCompositeConstruct %x__atomic_compare_exchange_resultu32 %34 %35
-               OpStore %res %36
+%atomicCompareExchangeWeak_83580d = OpFunction %void None %25
+         %27 = OpLabel
+        %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resultu32 Function %29
+               OpStore %res %29
+         %35 = OpAtomicCompareExchange %uint %arg_0 %uint_2 %uint_0 %uint_0 %uint_1 %uint_1
+         %36 = OpIEqual %bool %35 %uint_1
+         %32 = OpCompositeConstruct %__atomic_compare_exchange_result_u32 %35 %36
+         %37 = OpCompositeExtract %uint %32 0
+         %38 = OpIEqual %bool %37 %uint_1
+         %39 = OpCompositeConstruct %x__atomic_compare_exchange_resultu32 %37 %38
+               OpStore %res %39
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %39 = OpLabel
+         %42 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %43 = OpFunctionCall %void %atomicCompareExchangeWeak_83580d
+         %46 = OpFunctionCall %void %atomicCompareExchangeWeak_83580d
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %45 = OpLabel
-         %46 = OpLoad %uint %local_invocation_index_1
-         %47 = OpFunctionCall %void %compute_main_inner %46
+%compute_main_1 = OpFunction %void None %25
+         %48 = OpLabel
+         %49 = OpLoad %uint %local_invocation_index_1
+         %50 = OpFunctionCall %void %compute_main_inner %49
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %50 = OpLabel
-         %51 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %53 = OpLabel
+         %54 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %52 = OpFunctionCall %void %compute_main_1
+         %55 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %54 = OpLabel
-         %56 = OpLoad %uint %local_invocation_index_1_param_1
-         %55 = OpFunctionCall %void %compute_main_inner_1 %56
+%compute_main = OpFunction %void None %25
+         %57 = OpLabel
+         %59 = OpLoad %uint %local_invocation_index_1_param_1
+         %58 = OpFunctionCall %void %compute_main_inner_1 %59
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.dxc.hlsl
index c5fc710..5effe9b 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.fxc.hlsl
index c5fc710..5effe9b 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.glsl
index 390124a..2039c82 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.msl
index 18ab94f..92d18ee 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.spvasm
index f2a6818..dc75e4a 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 50
+; Bound: 55
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,53 +32,61 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicExchange_e114ba = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %19
-               OpStore %res %19
-         %27 = OpAtomicExchange %int %arg_0 %uint_2 %uint_0 %int_1
-               OpStore %res %27
+%atomicExchange_e114ba = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %24
+               OpStore %res %24
+         %32 = OpAtomicExchange %int %arg_0 %uint_2 %uint_0 %int_1
+               OpStore %res %32
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %32 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %37 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %36 = OpFunctionCall %void %atomicExchange_e114ba
+         %41 = OpFunctionCall %void %atomicExchange_e114ba
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %38 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %39
+%compute_main_1 = OpFunction %void None %27
+         %43 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %44
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %43 = OpLabel
-         %44 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %48 = OpLabel
+         %49 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %45 = OpFunctionCall %void %compute_main_1
+         %50 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %47 = OpLabel
-         %49 = OpLoad %uint %local_invocation_index_1_param_1
-         %48 = OpFunctionCall %void %compute_main_inner_1 %49
+%compute_main = OpFunction %void None %27
+         %52 = OpLabel
+         %54 = OpLoad %uint %local_invocation_index_1_param_1
+         %53 = OpFunctionCall %void %compute_main_inner_1 %54
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.dxc.hlsl
index 5a6f325..78d0a13 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.fxc.hlsl
index 5a6f325..78d0a13 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.glsl
index 70098ef..21c232a 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.msl
index 8eaeb8c..e89935f 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.spvasm
index c16ff45..ccc39ce 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 48
+; Bound: 52
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -31,52 +31,59 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-     %uint_1 = OpConstant %uint 1
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicExchange_0a5dca = OpFunction %void None %20
-         %22 = OpLabel
+%atomicExchange_0a5dca = OpFunction %void None %25
+         %27 = OpLabel
         %res = OpVariable %_ptr_Function_uint Function %6
                OpStore %res %6
-         %25 = OpAtomicExchange %uint %arg_0 %uint_2 %uint_0 %uint_1
-               OpStore %res %25
+         %30 = OpAtomicExchange %uint %arg_0 %uint_2 %uint_0 %uint_1
+               OpStore %res %30
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %30 = OpLabel
+         %34 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %34 = OpFunctionCall %void %atomicExchange_0a5dca
+         %38 = OpFunctionCall %void %atomicExchange_0a5dca
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %36 = OpLabel
-         %37 = OpLoad %uint %local_invocation_index_1
-         %38 = OpFunctionCall %void %compute_main_inner %37
+%compute_main_1 = OpFunction %void None %25
+         %40 = OpLabel
+         %41 = OpLoad %uint %local_invocation_index_1
+         %42 = OpFunctionCall %void %compute_main_inner %41
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %41 = OpLabel
-         %42 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %45 = OpLabel
+         %46 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %43 = OpFunctionCall %void %compute_main_1
+         %47 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %45 = OpLabel
-         %47 = OpLoad %uint %local_invocation_index_1_param_1
-         %46 = OpFunctionCall %void %compute_main_inner_1 %47
+%compute_main = OpFunction %void None %25
+         %49 = OpLabel
+         %51 = OpLoad %uint %local_invocation_index_1_param_1
+         %50 = OpFunctionCall %void %compute_main_inner_1 %51
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.dxc.hlsl
index 4237e00..a13e9f1 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.fxc.hlsl
index 4237e00..a13e9f1 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.glsl
index ec9f268..85d2f41 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.msl
index 04ea766..948b07a 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.spvasm
index b3f1170..641606f 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 49
+; Bound: 54
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,52 +32,60 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicLoad_afcc03 = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %19
-               OpStore %res %19
-         %27 = OpAtomicLoad %int %arg_0 %uint_2 %uint_0
-               OpStore %res %27
+%atomicLoad_afcc03 = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %24
+               OpStore %res %24
+         %32 = OpAtomicLoad %int %arg_0 %uint_2 %uint_0
+               OpStore %res %32
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %31 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %36 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %35 = OpFunctionCall %void %atomicLoad_afcc03
+         %40 = OpFunctionCall %void %atomicLoad_afcc03
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %37 = OpLabel
-         %38 = OpLoad %uint %local_invocation_index_1
-         %39 = OpFunctionCall %void %compute_main_inner %38
+%compute_main_1 = OpFunction %void None %27
+         %42 = OpLabel
+         %43 = OpLoad %uint %local_invocation_index_1
+         %44 = OpFunctionCall %void %compute_main_inner %43
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %42 = OpLabel
-         %43 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %47 = OpLabel
+         %48 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %44 = OpFunctionCall %void %compute_main_1
+         %49 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %46 = OpLabel
-         %48 = OpLoad %uint %local_invocation_index_1_param_1
-         %47 = OpFunctionCall %void %compute_main_inner_1 %48
+%compute_main = OpFunction %void None %27
+         %51 = OpLabel
+         %53 = OpLoad %uint %local_invocation_index_1_param_1
+         %52 = OpFunctionCall %void %compute_main_inner_1 %53
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.dxc.hlsl
index 2d67bbf..89372e1 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.fxc.hlsl
index 2d67bbf..89372e1 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.glsl
index 9d95d4f..554fab8 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.msl
index 71c5c7a..6aa8d8c 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.spvasm
index f8bd920..a3fbd12 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 47
+; Bound: 52
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -31,51 +31,59 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicLoad_361bf1 = OpFunction %void None %20
-         %22 = OpLabel
+%atomicLoad_361bf1 = OpFunction %void None %25
+         %27 = OpLabel
         %res = OpVariable %_ptr_Function_uint Function %6
                OpStore %res %6
-         %25 = OpAtomicLoad %uint %arg_0 %uint_2 %uint_0
-               OpStore %res %25
+         %30 = OpAtomicLoad %uint %arg_0 %uint_2 %uint_0
+               OpStore %res %30
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %29 = OpLabel
+         %34 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %33 = OpFunctionCall %void %atomicLoad_361bf1
+         %38 = OpFunctionCall %void %atomicLoad_361bf1
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %35 = OpLabel
-         %36 = OpLoad %uint %local_invocation_index_1
-         %37 = OpFunctionCall %void %compute_main_inner %36
+%compute_main_1 = OpFunction %void None %25
+         %40 = OpLabel
+         %41 = OpLoad %uint %local_invocation_index_1
+         %42 = OpFunctionCall %void %compute_main_inner %41
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %40 = OpLabel
-         %41 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %45 = OpLabel
+         %46 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %42 = OpFunctionCall %void %compute_main_1
+         %47 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %44 = OpLabel
-         %46 = OpLoad %uint %local_invocation_index_1_param_1
-         %45 = OpFunctionCall %void %compute_main_inner_1 %46
+%compute_main = OpFunction %void None %25
+         %49 = OpLabel
+         %51 = OpLoad %uint %local_invocation_index_1_param_1
+         %50 = OpFunctionCall %void %compute_main_inner_1 %51
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.dxc.hlsl
index 3947420..d5dd355 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.fxc.hlsl
index 3947420..d5dd355 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.glsl
index 35f4cae..b99604b 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.msl
index 6f4adee..b87534f 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.spvasm
index 4b89933..89fa3dd 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 50
+; Bound: 55
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,53 +32,61 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicMax_a89cc3 = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %19
-               OpStore %res %19
-         %27 = OpAtomicSMax %int %arg_0 %uint_2 %uint_0 %int_1
-               OpStore %res %27
+%atomicMax_a89cc3 = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %24
+               OpStore %res %24
+         %32 = OpAtomicSMax %int %arg_0 %uint_2 %uint_0 %int_1
+               OpStore %res %32
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %32 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %37 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %36 = OpFunctionCall %void %atomicMax_a89cc3
+         %41 = OpFunctionCall %void %atomicMax_a89cc3
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %38 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %39
+%compute_main_1 = OpFunction %void None %27
+         %43 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %44
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %43 = OpLabel
-         %44 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %48 = OpLabel
+         %49 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %45 = OpFunctionCall %void %compute_main_1
+         %50 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %47 = OpLabel
-         %49 = OpLoad %uint %local_invocation_index_1_param_1
-         %48 = OpFunctionCall %void %compute_main_inner_1 %49
+%compute_main = OpFunction %void None %27
+         %52 = OpLabel
+         %54 = OpLoad %uint %local_invocation_index_1_param_1
+         %53 = OpFunctionCall %void %compute_main_inner_1 %54
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.dxc.hlsl
index a058827..d2132ee 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.fxc.hlsl
index a058827..d2132ee 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.glsl
index 6ac343e..ad7b0b6 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.msl
index ec782f9..a855347 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.spvasm
index 491885c..6842bf3 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 48
+; Bound: 52
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -31,52 +31,59 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-     %uint_1 = OpConstant %uint 1
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicMax_beccfc = OpFunction %void None %20
-         %22 = OpLabel
+%atomicMax_beccfc = OpFunction %void None %25
+         %27 = OpLabel
         %res = OpVariable %_ptr_Function_uint Function %6
                OpStore %res %6
-         %25 = OpAtomicUMax %uint %arg_0 %uint_2 %uint_0 %uint_1
-               OpStore %res %25
+         %30 = OpAtomicUMax %uint %arg_0 %uint_2 %uint_0 %uint_1
+               OpStore %res %30
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %30 = OpLabel
+         %34 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %34 = OpFunctionCall %void %atomicMax_beccfc
+         %38 = OpFunctionCall %void %atomicMax_beccfc
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %36 = OpLabel
-         %37 = OpLoad %uint %local_invocation_index_1
-         %38 = OpFunctionCall %void %compute_main_inner %37
+%compute_main_1 = OpFunction %void None %25
+         %40 = OpLabel
+         %41 = OpLoad %uint %local_invocation_index_1
+         %42 = OpFunctionCall %void %compute_main_inner %41
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %41 = OpLabel
-         %42 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %45 = OpLabel
+         %46 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %43 = OpFunctionCall %void %compute_main_1
+         %47 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %45 = OpLabel
-         %47 = OpLoad %uint %local_invocation_index_1_param_1
-         %46 = OpFunctionCall %void %compute_main_inner_1 %47
+%compute_main = OpFunction %void None %25
+         %49 = OpLabel
+         %51 = OpLoad %uint %local_invocation_index_1_param_1
+         %50 = OpFunctionCall %void %compute_main_inner_1 %51
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.dxc.hlsl
index f3e3312..94e8cfe 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.fxc.hlsl
index f3e3312..94e8cfe 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.glsl
index 43630f2..54e0201 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.msl
index 25562e8..1538323 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.spvasm
index ed85af7..748842f 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 50
+; Bound: 55
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,53 +32,61 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicMin_278235 = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %19
-               OpStore %res %19
-         %27 = OpAtomicSMin %int %arg_0 %uint_2 %uint_0 %int_1
-               OpStore %res %27
+%atomicMin_278235 = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %24
+               OpStore %res %24
+         %32 = OpAtomicSMin %int %arg_0 %uint_2 %uint_0 %int_1
+               OpStore %res %32
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %32 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %37 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %36 = OpFunctionCall %void %atomicMin_278235
+         %41 = OpFunctionCall %void %atomicMin_278235
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %38 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %39
+%compute_main_1 = OpFunction %void None %27
+         %43 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %44
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %43 = OpLabel
-         %44 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %48 = OpLabel
+         %49 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %45 = OpFunctionCall %void %compute_main_1
+         %50 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %47 = OpLabel
-         %49 = OpLoad %uint %local_invocation_index_1_param_1
-         %48 = OpFunctionCall %void %compute_main_inner_1 %49
+%compute_main = OpFunction %void None %27
+         %52 = OpLabel
+         %54 = OpLoad %uint %local_invocation_index_1_param_1
+         %53 = OpFunctionCall %void %compute_main_inner_1 %54
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.dxc.hlsl
index 904b0b1..dc36e72 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.fxc.hlsl
index 904b0b1..dc36e72 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.glsl
index 6cb3a45..886331b 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.msl
index 44cc253..0c9fe82 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.spvasm
index 03ed3b8..c2d0678 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 48
+; Bound: 52
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -31,52 +31,59 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-     %uint_1 = OpConstant %uint 1
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicMin_69d383 = OpFunction %void None %20
-         %22 = OpLabel
+%atomicMin_69d383 = OpFunction %void None %25
+         %27 = OpLabel
         %res = OpVariable %_ptr_Function_uint Function %6
                OpStore %res %6
-         %25 = OpAtomicUMin %uint %arg_0 %uint_2 %uint_0 %uint_1
-               OpStore %res %25
+         %30 = OpAtomicUMin %uint %arg_0 %uint_2 %uint_0 %uint_1
+               OpStore %res %30
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %30 = OpLabel
+         %34 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %34 = OpFunctionCall %void %atomicMin_69d383
+         %38 = OpFunctionCall %void %atomicMin_69d383
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %36 = OpLabel
-         %37 = OpLoad %uint %local_invocation_index_1
-         %38 = OpFunctionCall %void %compute_main_inner %37
+%compute_main_1 = OpFunction %void None %25
+         %40 = OpLabel
+         %41 = OpLoad %uint %local_invocation_index_1
+         %42 = OpFunctionCall %void %compute_main_inner %41
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %41 = OpLabel
-         %42 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %45 = OpLabel
+         %46 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %43 = OpFunctionCall %void %compute_main_1
+         %47 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %45 = OpLabel
-         %47 = OpLoad %uint %local_invocation_index_1_param_1
-         %46 = OpFunctionCall %void %compute_main_inner_1 %47
+%compute_main = OpFunction %void None %25
+         %49 = OpLabel
+         %51 = OpLoad %uint %local_invocation_index_1_param_1
+         %50 = OpFunctionCall %void %compute_main_inner_1 %51
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.dxc.hlsl
index a24d69f..8b501ca 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.fxc.hlsl
index a24d69f..8b501ca 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.glsl
index a3ec49d..64faa5e 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.msl
index 8b680cd..8a25f0f 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.spvasm
index 196b055..da21d7f 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 50
+; Bound: 55
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,53 +32,61 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicOr_d09248 = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %19
-               OpStore %res %19
-         %27 = OpAtomicOr %int %arg_0 %uint_2 %uint_0 %int_1
-               OpStore %res %27
+%atomicOr_d09248 = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %24
+               OpStore %res %24
+         %32 = OpAtomicOr %int %arg_0 %uint_2 %uint_0 %int_1
+               OpStore %res %32
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %32 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %37 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %36 = OpFunctionCall %void %atomicOr_d09248
+         %41 = OpFunctionCall %void %atomicOr_d09248
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %38 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %39
+%compute_main_1 = OpFunction %void None %27
+         %43 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %44
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %43 = OpLabel
-         %44 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %48 = OpLabel
+         %49 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %45 = OpFunctionCall %void %compute_main_1
+         %50 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %47 = OpLabel
-         %49 = OpLoad %uint %local_invocation_index_1_param_1
-         %48 = OpFunctionCall %void %compute_main_inner_1 %49
+%compute_main = OpFunction %void None %27
+         %52 = OpLabel
+         %54 = OpLoad %uint %local_invocation_index_1_param_1
+         %53 = OpFunctionCall %void %compute_main_inner_1 %54
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.dxc.hlsl
index 2f99372..c8e400b 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.fxc.hlsl
index 2f99372..c8e400b 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.glsl
index 57a7f05..948b674 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.msl
index 11ea735..2c2ebbc 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.spvasm
index 9274bad..15133d9 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 48
+; Bound: 52
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -31,52 +31,59 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-     %uint_1 = OpConstant %uint 1
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicOr_5e3d61 = OpFunction %void None %20
-         %22 = OpLabel
+%atomicOr_5e3d61 = OpFunction %void None %25
+         %27 = OpLabel
         %res = OpVariable %_ptr_Function_uint Function %6
                OpStore %res %6
-         %25 = OpAtomicOr %uint %arg_0 %uint_2 %uint_0 %uint_1
-               OpStore %res %25
+         %30 = OpAtomicOr %uint %arg_0 %uint_2 %uint_0 %uint_1
+               OpStore %res %30
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %30 = OpLabel
+         %34 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %34 = OpFunctionCall %void %atomicOr_5e3d61
+         %38 = OpFunctionCall %void %atomicOr_5e3d61
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %36 = OpLabel
-         %37 = OpLoad %uint %local_invocation_index_1
-         %38 = OpFunctionCall %void %compute_main_inner %37
+%compute_main_1 = OpFunction %void None %25
+         %40 = OpLabel
+         %41 = OpLoad %uint %local_invocation_index_1
+         %42 = OpFunctionCall %void %compute_main_inner %41
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %41 = OpLabel
-         %42 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %45 = OpLabel
+         %46 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %43 = OpFunctionCall %void %compute_main_1
+         %47 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %45 = OpLabel
-         %47 = OpLoad %uint %local_invocation_index_1_param_1
-         %46 = OpFunctionCall %void %compute_main_inner_1 %47
+%compute_main = OpFunction %void None %25
+         %49 = OpLabel
+         %51 = OpLoad %uint %local_invocation_index_1_param_1
+         %50 = OpFunctionCall %void %compute_main_inner_1 %51
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.dxc.hlsl
index 7547c94..6fda954 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.fxc.hlsl
index 7547c94..6fda954 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.glsl
index 113b0dd..3eaa8d5 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.msl
index 7bc9beb..c98e08b 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.spvasm
index 8299c15..170fe71 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 48
+; Bound: 53
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -31,49 +31,57 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicStore_8bea94 = OpFunction %void None %22
-         %24 = OpLabel
+%atomicStore_8bea94 = OpFunction %void None %27
+         %29 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %int_1
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %30 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %35 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %34 = OpFunctionCall %void %atomicStore_8bea94
+         %39 = OpFunctionCall %void %atomicStore_8bea94
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %36 = OpLabel
-         %37 = OpLoad %uint %local_invocation_index_1
-         %38 = OpFunctionCall %void %compute_main_inner %37
+%compute_main_1 = OpFunction %void None %27
+         %41 = OpLabel
+         %42 = OpLoad %uint %local_invocation_index_1
+         %43 = OpFunctionCall %void %compute_main_inner %42
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %41 = OpLabel
-         %42 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %46 = OpLabel
+         %47 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %43 = OpFunctionCall %void %compute_main_1
+         %48 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %45 = OpLabel
-         %47 = OpLoad %uint %local_invocation_index_1_param_1
-         %46 = OpFunctionCall %void %compute_main_inner_1 %47
+%compute_main = OpFunction %void None %27
+         %50 = OpLabel
+         %52 = OpLoad %uint %local_invocation_index_1_param_1
+         %51 = OpFunctionCall %void %compute_main_inner_1 %52
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.dxc.hlsl
index a6de548..5ee971f 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.fxc.hlsl
index a6de548..5ee971f 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.glsl
index 1cf2938..0b16b02 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.msl
index d98053a..196e9b1 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.spvasm
index 15494dc..8ea2abf 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 46
+; Bound: 50
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -30,48 +30,55 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
-     %uint_1 = OpConstant %uint 1
+         %25 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicStore_726882 = OpFunction %void None %20
-         %22 = OpLabel
+%atomicStore_726882 = OpFunction %void None %25
+         %27 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %uint_1
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %28 = OpLabel
+         %32 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %32 = OpFunctionCall %void %atomicStore_726882
+         %36 = OpFunctionCall %void %atomicStore_726882
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %34 = OpLabel
-         %35 = OpLoad %uint %local_invocation_index_1
-         %36 = OpFunctionCall %void %compute_main_inner %35
+%compute_main_1 = OpFunction %void None %25
+         %38 = OpLabel
+         %39 = OpLoad %uint %local_invocation_index_1
+         %40 = OpFunctionCall %void %compute_main_inner %39
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %39 = OpLabel
-         %40 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %43 = OpLabel
+         %44 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %41 = OpFunctionCall %void %compute_main_1
+         %45 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %43 = OpLabel
-         %45 = OpLoad %uint %local_invocation_index_1_param_1
-         %44 = OpFunctionCall %void %compute_main_inner_1 %45
+%compute_main = OpFunction %void None %25
+         %47 = OpLabel
+         %49 = OpLoad %uint %local_invocation_index_1_param_1
+         %48 = OpFunctionCall %void %compute_main_inner_1 %49
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.dxc.hlsl
index 66671f7..fb1e091 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.fxc.hlsl
index 66671f7..fb1e091 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.glsl
index fd55337..a115ed8 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.msl
index d3b3e31..7fe8c8e 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.spvasm
index 330815c..6a2bdca 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 50
+; Bound: 55
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,53 +32,61 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicSub_77883a = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %19
-               OpStore %res %19
-         %27 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %int_1
-               OpStore %res %27
+%atomicSub_77883a = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %24
+               OpStore %res %24
+         %32 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %int_1
+               OpStore %res %32
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %32 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %37 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %36 = OpFunctionCall %void %atomicSub_77883a
+         %41 = OpFunctionCall %void %atomicSub_77883a
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %38 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %39
+%compute_main_1 = OpFunction %void None %27
+         %43 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %44
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %43 = OpLabel
-         %44 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %48 = OpLabel
+         %49 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %45 = OpFunctionCall %void %compute_main_1
+         %50 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %47 = OpLabel
-         %49 = OpLoad %uint %local_invocation_index_1_param_1
-         %48 = OpFunctionCall %void %compute_main_inner_1 %49
+%compute_main = OpFunction %void None %27
+         %52 = OpLabel
+         %54 = OpLoad %uint %local_invocation_index_1_param_1
+         %53 = OpFunctionCall %void %compute_main_inner_1 %54
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.dxc.hlsl
index f6a4015..ca7ee90 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.fxc.hlsl
index f6a4015..ca7ee90 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.glsl
index 768ef86..1eb6788 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.msl
index 6d2035a..ae4d9d9 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.spvasm
index e36fe70..2195390 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 48
+; Bound: 52
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -31,52 +31,59 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-     %uint_1 = OpConstant %uint 1
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicSub_0d26c2 = OpFunction %void None %20
-         %22 = OpLabel
+%atomicSub_0d26c2 = OpFunction %void None %25
+         %27 = OpLabel
         %res = OpVariable %_ptr_Function_uint Function %6
                OpStore %res %6
-         %25 = OpAtomicISub %uint %arg_0 %uint_2 %uint_0 %uint_1
-               OpStore %res %25
+         %30 = OpAtomicISub %uint %arg_0 %uint_2 %uint_0 %uint_1
+               OpStore %res %30
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %30 = OpLabel
+         %34 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %34 = OpFunctionCall %void %atomicSub_0d26c2
+         %38 = OpFunctionCall %void %atomicSub_0d26c2
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %36 = OpLabel
-         %37 = OpLoad %uint %local_invocation_index_1
-         %38 = OpFunctionCall %void %compute_main_inner %37
+%compute_main_1 = OpFunction %void None %25
+         %40 = OpLabel
+         %41 = OpLoad %uint %local_invocation_index_1
+         %42 = OpFunctionCall %void %compute_main_inner %41
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %41 = OpLabel
-         %42 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %45 = OpLabel
+         %46 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %43 = OpFunctionCall %void %compute_main_1
+         %47 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %45 = OpLabel
-         %47 = OpLoad %uint %local_invocation_index_1_param_1
-         %46 = OpFunctionCall %void %compute_main_inner_1 %47
+%compute_main = OpFunction %void None %25
+         %49 = OpLabel
+         %51 = OpLoad %uint %local_invocation_index_1_param_1
+         %50 = OpFunctionCall %void %compute_main_inner_1 %51
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.dxc.hlsl
index 3c6d675..e726e1e 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.fxc.hlsl
index 3c6d675..e726e1e 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.glsl
index 3834e15..be90f18 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.msl
index b00f3b6..1d60525 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.spvasm
index 782271f..0f549ec 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 50
+; Bound: 55
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,53 +32,61 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicXor_75dc95 = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %19
-               OpStore %res %19
-         %27 = OpAtomicXor %int %arg_0 %uint_2 %uint_0 %int_1
-               OpStore %res %27
+%atomicXor_75dc95 = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %24
+               OpStore %res %24
+         %32 = OpAtomicXor %int %arg_0 %uint_2 %uint_0 %int_1
+               OpStore %res %32
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %32 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %37 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %36 = OpFunctionCall %void %atomicXor_75dc95
+         %41 = OpFunctionCall %void %atomicXor_75dc95
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %38 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %39
+%compute_main_1 = OpFunction %void None %27
+         %43 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %44
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %43 = OpLabel
-         %44 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %48 = OpLabel
+         %49 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %45 = OpFunctionCall %void %compute_main_1
+         %50 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %47 = OpLabel
-         %49 = OpLoad %uint %local_invocation_index_1_param_1
-         %48 = OpFunctionCall %void %compute_main_inner_1 %49
+%compute_main = OpFunction %void None %27
+         %52 = OpLabel
+         %54 = OpLoad %uint %local_invocation_index_1_param_1
+         %53 = OpFunctionCall %void %compute_main_inner_1 %54
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.dxc.hlsl
index 0230e2a..5f41669 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.fxc.hlsl
index 0230e2a..5f41669 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.glsl
index 6af2f4e..ee34f27 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.msl
index f51e07a..9b7bdc9 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.spvasm
index aec1a6c..b88ee4b 100644
--- a/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 48
+; Bound: 52
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -31,52 +31,59 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-     %uint_1 = OpConstant %uint 1
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicXor_c8e6be = OpFunction %void None %20
-         %22 = OpLabel
+%atomicXor_c8e6be = OpFunction %void None %25
+         %27 = OpLabel
         %res = OpVariable %_ptr_Function_uint Function %6
                OpStore %res %6
-         %25 = OpAtomicXor %uint %arg_0 %uint_2 %uint_0 %uint_1
-               OpStore %res %25
+         %30 = OpAtomicXor %uint %arg_0 %uint_2 %uint_0 %uint_1
+               OpStore %res %30
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %30 = OpLabel
+         %34 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %34 = OpFunctionCall %void %atomicXor_c8e6be
+         %38 = OpFunctionCall %void %atomicXor_c8e6be
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %36 = OpLabel
-         %37 = OpLoad %uint %local_invocation_index_1
-         %38 = OpFunctionCall %void %compute_main_inner %37
+%compute_main_1 = OpFunction %void None %25
+         %40 = OpLabel
+         %41 = OpLoad %uint %local_invocation_index_1
+         %42 = OpFunctionCall %void %compute_main_inner %41
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %41 = OpLabel
-         %42 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %45 = OpLabel
+         %46 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %43 = OpFunctionCall %void %compute_main_1
+         %47 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %45 = OpLabel
-         %47 = OpLoad %uint %local_invocation_index_1_param_1
-         %46 = OpFunctionCall %void %compute_main_inner_1 %47
+%compute_main = OpFunction %void None %25
+         %49 = OpLabel
+         %51 = OpLoad %uint %local_invocation_index_1_param_1
+         %50 = OpFunctionCall %void %compute_main_inner_1 %51
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.dxc.hlsl
index b5c655a..5f9aae8 100644
--- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.fxc.hlsl
index b5c655a..5f9aae8 100644
--- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.glsl
index e1ab640..2f96e86 100644
--- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.msl
index 97760d1..82fed53 100644
--- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.spvasm
index 91141ef..c052d90 100644
--- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 50
+; Bound: 55
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,53 +32,61 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAdd_794055 = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %19
-               OpStore %res %19
-         %27 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %int_1
-               OpStore %res %27
+%atomicAdd_794055 = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %24
+               OpStore %res %24
+         %32 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %int_1
+               OpStore %res %32
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %32 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %37 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %36 = OpFunctionCall %void %atomicAdd_794055
+         %41 = OpFunctionCall %void %atomicAdd_794055
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %38 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %39
+%compute_main_1 = OpFunction %void None %27
+         %43 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %44
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %43 = OpLabel
-         %44 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %48 = OpLabel
+         %49 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %45 = OpFunctionCall %void %compute_main_1
+         %50 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %47 = OpLabel
-         %49 = OpLoad %uint %local_invocation_index_1_param_1
-         %48 = OpFunctionCall %void %compute_main_inner_1 %49
+%compute_main = OpFunction %void None %27
+         %52 = OpLabel
+         %54 = OpLoad %uint %local_invocation_index_1_param_1
+         %53 = OpFunctionCall %void %compute_main_inner_1 %54
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.dxc.hlsl
index 3d9eba1..f573e9e 100644
--- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.fxc.hlsl
index 3d9eba1..f573e9e 100644
--- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.glsl
index 859a45e..53e0e90 100644
--- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.msl
index 7375d1c..baf65cf 100644
--- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.spvasm
index e5a6145..280a7ae 100644
--- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 48
+; Bound: 52
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -31,52 +31,59 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-     %uint_1 = OpConstant %uint 1
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAdd_d5db1d = OpFunction %void None %20
-         %22 = OpLabel
+%atomicAdd_d5db1d = OpFunction %void None %25
+         %27 = OpLabel
         %res = OpVariable %_ptr_Function_uint Function %6
                OpStore %res %6
-         %25 = OpAtomicISub %uint %arg_0 %uint_2 %uint_0 %uint_1
-               OpStore %res %25
+         %30 = OpAtomicISub %uint %arg_0 %uint_2 %uint_0 %uint_1
+               OpStore %res %30
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %30 = OpLabel
+         %34 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %34 = OpFunctionCall %void %atomicAdd_d5db1d
+         %38 = OpFunctionCall %void %atomicAdd_d5db1d
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %36 = OpLabel
-         %37 = OpLoad %uint %local_invocation_index_1
-         %38 = OpFunctionCall %void %compute_main_inner %37
+%compute_main_1 = OpFunction %void None %25
+         %40 = OpLabel
+         %41 = OpLoad %uint %local_invocation_index_1
+         %42 = OpFunctionCall %void %compute_main_inner %41
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %41 = OpLabel
-         %42 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %45 = OpLabel
+         %46 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %43 = OpFunctionCall %void %compute_main_1
+         %47 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %45 = OpLabel
-         %47 = OpLoad %uint %local_invocation_index_1_param_1
-         %46 = OpFunctionCall %void %compute_main_inner_1 %47
+%compute_main = OpFunction %void None %25
+         %49 = OpLabel
+         %51 = OpLoad %uint %local_invocation_index_1_param_1
+         %50 = OpFunctionCall %void %compute_main_inner_1 %51
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.dxc.hlsl
index 84a5765..bfcb3ee 100644
--- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.fxc.hlsl
index 84a5765..bfcb3ee 100644
--- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.glsl
index 4ca850a..2fd2fac 100644
--- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.msl
index e11ec06..e7d8db8 100644
--- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.spvasm
index 86e88a1..88d9a19 100644
--- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 50
+; Bound: 55
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,53 +32,61 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAdd_794055 = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %19
-               OpStore %res %19
-         %27 = OpAtomicIAdd %int %arg_0 %uint_2 %uint_0 %int_1
-               OpStore %res %27
+%atomicAdd_794055 = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %24
+               OpStore %res %24
+         %32 = OpAtomicIAdd %int %arg_0 %uint_2 %uint_0 %int_1
+               OpStore %res %32
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %32 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %37 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %36 = OpFunctionCall %void %atomicAdd_794055
+         %41 = OpFunctionCall %void %atomicAdd_794055
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %38 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %39
+%compute_main_1 = OpFunction %void None %27
+         %43 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %44
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %43 = OpLabel
-         %44 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %48 = OpLabel
+         %49 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %45 = OpFunctionCall %void %compute_main_1
+         %50 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %47 = OpLabel
-         %49 = OpLoad %uint %local_invocation_index_1_param_1
-         %48 = OpFunctionCall %void %compute_main_inner_1 %49
+%compute_main = OpFunction %void None %27
+         %52 = OpLabel
+         %54 = OpLoad %uint %local_invocation_index_1_param_1
+         %53 = OpFunctionCall %void %compute_main_inner_1 %54
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.dxc.hlsl
index 7e2d4ee..f3c710a 100644
--- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.fxc.hlsl
index 7e2d4ee..f3c710a 100644
--- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.glsl
index 87fb3fd..16f2f43 100644
--- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.msl
index dfc2d5b..9095a82 100644
--- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.spvasm
index 5f4d6de..f71a715 100644
--- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 48
+; Bound: 52
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -31,52 +31,59 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-     %uint_1 = OpConstant %uint 1
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAdd_d5db1d = OpFunction %void None %20
-         %22 = OpLabel
+%atomicAdd_d5db1d = OpFunction %void None %25
+         %27 = OpLabel
         %res = OpVariable %_ptr_Function_uint Function %6
                OpStore %res %6
-         %25 = OpAtomicIAdd %uint %arg_0 %uint_2 %uint_0 %uint_1
-               OpStore %res %25
+         %30 = OpAtomicIAdd %uint %arg_0 %uint_2 %uint_0 %uint_1
+               OpStore %res %30
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %30 = OpLabel
+         %34 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %34 = OpFunctionCall %void %atomicAdd_d5db1d
+         %38 = OpFunctionCall %void %atomicAdd_d5db1d
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %36 = OpLabel
-         %37 = OpLoad %uint %local_invocation_index_1
-         %38 = OpFunctionCall %void %compute_main_inner %37
+%compute_main_1 = OpFunction %void None %25
+         %40 = OpLabel
+         %41 = OpLoad %uint %local_invocation_index_1
+         %42 = OpFunctionCall %void %compute_main_inner %41
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %41 = OpLabel
-         %42 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %45 = OpLabel
+         %46 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %43 = OpFunctionCall %void %compute_main_1
+         %47 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %45 = OpLabel
-         %47 = OpLoad %uint %local_invocation_index_1_param_1
-         %46 = OpFunctionCall %void %compute_main_inner_1 %47
+%compute_main = OpFunction %void None %25
+         %49 = OpLabel
+         %51 = OpLoad %uint %local_invocation_index_1_param_1
+         %50 = OpFunctionCall %void %compute_main_inner_1 %51
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.dxc.hlsl
index 110f4ee..1ececd5 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.fxc.hlsl
index 110f4ee..1ececd5 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.glsl
index 80a90e7..5777967 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.msl
index 863f673..0399a1a 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.spvasm
index ff5c551..98fb4fc 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 52
+; Bound: 57
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -33,57 +33,65 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAdd_794055 = OpFunction %void None %22
-         %24 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_int Function %19
-        %res = OpVariable %_ptr_Function_int Function %19
-               OpStore %arg_1 %19
-               OpStore %res %19
+%atomicAdd_794055 = OpFunction %void None %27
+         %29 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_int Function %24
+        %res = OpVariable %_ptr_Function_int Function %24
+               OpStore %arg_1 %24
+               OpStore %res %24
                OpStore %arg_1 %int_1
-         %29 = OpLoad %int %arg_1
-         %30 = OpAtomicIAdd %int %arg_0 %uint_2 %uint_0 %29
-               OpStore %res %30
+         %34 = OpLoad %int %arg_1
+         %35 = OpAtomicIAdd %int %arg_0 %uint_2 %uint_0 %34
+               OpStore %res %35
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %34 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %39 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %38 = OpFunctionCall %void %atomicAdd_794055
+         %43 = OpFunctionCall %void %atomicAdd_794055
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %40 = OpLabel
-         %41 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %41
+%compute_main_1 = OpFunction %void None %27
+         %45 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %47 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %45 = OpLabel
-         %46 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %50 = OpLabel
+         %51 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %47 = OpFunctionCall %void %compute_main_1
+         %52 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %49 = OpLabel
-         %51 = OpLoad %uint %local_invocation_index_1_param_1
-         %50 = OpFunctionCall %void %compute_main_inner_1 %51
+%compute_main = OpFunction %void None %27
+         %54 = OpLabel
+         %56 = OpLoad %uint %local_invocation_index_1_param_1
+         %55 = OpFunctionCall %void %compute_main_inner_1 %56
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.dxc.hlsl
index 806d0fe..e440393 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.fxc.hlsl
index 806d0fe..e440393 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.glsl
index 4f13265..e6cd2a5 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.msl
index 9d032f8..e5c5e31 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.spvasm
index 86a0461..d6b75c1 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 50
+; Bound: 54
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,56 +32,63 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-     %uint_1 = OpConstant %uint 1
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAdd_d5db1d = OpFunction %void None %20
-         %22 = OpLabel
+%atomicAdd_d5db1d = OpFunction %void None %25
+         %27 = OpLabel
       %arg_1 = OpVariable %_ptr_Function_uint Function %6
         %res = OpVariable %_ptr_Function_uint Function %6
                OpStore %arg_1 %6
                OpStore %res %6
                OpStore %arg_1 %uint_1
-         %27 = OpLoad %uint %arg_1
-         %28 = OpAtomicIAdd %uint %arg_0 %uint_2 %uint_0 %27
-               OpStore %res %28
+         %31 = OpLoad %uint %arg_1
+         %32 = OpAtomicIAdd %uint %arg_0 %uint_2 %uint_0 %31
+               OpStore %res %32
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %32 = OpLabel
+         %36 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %36 = OpFunctionCall %void %atomicAdd_d5db1d
+         %40 = OpFunctionCall %void %atomicAdd_d5db1d
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %38 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %39
+%compute_main_1 = OpFunction %void None %25
+         %42 = OpLabel
+         %43 = OpLoad %uint %local_invocation_index_1
+         %44 = OpFunctionCall %void %compute_main_inner %43
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %43 = OpLabel
-         %44 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %47 = OpLabel
+         %48 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %45 = OpFunctionCall %void %compute_main_1
+         %49 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %47 = OpLabel
-         %49 = OpLoad %uint %local_invocation_index_1_param_1
-         %48 = OpFunctionCall %void %compute_main_inner_1 %49
+%compute_main = OpFunction %void None %25
+         %51 = OpLabel
+         %53 = OpLoad %uint %local_invocation_index_1_param_1
+         %52 = OpFunctionCall %void %compute_main_inner_1 %53
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.dxc.hlsl
index 69a1ba0..830b231 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.fxc.hlsl
index 69a1ba0..830b231 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.glsl
index 8933010..f2ced61 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.msl
index 6c2cc2c..c7b1c22 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.spvasm
index db95e38..4f7c359 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 52
+; Bound: 57
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -33,57 +33,65 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAnd_45a819 = OpFunction %void None %22
-         %24 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_int Function %19
-        %res = OpVariable %_ptr_Function_int Function %19
-               OpStore %arg_1 %19
-               OpStore %res %19
+%atomicAnd_45a819 = OpFunction %void None %27
+         %29 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_int Function %24
+        %res = OpVariable %_ptr_Function_int Function %24
+               OpStore %arg_1 %24
+               OpStore %res %24
                OpStore %arg_1 %int_1
-         %29 = OpLoad %int %arg_1
-         %30 = OpAtomicAnd %int %arg_0 %uint_2 %uint_0 %29
-               OpStore %res %30
+         %34 = OpLoad %int %arg_1
+         %35 = OpAtomicAnd %int %arg_0 %uint_2 %uint_0 %34
+               OpStore %res %35
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %34 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %39 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %38 = OpFunctionCall %void %atomicAnd_45a819
+         %43 = OpFunctionCall %void %atomicAnd_45a819
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %40 = OpLabel
-         %41 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %41
+%compute_main_1 = OpFunction %void None %27
+         %45 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %47 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %45 = OpLabel
-         %46 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %50 = OpLabel
+         %51 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %47 = OpFunctionCall %void %compute_main_1
+         %52 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %49 = OpLabel
-         %51 = OpLoad %uint %local_invocation_index_1_param_1
-         %50 = OpFunctionCall %void %compute_main_inner_1 %51
+%compute_main = OpFunction %void None %27
+         %54 = OpLabel
+         %56 = OpLoad %uint %local_invocation_index_1_param_1
+         %55 = OpFunctionCall %void %compute_main_inner_1 %56
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.dxc.hlsl
index a054fb6..80deb9b 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.fxc.hlsl
index a054fb6..80deb9b 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.glsl
index 7afebe1..c85d4c1 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.msl
index 461019d..f4e206b 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.spvasm
index 7be0169..eee71c2 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 50
+; Bound: 54
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,56 +32,63 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-     %uint_1 = OpConstant %uint 1
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAnd_34edd3 = OpFunction %void None %20
-         %22 = OpLabel
+%atomicAnd_34edd3 = OpFunction %void None %25
+         %27 = OpLabel
       %arg_1 = OpVariable %_ptr_Function_uint Function %6
         %res = OpVariable %_ptr_Function_uint Function %6
                OpStore %arg_1 %6
                OpStore %res %6
                OpStore %arg_1 %uint_1
-         %27 = OpLoad %uint %arg_1
-         %28 = OpAtomicAnd %uint %arg_0 %uint_2 %uint_0 %27
-               OpStore %res %28
+         %31 = OpLoad %uint %arg_1
+         %32 = OpAtomicAnd %uint %arg_0 %uint_2 %uint_0 %31
+               OpStore %res %32
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %32 = OpLabel
+         %36 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %36 = OpFunctionCall %void %atomicAnd_34edd3
+         %40 = OpFunctionCall %void %atomicAnd_34edd3
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %38 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %39
+%compute_main_1 = OpFunction %void None %25
+         %42 = OpLabel
+         %43 = OpLoad %uint %local_invocation_index_1
+         %44 = OpFunctionCall %void %compute_main_inner %43
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %43 = OpLabel
-         %44 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %47 = OpLabel
+         %48 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %45 = OpFunctionCall %void %compute_main_1
+         %49 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %47 = OpLabel
-         %49 = OpLoad %uint %local_invocation_index_1_param_1
-         %48 = OpFunctionCall %void %compute_main_inner_1 %49
+%compute_main = OpFunction %void None %25
+         %51 = OpLabel
+         %53 = OpLoad %uint %local_invocation_index_1_param_1
+         %52 = OpFunctionCall %void %compute_main_inner_1 %53
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.dxc.hlsl
index 6e85ae6..517c935 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -5,7 +5,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.fxc.hlsl
index 6e85ae6..517c935 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -5,7 +5,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.glsl
index 48ec843..29a419f 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.glsl
@@ -8,7 +8,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.msl
index 767bf34..990f821 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.msl
@@ -17,7 +17,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol_2) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol_2, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.spvasm
index 8627d31..29b272d 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 64
+; Bound: 68
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -44,71 +44,78 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
-       %bool = OpTypeBool
 %x__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool
-         %30 = OpConstantNull %x__atomic_compare_exchange_resulti32
+         %34 = OpConstantNull %x__atomic_compare_exchange_resulti32
 %_ptr_Function_x__atomic_compare_exchange_resulti32 = OpTypePointer Function %x__atomic_compare_exchange_resulti32
       %int_1 = OpConstant %int 1
 %__atomic_compare_exchange_result_i32 = OpTypeStruct %int %bool
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicCompareExchangeWeak_e88938 = OpFunction %void None %22
-         %24 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_int Function %19
-      %arg_2 = OpVariable %_ptr_Function_int Function %19
-        %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resulti32 Function %30
-               OpStore %arg_1 %19
-               OpStore %arg_2 %19
-               OpStore %res %30
+%atomicCompareExchangeWeak_e88938 = OpFunction %void None %27
+         %29 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_int Function %24
+      %arg_2 = OpVariable %_ptr_Function_int Function %24
+        %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resulti32 Function %34
+               OpStore %arg_1 %24
+               OpStore %arg_2 %24
+               OpStore %res %34
                OpStore %arg_1 %int_1
                OpStore %arg_2 %int_1
-         %34 = OpLoad %int %arg_2
-         %35 = OpLoad %int %arg_1
-         %39 = OpAtomicCompareExchange %int %arg_0 %uint_2 %uint_0 %uint_0 %34 %35
-         %40 = OpIEqual %bool %39 %35
-         %36 = OpCompositeConstruct %__atomic_compare_exchange_result_i32 %39 %40
-         %41 = OpCompositeExtract %int %36 0
-         %42 = OpIEqual %bool %41 %34
-         %43 = OpCompositeConstruct %x__atomic_compare_exchange_resulti32 %41 %42
-               OpStore %res %43
+         %38 = OpLoad %int %arg_2
+         %39 = OpLoad %int %arg_1
+         %43 = OpAtomicCompareExchange %int %arg_0 %uint_2 %uint_0 %uint_0 %38 %39
+         %44 = OpIEqual %bool %43 %39
+         %40 = OpCompositeConstruct %__atomic_compare_exchange_result_i32 %43 %44
+         %45 = OpCompositeExtract %int %40 0
+         %46 = OpIEqual %bool %45 %38
+         %47 = OpCompositeConstruct %x__atomic_compare_exchange_resulti32 %45 %46
+               OpStore %res %47
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %46 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %50 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %50 = OpFunctionCall %void %atomicCompareExchangeWeak_e88938
+         %54 = OpFunctionCall %void %atomicCompareExchangeWeak_e88938
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %52 = OpLabel
-         %53 = OpLoad %uint %local_invocation_index_1
-         %54 = OpFunctionCall %void %compute_main_inner %53
+%compute_main_1 = OpFunction %void None %27
+         %56 = OpLabel
+         %57 = OpLoad %uint %local_invocation_index_1
+         %58 = OpFunctionCall %void %compute_main_inner %57
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %57 = OpLabel
-         %58 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %61 = OpLabel
+         %62 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %59 = OpFunctionCall %void %compute_main_1
+         %63 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %61 = OpLabel
-         %63 = OpLoad %uint %local_invocation_index_1_param_1
-         %62 = OpFunctionCall %void %compute_main_inner_1 %63
+%compute_main = OpFunction %void None %27
+         %65 = OpLabel
+         %67 = OpLoad %uint %local_invocation_index_1_param_1
+         %66 = OpFunctionCall %void %compute_main_inner_1 %67
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.dxc.hlsl
index a1daa58..1955922 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -5,7 +5,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.fxc.hlsl
index a1daa58..1955922 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -5,7 +5,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.glsl
index caae9d2..2f8f503 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.glsl
@@ -8,7 +8,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.msl
index 561cd79..18777ab 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.msl
@@ -17,7 +17,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol_2) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol_2, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.spvasm
index a29ebdd..db3809a 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 62
+; Bound: 65
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -43,70 +43,76 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-       %bool = OpTypeBool
 %x__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool
-         %28 = OpConstantNull %x__atomic_compare_exchange_resultu32
+         %32 = OpConstantNull %x__atomic_compare_exchange_resultu32
 %_ptr_Function_x__atomic_compare_exchange_resultu32 = OpTypePointer Function %x__atomic_compare_exchange_resultu32
-     %uint_1 = OpConstant %uint 1
 %__atomic_compare_exchange_result_u32 = OpTypeStruct %uint %bool
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicCompareExchangeWeak_83580d = OpFunction %void None %20
-         %22 = OpLabel
+%atomicCompareExchangeWeak_83580d = OpFunction %void None %25
+         %27 = OpLabel
       %arg_1 = OpVariable %_ptr_Function_uint Function %6
       %arg_2 = OpVariable %_ptr_Function_uint Function %6
-        %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resultu32 Function %28
+        %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resultu32 Function %32
                OpStore %arg_1 %6
                OpStore %arg_2 %6
-               OpStore %res %28
+               OpStore %res %32
                OpStore %arg_1 %uint_1
                OpStore %arg_2 %uint_1
-         %32 = OpLoad %uint %arg_2
-         %33 = OpLoad %uint %arg_1
-         %37 = OpAtomicCompareExchange %uint %arg_0 %uint_2 %uint_0 %uint_0 %32 %33
-         %38 = OpIEqual %bool %37 %33
-         %34 = OpCompositeConstruct %__atomic_compare_exchange_result_u32 %37 %38
-         %39 = OpCompositeExtract %uint %34 0
-         %40 = OpIEqual %bool %39 %32
-         %41 = OpCompositeConstruct %x__atomic_compare_exchange_resultu32 %39 %40
-               OpStore %res %41
+         %35 = OpLoad %uint %arg_2
+         %36 = OpLoad %uint %arg_1
+         %40 = OpAtomicCompareExchange %uint %arg_0 %uint_2 %uint_0 %uint_0 %35 %36
+         %41 = OpIEqual %bool %40 %36
+         %37 = OpCompositeConstruct %__atomic_compare_exchange_result_u32 %40 %41
+         %42 = OpCompositeExtract %uint %37 0
+         %43 = OpIEqual %bool %42 %35
+         %44 = OpCompositeConstruct %x__atomic_compare_exchange_resultu32 %42 %43
+               OpStore %res %44
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %44 = OpLabel
+         %47 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %48 = OpFunctionCall %void %atomicCompareExchangeWeak_83580d
+         %51 = OpFunctionCall %void %atomicCompareExchangeWeak_83580d
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %50 = OpLabel
-         %51 = OpLoad %uint %local_invocation_index_1
-         %52 = OpFunctionCall %void %compute_main_inner %51
+%compute_main_1 = OpFunction %void None %25
+         %53 = OpLabel
+         %54 = OpLoad %uint %local_invocation_index_1
+         %55 = OpFunctionCall %void %compute_main_inner %54
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %55 = OpLabel
-         %56 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %58 = OpLabel
+         %59 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %57 = OpFunctionCall %void %compute_main_1
+         %60 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %59 = OpLabel
-         %61 = OpLoad %uint %local_invocation_index_1_param_1
-         %60 = OpFunctionCall %void %compute_main_inner_1 %61
+%compute_main = OpFunction %void None %25
+         %62 = OpLabel
+         %64 = OpLoad %uint %local_invocation_index_1_param_1
+         %63 = OpFunctionCall %void %compute_main_inner_1 %64
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.dxc.hlsl
index 2e7d429..df05f11 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.fxc.hlsl
index 2e7d429..df05f11 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.glsl
index 5e09065..e7a94e3 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.msl
index 6df5148..39c1698 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.spvasm
index b25be6e..40c22e3 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 52
+; Bound: 57
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -33,57 +33,65 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicExchange_e114ba = OpFunction %void None %22
-         %24 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_int Function %19
-        %res = OpVariable %_ptr_Function_int Function %19
-               OpStore %arg_1 %19
-               OpStore %res %19
+%atomicExchange_e114ba = OpFunction %void None %27
+         %29 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_int Function %24
+        %res = OpVariable %_ptr_Function_int Function %24
+               OpStore %arg_1 %24
+               OpStore %res %24
                OpStore %arg_1 %int_1
-         %29 = OpLoad %int %arg_1
-         %30 = OpAtomicExchange %int %arg_0 %uint_2 %uint_0 %29
-               OpStore %res %30
+         %34 = OpLoad %int %arg_1
+         %35 = OpAtomicExchange %int %arg_0 %uint_2 %uint_0 %34
+               OpStore %res %35
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %34 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %39 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %38 = OpFunctionCall %void %atomicExchange_e114ba
+         %43 = OpFunctionCall %void %atomicExchange_e114ba
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %40 = OpLabel
-         %41 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %41
+%compute_main_1 = OpFunction %void None %27
+         %45 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %47 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %45 = OpLabel
-         %46 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %50 = OpLabel
+         %51 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %47 = OpFunctionCall %void %compute_main_1
+         %52 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %49 = OpLabel
-         %51 = OpLoad %uint %local_invocation_index_1_param_1
-         %50 = OpFunctionCall %void %compute_main_inner_1 %51
+%compute_main = OpFunction %void None %27
+         %54 = OpLabel
+         %56 = OpLoad %uint %local_invocation_index_1_param_1
+         %55 = OpFunctionCall %void %compute_main_inner_1 %56
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.dxc.hlsl
index 28c993f..89cc9ca 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.fxc.hlsl
index 28c993f..89cc9ca 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.glsl
index 6796967..7ecb3d8 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.msl
index b2faa0c..e58720d 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.spvasm
index 9389837..76deea5 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 50
+; Bound: 54
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,56 +32,63 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-     %uint_1 = OpConstant %uint 1
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicExchange_0a5dca = OpFunction %void None %20
-         %22 = OpLabel
+%atomicExchange_0a5dca = OpFunction %void None %25
+         %27 = OpLabel
       %arg_1 = OpVariable %_ptr_Function_uint Function %6
         %res = OpVariable %_ptr_Function_uint Function %6
                OpStore %arg_1 %6
                OpStore %res %6
                OpStore %arg_1 %uint_1
-         %27 = OpLoad %uint %arg_1
-         %28 = OpAtomicExchange %uint %arg_0 %uint_2 %uint_0 %27
-               OpStore %res %28
+         %31 = OpLoad %uint %arg_1
+         %32 = OpAtomicExchange %uint %arg_0 %uint_2 %uint_0 %31
+               OpStore %res %32
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %32 = OpLabel
+         %36 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %36 = OpFunctionCall %void %atomicExchange_0a5dca
+         %40 = OpFunctionCall %void %atomicExchange_0a5dca
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %38 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %39
+%compute_main_1 = OpFunction %void None %25
+         %42 = OpLabel
+         %43 = OpLoad %uint %local_invocation_index_1
+         %44 = OpFunctionCall %void %compute_main_inner %43
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %43 = OpLabel
-         %44 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %47 = OpLabel
+         %48 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %45 = OpFunctionCall %void %compute_main_1
+         %49 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %47 = OpLabel
-         %49 = OpLoad %uint %local_invocation_index_1_param_1
-         %48 = OpFunctionCall %void %compute_main_inner_1 %49
+%compute_main = OpFunction %void None %25
+         %51 = OpLabel
+         %53 = OpLoad %uint %local_invocation_index_1_param_1
+         %52 = OpFunctionCall %void %compute_main_inner_1 %53
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.dxc.hlsl
index 4237e00..a13e9f1 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.fxc.hlsl
index 4237e00..a13e9f1 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.glsl
index ec9f268..85d2f41 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.msl
index 04ea766..948b07a 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.spvasm
index b3f1170..641606f 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 49
+; Bound: 54
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,52 +32,60 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicLoad_afcc03 = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %19
-               OpStore %res %19
-         %27 = OpAtomicLoad %int %arg_0 %uint_2 %uint_0
-               OpStore %res %27
+%atomicLoad_afcc03 = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %24
+               OpStore %res %24
+         %32 = OpAtomicLoad %int %arg_0 %uint_2 %uint_0
+               OpStore %res %32
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %31 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %36 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %35 = OpFunctionCall %void %atomicLoad_afcc03
+         %40 = OpFunctionCall %void %atomicLoad_afcc03
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %37 = OpLabel
-         %38 = OpLoad %uint %local_invocation_index_1
-         %39 = OpFunctionCall %void %compute_main_inner %38
+%compute_main_1 = OpFunction %void None %27
+         %42 = OpLabel
+         %43 = OpLoad %uint %local_invocation_index_1
+         %44 = OpFunctionCall %void %compute_main_inner %43
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %42 = OpLabel
-         %43 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %47 = OpLabel
+         %48 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %44 = OpFunctionCall %void %compute_main_1
+         %49 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %46 = OpLabel
-         %48 = OpLoad %uint %local_invocation_index_1_param_1
-         %47 = OpFunctionCall %void %compute_main_inner_1 %48
+%compute_main = OpFunction %void None %27
+         %51 = OpLabel
+         %53 = OpLoad %uint %local_invocation_index_1_param_1
+         %52 = OpFunctionCall %void %compute_main_inner_1 %53
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.dxc.hlsl
index 2d67bbf..89372e1 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.fxc.hlsl
index 2d67bbf..89372e1 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.glsl
index 9d95d4f..554fab8 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.msl
index 71c5c7a..6aa8d8c 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.spvasm
index f8bd920..a3fbd12 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 47
+; Bound: 52
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -31,51 +31,59 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicLoad_361bf1 = OpFunction %void None %20
-         %22 = OpLabel
+%atomicLoad_361bf1 = OpFunction %void None %25
+         %27 = OpLabel
         %res = OpVariable %_ptr_Function_uint Function %6
                OpStore %res %6
-         %25 = OpAtomicLoad %uint %arg_0 %uint_2 %uint_0
-               OpStore %res %25
+         %30 = OpAtomicLoad %uint %arg_0 %uint_2 %uint_0
+               OpStore %res %30
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %29 = OpLabel
+         %34 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %33 = OpFunctionCall %void %atomicLoad_361bf1
+         %38 = OpFunctionCall %void %atomicLoad_361bf1
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %35 = OpLabel
-         %36 = OpLoad %uint %local_invocation_index_1
-         %37 = OpFunctionCall %void %compute_main_inner %36
+%compute_main_1 = OpFunction %void None %25
+         %40 = OpLabel
+         %41 = OpLoad %uint %local_invocation_index_1
+         %42 = OpFunctionCall %void %compute_main_inner %41
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %40 = OpLabel
-         %41 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %45 = OpLabel
+         %46 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %42 = OpFunctionCall %void %compute_main_1
+         %47 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %44 = OpLabel
-         %46 = OpLoad %uint %local_invocation_index_1_param_1
-         %45 = OpFunctionCall %void %compute_main_inner_1 %46
+%compute_main = OpFunction %void None %25
+         %49 = OpLabel
+         %51 = OpLoad %uint %local_invocation_index_1_param_1
+         %50 = OpFunctionCall %void %compute_main_inner_1 %51
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.dxc.hlsl
index f2c52bb..04198db 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.fxc.hlsl
index f2c52bb..04198db 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.glsl
index 5d6337d..2e0b203 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.msl
index 2d523ee..dd314b5 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.spvasm
index c459ff7..2465542 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 52
+; Bound: 57
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -33,57 +33,65 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicMax_a89cc3 = OpFunction %void None %22
-         %24 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_int Function %19
-        %res = OpVariable %_ptr_Function_int Function %19
-               OpStore %arg_1 %19
-               OpStore %res %19
+%atomicMax_a89cc3 = OpFunction %void None %27
+         %29 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_int Function %24
+        %res = OpVariable %_ptr_Function_int Function %24
+               OpStore %arg_1 %24
+               OpStore %res %24
                OpStore %arg_1 %int_1
-         %29 = OpLoad %int %arg_1
-         %30 = OpAtomicSMax %int %arg_0 %uint_2 %uint_0 %29
-               OpStore %res %30
+         %34 = OpLoad %int %arg_1
+         %35 = OpAtomicSMax %int %arg_0 %uint_2 %uint_0 %34
+               OpStore %res %35
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %34 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %39 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %38 = OpFunctionCall %void %atomicMax_a89cc3
+         %43 = OpFunctionCall %void %atomicMax_a89cc3
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %40 = OpLabel
-         %41 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %41
+%compute_main_1 = OpFunction %void None %27
+         %45 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %47 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %45 = OpLabel
-         %46 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %50 = OpLabel
+         %51 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %47 = OpFunctionCall %void %compute_main_1
+         %52 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %49 = OpLabel
-         %51 = OpLoad %uint %local_invocation_index_1_param_1
-         %50 = OpFunctionCall %void %compute_main_inner_1 %51
+%compute_main = OpFunction %void None %27
+         %54 = OpLabel
+         %56 = OpLoad %uint %local_invocation_index_1_param_1
+         %55 = OpFunctionCall %void %compute_main_inner_1 %56
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.dxc.hlsl
index f87b806..fc0c2e5 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.fxc.hlsl
index f87b806..fc0c2e5 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.glsl
index ca65c39..ebd75e0 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.msl
index 0eecd81..540e6d2 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.spvasm
index dd13aa3..befb1fe 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 50
+; Bound: 54
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,56 +32,63 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-     %uint_1 = OpConstant %uint 1
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicMax_beccfc = OpFunction %void None %20
-         %22 = OpLabel
+%atomicMax_beccfc = OpFunction %void None %25
+         %27 = OpLabel
       %arg_1 = OpVariable %_ptr_Function_uint Function %6
         %res = OpVariable %_ptr_Function_uint Function %6
                OpStore %arg_1 %6
                OpStore %res %6
                OpStore %arg_1 %uint_1
-         %27 = OpLoad %uint %arg_1
-         %28 = OpAtomicUMax %uint %arg_0 %uint_2 %uint_0 %27
-               OpStore %res %28
+         %31 = OpLoad %uint %arg_1
+         %32 = OpAtomicUMax %uint %arg_0 %uint_2 %uint_0 %31
+               OpStore %res %32
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %32 = OpLabel
+         %36 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %36 = OpFunctionCall %void %atomicMax_beccfc
+         %40 = OpFunctionCall %void %atomicMax_beccfc
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %38 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %39
+%compute_main_1 = OpFunction %void None %25
+         %42 = OpLabel
+         %43 = OpLoad %uint %local_invocation_index_1
+         %44 = OpFunctionCall %void %compute_main_inner %43
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %43 = OpLabel
-         %44 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %47 = OpLabel
+         %48 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %45 = OpFunctionCall %void %compute_main_1
+         %49 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %47 = OpLabel
-         %49 = OpLoad %uint %local_invocation_index_1_param_1
-         %48 = OpFunctionCall %void %compute_main_inner_1 %49
+%compute_main = OpFunction %void None %25
+         %51 = OpLabel
+         %53 = OpLoad %uint %local_invocation_index_1_param_1
+         %52 = OpFunctionCall %void %compute_main_inner_1 %53
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.dxc.hlsl
index 8ce8907..e18f1c3 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.fxc.hlsl
index 8ce8907..e18f1c3 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.glsl
index 3cac56e..803270e 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.msl
index b2b7706..da9a146 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.spvasm
index 4ad025c..d5f68a2 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 52
+; Bound: 57
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -33,57 +33,65 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicMin_278235 = OpFunction %void None %22
-         %24 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_int Function %19
-        %res = OpVariable %_ptr_Function_int Function %19
-               OpStore %arg_1 %19
-               OpStore %res %19
+%atomicMin_278235 = OpFunction %void None %27
+         %29 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_int Function %24
+        %res = OpVariable %_ptr_Function_int Function %24
+               OpStore %arg_1 %24
+               OpStore %res %24
                OpStore %arg_1 %int_1
-         %29 = OpLoad %int %arg_1
-         %30 = OpAtomicSMin %int %arg_0 %uint_2 %uint_0 %29
-               OpStore %res %30
+         %34 = OpLoad %int %arg_1
+         %35 = OpAtomicSMin %int %arg_0 %uint_2 %uint_0 %34
+               OpStore %res %35
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %34 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %39 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %38 = OpFunctionCall %void %atomicMin_278235
+         %43 = OpFunctionCall %void %atomicMin_278235
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %40 = OpLabel
-         %41 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %41
+%compute_main_1 = OpFunction %void None %27
+         %45 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %47 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %45 = OpLabel
-         %46 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %50 = OpLabel
+         %51 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %47 = OpFunctionCall %void %compute_main_1
+         %52 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %49 = OpLabel
-         %51 = OpLoad %uint %local_invocation_index_1_param_1
-         %50 = OpFunctionCall %void %compute_main_inner_1 %51
+%compute_main = OpFunction %void None %27
+         %54 = OpLabel
+         %56 = OpLoad %uint %local_invocation_index_1_param_1
+         %55 = OpFunctionCall %void %compute_main_inner_1 %56
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.dxc.hlsl
index 094f692..cdf1a8a 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.fxc.hlsl
index 094f692..cdf1a8a 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.glsl
index 59fa651..4e40fef 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.msl
index 370546d..9a62922 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.spvasm
index 29e0ff9..b729db7 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 50
+; Bound: 54
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,56 +32,63 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-     %uint_1 = OpConstant %uint 1
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicMin_69d383 = OpFunction %void None %20
-         %22 = OpLabel
+%atomicMin_69d383 = OpFunction %void None %25
+         %27 = OpLabel
       %arg_1 = OpVariable %_ptr_Function_uint Function %6
         %res = OpVariable %_ptr_Function_uint Function %6
                OpStore %arg_1 %6
                OpStore %res %6
                OpStore %arg_1 %uint_1
-         %27 = OpLoad %uint %arg_1
-         %28 = OpAtomicUMin %uint %arg_0 %uint_2 %uint_0 %27
-               OpStore %res %28
+         %31 = OpLoad %uint %arg_1
+         %32 = OpAtomicUMin %uint %arg_0 %uint_2 %uint_0 %31
+               OpStore %res %32
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %32 = OpLabel
+         %36 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %36 = OpFunctionCall %void %atomicMin_69d383
+         %40 = OpFunctionCall %void %atomicMin_69d383
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %38 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %39
+%compute_main_1 = OpFunction %void None %25
+         %42 = OpLabel
+         %43 = OpLoad %uint %local_invocation_index_1
+         %44 = OpFunctionCall %void %compute_main_inner %43
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %43 = OpLabel
-         %44 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %47 = OpLabel
+         %48 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %45 = OpFunctionCall %void %compute_main_1
+         %49 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %47 = OpLabel
-         %49 = OpLoad %uint %local_invocation_index_1_param_1
-         %48 = OpFunctionCall %void %compute_main_inner_1 %49
+%compute_main = OpFunction %void None %25
+         %51 = OpLabel
+         %53 = OpLoad %uint %local_invocation_index_1_param_1
+         %52 = OpFunctionCall %void %compute_main_inner_1 %53
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.dxc.hlsl
index d67f0aa..f4a20be 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.fxc.hlsl
index d67f0aa..f4a20be 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.glsl
index cb10a94..0e85837 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.msl
index b40773f..f5bdf2e 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.spvasm
index 963468d..98a2c74 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 52
+; Bound: 57
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -33,57 +33,65 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicOr_d09248 = OpFunction %void None %22
-         %24 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_int Function %19
-        %res = OpVariable %_ptr_Function_int Function %19
-               OpStore %arg_1 %19
-               OpStore %res %19
+%atomicOr_d09248 = OpFunction %void None %27
+         %29 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_int Function %24
+        %res = OpVariable %_ptr_Function_int Function %24
+               OpStore %arg_1 %24
+               OpStore %res %24
                OpStore %arg_1 %int_1
-         %29 = OpLoad %int %arg_1
-         %30 = OpAtomicOr %int %arg_0 %uint_2 %uint_0 %29
-               OpStore %res %30
+         %34 = OpLoad %int %arg_1
+         %35 = OpAtomicOr %int %arg_0 %uint_2 %uint_0 %34
+               OpStore %res %35
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %34 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %39 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %38 = OpFunctionCall %void %atomicOr_d09248
+         %43 = OpFunctionCall %void %atomicOr_d09248
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %40 = OpLabel
-         %41 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %41
+%compute_main_1 = OpFunction %void None %27
+         %45 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %47 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %45 = OpLabel
-         %46 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %50 = OpLabel
+         %51 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %47 = OpFunctionCall %void %compute_main_1
+         %52 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %49 = OpLabel
-         %51 = OpLoad %uint %local_invocation_index_1_param_1
-         %50 = OpFunctionCall %void %compute_main_inner_1 %51
+%compute_main = OpFunction %void None %27
+         %54 = OpLabel
+         %56 = OpLoad %uint %local_invocation_index_1_param_1
+         %55 = OpFunctionCall %void %compute_main_inner_1 %56
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.dxc.hlsl
index b8701d7..d9b2430 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.fxc.hlsl
index b8701d7..d9b2430 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.glsl
index 78d2909..12b7724 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.msl
index c2aaaf7..eb46e1b 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.spvasm
index 2b902a3..622b3eb 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 50
+; Bound: 54
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,56 +32,63 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-     %uint_1 = OpConstant %uint 1
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicOr_5e3d61 = OpFunction %void None %20
-         %22 = OpLabel
+%atomicOr_5e3d61 = OpFunction %void None %25
+         %27 = OpLabel
       %arg_1 = OpVariable %_ptr_Function_uint Function %6
         %res = OpVariable %_ptr_Function_uint Function %6
                OpStore %arg_1 %6
                OpStore %res %6
                OpStore %arg_1 %uint_1
-         %27 = OpLoad %uint %arg_1
-         %28 = OpAtomicOr %uint %arg_0 %uint_2 %uint_0 %27
-               OpStore %res %28
+         %31 = OpLoad %uint %arg_1
+         %32 = OpAtomicOr %uint %arg_0 %uint_2 %uint_0 %31
+               OpStore %res %32
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %32 = OpLabel
+         %36 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %36 = OpFunctionCall %void %atomicOr_5e3d61
+         %40 = OpFunctionCall %void %atomicOr_5e3d61
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %38 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %39
+%compute_main_1 = OpFunction %void None %25
+         %42 = OpLabel
+         %43 = OpLoad %uint %local_invocation_index_1
+         %44 = OpFunctionCall %void %compute_main_inner %43
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %43 = OpLabel
-         %44 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %47 = OpLabel
+         %48 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %45 = OpFunctionCall %void %compute_main_1
+         %49 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %47 = OpLabel
-         %49 = OpLoad %uint %local_invocation_index_1_param_1
-         %48 = OpFunctionCall %void %compute_main_inner_1 %49
+%compute_main = OpFunction %void None %25
+         %51 = OpLabel
+         %53 = OpLoad %uint %local_invocation_index_1_param_1
+         %52 = OpFunctionCall %void %compute_main_inner_1 %53
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.dxc.hlsl
index e819216..93cea9c 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.fxc.hlsl
index e819216..93cea9c 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.glsl
index be44078..04c8470 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.msl
index d03b636..f297dca 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.spvasm
index 7e9be5c..a518eac 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 51
+; Bound: 56
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,54 +32,62 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicStore_8bea94 = OpFunction %void None %22
-         %24 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_int Function %19
-               OpStore %arg_1 %19
+%atomicStore_8bea94 = OpFunction %void None %27
+         %29 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_int Function %24
+               OpStore %arg_1 %24
                OpStore %arg_1 %int_1
-         %28 = OpLoad %int %arg_1
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %28
+         %33 = OpLoad %int %arg_1
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %33
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %33 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %38 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %37 = OpFunctionCall %void %atomicStore_8bea94
+         %42 = OpFunctionCall %void %atomicStore_8bea94
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %39 = OpLabel
-         %40 = OpLoad %uint %local_invocation_index_1
-         %41 = OpFunctionCall %void %compute_main_inner %40
+%compute_main_1 = OpFunction %void None %27
+         %44 = OpLabel
+         %45 = OpLoad %uint %local_invocation_index_1
+         %46 = OpFunctionCall %void %compute_main_inner %45
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %44 = OpLabel
-         %45 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %49 = OpLabel
+         %50 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %46 = OpFunctionCall %void %compute_main_1
+         %51 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %48 = OpLabel
-         %50 = OpLoad %uint %local_invocation_index_1_param_1
-         %49 = OpFunctionCall %void %compute_main_inner_1 %50
+%compute_main = OpFunction %void None %27
+         %53 = OpLabel
+         %55 = OpLoad %uint %local_invocation_index_1_param_1
+         %54 = OpFunctionCall %void %compute_main_inner_1 %55
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.dxc.hlsl
index 8dd0799..4047f5c 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.fxc.hlsl
index 8dd0799..4047f5c 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.glsl
index 9a7c473..02efb6c 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.msl
index 45faea5..c234f07 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.spvasm
index a762b47..a83b02e 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 49
+; Bound: 53
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -31,53 +31,60 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-     %uint_1 = OpConstant %uint 1
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicStore_726882 = OpFunction %void None %20
-         %22 = OpLabel
+%atomicStore_726882 = OpFunction %void None %25
+         %27 = OpLabel
       %arg_1 = OpVariable %_ptr_Function_uint Function %6
                OpStore %arg_1 %6
                OpStore %arg_1 %uint_1
-         %26 = OpLoad %uint %arg_1
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %26
+         %30 = OpLoad %uint %arg_1
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %30
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %31 = OpLabel
+         %35 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %35 = OpFunctionCall %void %atomicStore_726882
+         %39 = OpFunctionCall %void %atomicStore_726882
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %37 = OpLabel
-         %38 = OpLoad %uint %local_invocation_index_1
-         %39 = OpFunctionCall %void %compute_main_inner %38
+%compute_main_1 = OpFunction %void None %25
+         %41 = OpLabel
+         %42 = OpLoad %uint %local_invocation_index_1
+         %43 = OpFunctionCall %void %compute_main_inner %42
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %42 = OpLabel
-         %43 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %46 = OpLabel
+         %47 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %44 = OpFunctionCall %void %compute_main_1
+         %48 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %46 = OpLabel
-         %48 = OpLoad %uint %local_invocation_index_1_param_1
-         %47 = OpFunctionCall %void %compute_main_inner_1 %48
+%compute_main = OpFunction %void None %25
+         %50 = OpLabel
+         %52 = OpLoad %uint %local_invocation_index_1_param_1
+         %51 = OpFunctionCall %void %compute_main_inner_1 %52
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.dxc.hlsl
index d790ab2..06aaf32 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.fxc.hlsl
index d790ab2..06aaf32 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.glsl
index 74ba617..7910372 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.msl
index 14da3dd..c436814 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.spvasm
index b169568..7c130d1 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 52
+; Bound: 57
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -33,57 +33,65 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicSub_77883a = OpFunction %void None %22
-         %24 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_int Function %19
-        %res = OpVariable %_ptr_Function_int Function %19
-               OpStore %arg_1 %19
-               OpStore %res %19
+%atomicSub_77883a = OpFunction %void None %27
+         %29 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_int Function %24
+        %res = OpVariable %_ptr_Function_int Function %24
+               OpStore %arg_1 %24
+               OpStore %res %24
                OpStore %arg_1 %int_1
-         %29 = OpLoad %int %arg_1
-         %30 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %29
-               OpStore %res %30
+         %34 = OpLoad %int %arg_1
+         %35 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %34
+               OpStore %res %35
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %34 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %39 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %38 = OpFunctionCall %void %atomicSub_77883a
+         %43 = OpFunctionCall %void %atomicSub_77883a
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %40 = OpLabel
-         %41 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %41
+%compute_main_1 = OpFunction %void None %27
+         %45 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %47 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %45 = OpLabel
-         %46 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %50 = OpLabel
+         %51 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %47 = OpFunctionCall %void %compute_main_1
+         %52 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %49 = OpLabel
-         %51 = OpLoad %uint %local_invocation_index_1_param_1
-         %50 = OpFunctionCall %void %compute_main_inner_1 %51
+%compute_main = OpFunction %void None %27
+         %54 = OpLabel
+         %56 = OpLoad %uint %local_invocation_index_1_param_1
+         %55 = OpFunctionCall %void %compute_main_inner_1 %56
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.dxc.hlsl
index 52b6fd4..b7149c0 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.fxc.hlsl
index 52b6fd4..b7149c0 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.glsl
index b9413d6..c29bb33 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.msl
index 8b18455..8156411 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.spvasm
index 44ee92e..3485753 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 50
+; Bound: 54
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,56 +32,63 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-     %uint_1 = OpConstant %uint 1
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicSub_0d26c2 = OpFunction %void None %20
-         %22 = OpLabel
+%atomicSub_0d26c2 = OpFunction %void None %25
+         %27 = OpLabel
       %arg_1 = OpVariable %_ptr_Function_uint Function %6
         %res = OpVariable %_ptr_Function_uint Function %6
                OpStore %arg_1 %6
                OpStore %res %6
                OpStore %arg_1 %uint_1
-         %27 = OpLoad %uint %arg_1
-         %28 = OpAtomicISub %uint %arg_0 %uint_2 %uint_0 %27
-               OpStore %res %28
+         %31 = OpLoad %uint %arg_1
+         %32 = OpAtomicISub %uint %arg_0 %uint_2 %uint_0 %31
+               OpStore %res %32
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %32 = OpLabel
+         %36 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %36 = OpFunctionCall %void %atomicSub_0d26c2
+         %40 = OpFunctionCall %void %atomicSub_0d26c2
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %38 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %39
+%compute_main_1 = OpFunction %void None %25
+         %42 = OpLabel
+         %43 = OpLoad %uint %local_invocation_index_1
+         %44 = OpFunctionCall %void %compute_main_inner %43
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %43 = OpLabel
-         %44 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %47 = OpLabel
+         %48 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %45 = OpFunctionCall %void %compute_main_1
+         %49 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %47 = OpLabel
-         %49 = OpLoad %uint %local_invocation_index_1_param_1
-         %48 = OpFunctionCall %void %compute_main_inner_1 %49
+%compute_main = OpFunction %void None %25
+         %51 = OpLabel
+         %53 = OpLoad %uint %local_invocation_index_1_param_1
+         %52 = OpFunctionCall %void %compute_main_inner_1 %53
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.dxc.hlsl
index 4ca0280..8e33004 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.fxc.hlsl
index 4ca0280..8e33004 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.glsl
index ea6edf5..2ad0be5 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.msl
index 02cd343..7c72898 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.spvasm
index ad94ec4..e5612e1 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 52
+; Bound: 57
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -33,57 +33,65 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicXor_75dc95 = OpFunction %void None %22
-         %24 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_int Function %19
-        %res = OpVariable %_ptr_Function_int Function %19
-               OpStore %arg_1 %19
-               OpStore %res %19
+%atomicXor_75dc95 = OpFunction %void None %27
+         %29 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_int Function %24
+        %res = OpVariable %_ptr_Function_int Function %24
+               OpStore %arg_1 %24
+               OpStore %res %24
                OpStore %arg_1 %int_1
-         %29 = OpLoad %int %arg_1
-         %30 = OpAtomicXor %int %arg_0 %uint_2 %uint_0 %29
-               OpStore %res %30
+         %34 = OpLoad %int %arg_1
+         %35 = OpAtomicXor %int %arg_0 %uint_2 %uint_0 %34
+               OpStore %res %35
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %34 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %39 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %38 = OpFunctionCall %void %atomicXor_75dc95
+         %43 = OpFunctionCall %void %atomicXor_75dc95
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %40 = OpLabel
-         %41 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %41
+%compute_main_1 = OpFunction %void None %27
+         %45 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %47 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %45 = OpLabel
-         %46 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %50 = OpLabel
+         %51 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %47 = OpFunctionCall %void %compute_main_1
+         %52 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %49 = OpLabel
-         %51 = OpLoad %uint %local_invocation_index_1_param_1
-         %50 = OpFunctionCall %void %compute_main_inner_1 %51
+%compute_main = OpFunction %void None %27
+         %54 = OpLabel
+         %56 = OpLoad %uint %local_invocation_index_1_param_1
+         %55 = OpFunctionCall %void %compute_main_inner_1 %56
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.dxc.hlsl
index c72ecf0..8485eb4 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.fxc.hlsl
index c72ecf0..8485eb4 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.glsl
index edc5813..a74aad9 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.msl
index 9c9a20c..693851b 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.spvasm
index 683863e..7bbc944 100644
--- a/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 50
+; Bound: 54
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,56 +32,63 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-     %uint_1 = OpConstant %uint 1
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicXor_c8e6be = OpFunction %void None %20
-         %22 = OpLabel
+%atomicXor_c8e6be = OpFunction %void None %25
+         %27 = OpLabel
       %arg_1 = OpVariable %_ptr_Function_uint Function %6
         %res = OpVariable %_ptr_Function_uint Function %6
                OpStore %arg_1 %6
                OpStore %res %6
                OpStore %arg_1 %uint_1
-         %27 = OpLoad %uint %arg_1
-         %28 = OpAtomicXor %uint %arg_0 %uint_2 %uint_0 %27
-               OpStore %res %28
+         %31 = OpLoad %uint %arg_1
+         %32 = OpAtomicXor %uint %arg_0 %uint_2 %uint_0 %31
+               OpStore %res %32
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %32 = OpLabel
+         %36 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %36 = OpFunctionCall %void %atomicXor_c8e6be
+         %40 = OpFunctionCall %void %atomicXor_c8e6be
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %38 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %39
+%compute_main_1 = OpFunction %void None %25
+         %42 = OpLabel
+         %43 = OpLoad %uint %local_invocation_index_1
+         %44 = OpFunctionCall %void %compute_main_inner %43
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %43 = OpLabel
-         %44 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %47 = OpLabel
+         %48 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %45 = OpFunctionCall %void %compute_main_1
+         %49 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %47 = OpLabel
-         %49 = OpLoad %uint %local_invocation_index_1_param_1
-         %48 = OpFunctionCall %void %compute_main_inner_1 %49
+%compute_main = OpFunction %void None %25
+         %51 = OpLabel
+         %53 = OpLoad %uint %local_invocation_index_1_param_1
+         %52 = OpFunctionCall %void %compute_main_inner_1 %53
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.dxc.hlsl
index 3da585b..a42b73f 100644
--- a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.fxc.hlsl
index 3da585b..a42b73f 100644
--- a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.glsl
index 7b7e96a..a5f4e55 100644
--- a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.msl
index 17e8065..660bdd3 100644
--- a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.spvasm
index bb1cb22..77ebfbe 100644
--- a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 51
+; Bound: 56
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -33,56 +33,64 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAdd_794055 = OpFunction %void None %22
-         %24 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_int Function %19
-        %res = OpVariable %_ptr_Function_int Function %19
-               OpStore %arg_1 %19
-               OpStore %res %19
+%atomicAdd_794055 = OpFunction %void None %27
+         %29 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_int Function %24
+        %res = OpVariable %_ptr_Function_int Function %24
+               OpStore %arg_1 %24
+               OpStore %res %24
                OpStore %arg_1 %int_1
-         %29 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %int_1
-               OpStore %res %29
+         %34 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %int_1
+               OpStore %res %34
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %33 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %38 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %37 = OpFunctionCall %void %atomicAdd_794055
+         %42 = OpFunctionCall %void %atomicAdd_794055
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %39 = OpLabel
-         %40 = OpLoad %uint %local_invocation_index_1
-         %41 = OpFunctionCall %void %compute_main_inner %40
+%compute_main_1 = OpFunction %void None %27
+         %44 = OpLabel
+         %45 = OpLoad %uint %local_invocation_index_1
+         %46 = OpFunctionCall %void %compute_main_inner %45
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %44 = OpLabel
-         %45 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %49 = OpLabel
+         %50 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %46 = OpFunctionCall %void %compute_main_1
+         %51 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %48 = OpLabel
-         %50 = OpLoad %uint %local_invocation_index_1_param_1
-         %49 = OpFunctionCall %void %compute_main_inner_1 %50
+%compute_main = OpFunction %void None %27
+         %53 = OpLabel
+         %55 = OpLoad %uint %local_invocation_index_1_param_1
+         %54 = OpFunctionCall %void %compute_main_inner_1 %55
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.dxc.hlsl
index d33a81e..97859e3 100644
--- a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.fxc.hlsl
index d33a81e..97859e3 100644
--- a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.glsl
index 69e067d..52377ba 100644
--- a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.msl
index ce06ad9..35747a2 100644
--- a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.spvasm
index 647fda4..15fa412 100644
--- a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 49
+; Bound: 53
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,55 +32,62 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-     %uint_1 = OpConstant %uint 1
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAdd_d5db1d = OpFunction %void None %20
-         %22 = OpLabel
+%atomicAdd_d5db1d = OpFunction %void None %25
+         %27 = OpLabel
       %arg_1 = OpVariable %_ptr_Function_uint Function %6
         %res = OpVariable %_ptr_Function_uint Function %6
                OpStore %arg_1 %6
                OpStore %res %6
                OpStore %arg_1 %uint_1
-         %27 = OpAtomicISub %uint %arg_0 %uint_2 %uint_0 %uint_1
-               OpStore %res %27
+         %31 = OpAtomicISub %uint %arg_0 %uint_2 %uint_0 %uint_1
+               OpStore %res %31
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %31 = OpLabel
+         %35 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %35 = OpFunctionCall %void %atomicAdd_d5db1d
+         %39 = OpFunctionCall %void %atomicAdd_d5db1d
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %37 = OpLabel
-         %38 = OpLoad %uint %local_invocation_index_1
-         %39 = OpFunctionCall %void %compute_main_inner %38
+%compute_main_1 = OpFunction %void None %25
+         %41 = OpLabel
+         %42 = OpLoad %uint %local_invocation_index_1
+         %43 = OpFunctionCall %void %compute_main_inner %42
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %42 = OpLabel
-         %43 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %46 = OpLabel
+         %47 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %44 = OpFunctionCall %void %compute_main_1
+         %48 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %46 = OpLabel
-         %48 = OpLoad %uint %local_invocation_index_1_param_1
-         %47 = OpFunctionCall %void %compute_main_inner_1 %48
+%compute_main = OpFunction %void None %25
+         %50 = OpLabel
+         %52 = OpLoad %uint %local_invocation_index_1_param_1
+         %51 = OpFunctionCall %void %compute_main_inner_1 %52
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.dxc.hlsl
index ad706b0..0da074a 100644
--- a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.fxc.hlsl
index ad706b0..0da074a 100644
--- a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.glsl
index 219ae06..176601b 100644
--- a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.msl
index ad68905..ec75c00 100644
--- a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.spvasm
index 47440bf..e7a3d87 100644
--- a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_i32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 51
+; Bound: 56
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -33,56 +33,64 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAdd_794055 = OpFunction %void None %22
-         %24 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_int Function %19
-        %res = OpVariable %_ptr_Function_int Function %19
-               OpStore %arg_1 %19
-               OpStore %res %19
+%atomicAdd_794055 = OpFunction %void None %27
+         %29 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_int Function %24
+        %res = OpVariable %_ptr_Function_int Function %24
+               OpStore %arg_1 %24
+               OpStore %res %24
                OpStore %arg_1 %int_1
-         %29 = OpAtomicIAdd %int %arg_0 %uint_2 %uint_0 %int_1
-               OpStore %res %29
+         %34 = OpAtomicIAdd %int %arg_0 %uint_2 %uint_0 %int_1
+               OpStore %res %34
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %33 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %38 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %37 = OpFunctionCall %void %atomicAdd_794055
+         %42 = OpFunctionCall %void %atomicAdd_794055
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %22
-         %39 = OpLabel
-         %40 = OpLoad %uint %local_invocation_index_1
-         %41 = OpFunctionCall %void %compute_main_inner %40
+%compute_main_1 = OpFunction %void None %27
+         %44 = OpLabel
+         %45 = OpLoad %uint %local_invocation_index_1
+         %46 = OpFunctionCall %void %compute_main_inner %45
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %10
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %44 = OpLabel
-         %45 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %49 = OpLabel
+         %50 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %46 = OpFunctionCall %void %compute_main_1
+         %51 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %48 = OpLabel
-         %50 = OpLoad %uint %local_invocation_index_1_param_1
-         %49 = OpFunctionCall %void %compute_main_inner_1 %50
+%compute_main = OpFunction %void None %27
+         %53 = OpLabel
+         %55 = OpLoad %uint %local_invocation_index_1_param_1
+         %54 = OpFunctionCall %void %compute_main_inner_1 %55
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.dxc.hlsl
index d83887f..4e36edd 100644
--- a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.dxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.fxc.hlsl
index d83887f..4e36edd 100644
--- a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.fxc.hlsl
+++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.glsl
index b14e36a..1689f63 100644
--- a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.glsl
+++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.msl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.msl
index 8c28ce2..068558c 100644
--- a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.msl
+++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.spvasm
index 5822e1a..f80c836 100644
--- a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.spvasm
+++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/workgroup_u32.spvasm.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 49
+; Bound: 53
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,55 +32,62 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
    %uint_264 = OpConstant %uint 264
-         %20 = OpTypeFunction %void
+         %25 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-     %uint_1 = OpConstant %uint 1
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAdd_d5db1d = OpFunction %void None %20
-         %22 = OpLabel
+%atomicAdd_d5db1d = OpFunction %void None %25
+         %27 = OpLabel
       %arg_1 = OpVariable %_ptr_Function_uint Function %6
         %res = OpVariable %_ptr_Function_uint Function %6
                OpStore %arg_1 %6
                OpStore %res %6
                OpStore %arg_1 %uint_1
-         %27 = OpAtomicIAdd %uint %arg_0 %uint_2 %uint_0 %uint_1
-               OpStore %res %27
+         %31 = OpAtomicIAdd %uint %arg_0 %uint_2 %uint_0 %uint_1
+               OpStore %res %31
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %31 = OpLabel
+         %35 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %6
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %35 = OpFunctionCall %void %atomicAdd_d5db1d
+         %39 = OpFunctionCall %void %atomicAdd_d5db1d
                OpReturn
                OpFunctionEnd
-%compute_main_1 = OpFunction %void None %20
-         %37 = OpLabel
-         %38 = OpLoad %uint %local_invocation_index_1
-         %39 = OpFunctionCall %void %compute_main_inner %38
+%compute_main_1 = OpFunction %void None %25
+         %41 = OpLabel
+         %42 = OpLoad %uint %local_invocation_index_1
+         %43 = OpFunctionCall %void %compute_main_inner %42
                OpReturn
                OpFunctionEnd
 %compute_main_inner_1 = OpFunction %void None %9
 %local_invocation_index_1_param = OpFunctionParameter %uint
-         %42 = OpLabel
-         %43 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
+         %46 = OpLabel
+         %47 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index_1_param
                OpStore %local_invocation_index_1 %local_invocation_index_1_param
-         %44 = OpFunctionCall %void %compute_main_1
+         %48 = OpFunctionCall %void %compute_main_1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %20
-         %46 = OpLabel
-         %48 = OpLoad %uint %local_invocation_index_1_param_1
-         %47 = OpFunctionCall %void %compute_main_inner_1 %48
+%compute_main = OpFunction %void None %25
+         %50 = OpLabel
+         %52 = OpLoad %uint %local_invocation_index_1_param_1
+         %51 = OpFunctionCall %void %compute_main_inner_1 %52
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.dxc.hlsl
index f1fdad6..6ae97a5 100644
--- a/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.fxc.hlsl
index f1fdad6..6ae97a5 100644
--- a/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.glsl
index de86e19..2f38817 100644
--- a/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.msl
index 152b30f..43ba08d 100644
--- a/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.spvasm
index 7daf6b7..2cd5dab 100644
--- a/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atomicAdd/794055.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 42
+; Bound: 47
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -35,41 +35,49 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
       %int_1 = OpConstant %int 1
 %_ptr_Function_int = OpTypePointer Function %int
 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAdd_794055 = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %19
-         %25 = OpAtomicIAdd %int %arg_0 %uint_2 %uint_0 %int_1
-               OpStore %res %25
-         %31 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
-         %32 = OpLoad %int %res
-               OpStore %31 %32
+%atomicAdd_794055 = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %24
+         %30 = OpAtomicIAdd %int %arg_0 %uint_2 %uint_0 %int_1
+               OpStore %res %30
+         %36 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
+         %37 = OpLoad %int %res
+               OpStore %36 %37
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %35 = OpLabel
-         %36 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %37 = OpFunctionCall %void %atomicAdd_794055
+         %40 = OpLabel
+         %41 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %42 = OpFunctionCall %void %atomicAdd_794055
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %39 = OpLabel
-         %41 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %41
+%compute_main = OpFunction %void None %27
+         %44 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.dxc.hlsl
index caca363..1f7824b 100644
--- a/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.fxc.hlsl
index caca363..1f7824b 100644
--- a/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.glsl
index d515a13..f506f6d 100644
--- a/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.msl
index b44f100..c7c22ef 100644
--- a/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.spvasm
index 9955340..4616222 100644
--- a/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atomicAdd/d5db1d.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 41
+; Bound: 45
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -34,41 +34,48 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %18 = OpConstantNull %uint
+         %23 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %void
-     %uint_1 = OpConstant %uint 1
+         %26 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %18
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %23
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAdd_d5db1d = OpFunction %void None %21
-         %23 = OpLabel
-        %res = OpVariable %_ptr_Function_uint Function %18
-         %24 = OpAtomicIAdd %uint %arg_0 %uint_2 %uint_0 %uint_1
-               OpStore %res %24
-         %30 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
-         %31 = OpLoad %uint %res
-               OpStore %30 %31
+%atomicAdd_d5db1d = OpFunction %void None %26
+         %28 = OpLabel
+        %res = OpVariable %_ptr_Function_uint Function %23
+         %29 = OpAtomicIAdd %uint %arg_0 %uint_2 %uint_0 %uint_1
+               OpStore %res %29
+         %34 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
+         %35 = OpLoad %uint %res
+               OpStore %34 %35
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %34 = OpLabel
-         %35 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %36 = OpFunctionCall %void %atomicAdd_d5db1d
+         %38 = OpLabel
+         %39 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %40 = OpFunctionCall %void %atomicAdd_d5db1d
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %21
-         %38 = OpLabel
-         %40 = OpLoad %uint %local_invocation_index_1
-         %39 = OpFunctionCall %void %compute_main_inner %40
+%compute_main = OpFunction %void None %26
+         %42 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %43 = OpFunctionCall %void %compute_main_inner %44
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.dxc.hlsl
index 0ec2756..96cc080 100644
--- a/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.fxc.hlsl
index 0ec2756..96cc080 100644
--- a/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.glsl
index ee13495..33d300e 100644
--- a/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.msl
index e433159..f8cbfb6 100644
--- a/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.spvasm
index 8fbfb62..760d4eb 100644
--- a/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atomicAnd/34edd3.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 41
+; Bound: 45
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -34,41 +34,48 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %18 = OpConstantNull %uint
+         %23 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %void
-     %uint_1 = OpConstant %uint 1
+         %26 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %18
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %23
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAnd_34edd3 = OpFunction %void None %21
-         %23 = OpLabel
-        %res = OpVariable %_ptr_Function_uint Function %18
-         %24 = OpAtomicAnd %uint %arg_0 %uint_2 %uint_0 %uint_1
-               OpStore %res %24
-         %30 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
-         %31 = OpLoad %uint %res
-               OpStore %30 %31
+%atomicAnd_34edd3 = OpFunction %void None %26
+         %28 = OpLabel
+        %res = OpVariable %_ptr_Function_uint Function %23
+         %29 = OpAtomicAnd %uint %arg_0 %uint_2 %uint_0 %uint_1
+               OpStore %res %29
+         %34 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
+         %35 = OpLoad %uint %res
+               OpStore %34 %35
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %34 = OpLabel
-         %35 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %36 = OpFunctionCall %void %atomicAnd_34edd3
+         %38 = OpLabel
+         %39 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %40 = OpFunctionCall %void %atomicAnd_34edd3
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %21
-         %38 = OpLabel
-         %40 = OpLoad %uint %local_invocation_index_1
-         %39 = OpFunctionCall %void %compute_main_inner %40
+%compute_main = OpFunction %void None %26
+         %42 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %43 = OpFunctionCall %void %compute_main_inner %44
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.dxc.hlsl
index 47ee477..96b300f 100644
--- a/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.fxc.hlsl
index 47ee477..96b300f 100644
--- a/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.glsl
index ffa7f4b..4723d2f 100644
--- a/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.msl
index b79c346..810e6ca 100644
--- a/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.spvasm
index fa9957b..d19aaa1 100644
--- a/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atomicAnd/45a819.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 42
+; Bound: 47
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -35,41 +35,49 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
       %int_1 = OpConstant %int 1
 %_ptr_Function_int = OpTypePointer Function %int
 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAnd_45a819 = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %19
-         %25 = OpAtomicAnd %int %arg_0 %uint_2 %uint_0 %int_1
-               OpStore %res %25
-         %31 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
-         %32 = OpLoad %int %res
-               OpStore %31 %32
+%atomicAnd_45a819 = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %24
+         %30 = OpAtomicAnd %int %arg_0 %uint_2 %uint_0 %int_1
+               OpStore %res %30
+         %36 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
+         %37 = OpLoad %int %res
+               OpStore %36 %37
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %35 = OpLabel
-         %36 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %37 = OpFunctionCall %void %atomicAnd_45a819
+         %40 = OpLabel
+         %41 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %42 = OpFunctionCall %void %atomicAnd_45a819
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %39 = OpLabel
-         %41 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %41
+%compute_main = OpFunction %void None %27
+         %44 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.dxc.hlsl
index 835871a..74f11ad 100644
--- a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.dxc.hlsl
@@ -5,7 +5,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.fxc.hlsl
index 835871a..74f11ad 100644
--- a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.fxc.hlsl
@@ -5,7 +5,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.glsl
index 5d8b0a1..db8c213 100644
--- a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.glsl
@@ -8,7 +8,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.msl
index 28007fc..ce9b39c 100644
--- a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.msl
@@ -13,7 +13,7 @@
 }
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.spvasm
index 3b84897..c30d5f8 100644
--- a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/83580d.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 40
+; Bound: 43
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -29,42 +29,48 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %6 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %15 = OpConstantNull %uint
+         %20 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %18 = OpTypeFunction %void
-       %bool = OpTypeBool
+         %23 = OpTypeFunction %void
 %__atomic_compare_exchange_result_u32 = OpTypeStruct %uint %bool
-     %uint_1 = OpConstant %uint 1
 %_ptr_Function___atomic_compare_exchange_result_u32 = OpTypePointer Function %__atomic_compare_exchange_result_u32
-         %30 = OpConstantNull %__atomic_compare_exchange_result_u32
+         %33 = OpConstantNull %__atomic_compare_exchange_result_u32
 %tint_zero_workgroup_memory = OpFunction %void None %6
   %local_idx = OpFunctionParameter %uint
          %10 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %15
+         %12 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %14 None
+               OpBranchConditional %12 %15 %14
+         %15 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %20
+               OpBranch %14
+         %14 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicCompareExchangeWeak_83580d = OpFunction %void None %18
-         %20 = OpLabel
-        %res = OpVariable %_ptr_Function___atomic_compare_exchange_result_u32 Function %30
-         %26 = OpAtomicCompareExchange %uint %arg_0 %uint_2 %uint_0 %uint_0 %uint_1 %uint_1
-         %27 = OpIEqual %bool %26 %uint_1
-         %21 = OpCompositeConstruct %__atomic_compare_exchange_result_u32 %26 %27
-               OpStore %res %21
+%atomicCompareExchangeWeak_83580d = OpFunction %void None %23
+         %25 = OpLabel
+        %res = OpVariable %_ptr_Function___atomic_compare_exchange_result_u32 Function %33
+         %29 = OpAtomicCompareExchange %uint %arg_0 %uint_2 %uint_0 %uint_0 %uint_1 %uint_1
+         %30 = OpIEqual %bool %29 %uint_1
+         %26 = OpCompositeConstruct %__atomic_compare_exchange_result_u32 %29 %30
+               OpStore %res %26
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %6
 %local_invocation_index = OpFunctionParameter %uint
-         %33 = OpLabel
-         %34 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %35 = OpFunctionCall %void %atomicCompareExchangeWeak_83580d
+         %36 = OpLabel
+         %37 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %38 = OpFunctionCall %void %atomicCompareExchangeWeak_83580d
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %18
-         %37 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %38 = OpFunctionCall %void %compute_main_inner %39
+%compute_main = OpFunction %void None %23
+         %40 = OpLabel
+         %42 = OpLoad %uint %local_invocation_index_1
+         %41 = OpFunctionCall %void %compute_main_inner %42
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.dxc.hlsl
index 9db9e06..ccddf89 100644
--- a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.dxc.hlsl
@@ -5,7 +5,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.fxc.hlsl
index 9db9e06..ccddf89 100644
--- a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.fxc.hlsl
@@ -5,7 +5,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.glsl
index 9414128..b8d7993 100644
--- a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.glsl
@@ -8,7 +8,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.msl
index 7dcd4f8..01ad230 100644
--- a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.msl
@@ -13,7 +13,7 @@
 }
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.spvasm
index 46440a9..d4d1d11 100644
--- a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/e88938.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 41
+; Bound: 45
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -30,42 +30,49 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
           %7 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %16 = OpConstantNull %int
+         %21 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %19 = OpTypeFunction %void
-       %bool = OpTypeBool
+         %24 = OpTypeFunction %void
 %__atomic_compare_exchange_result_i32 = OpTypeStruct %int %bool
       %int_1 = OpConstant %int 1
 %_ptr_Function___atomic_compare_exchange_result_i32 = OpTypePointer Function %__atomic_compare_exchange_result_i32
-         %31 = OpConstantNull %__atomic_compare_exchange_result_i32
+         %35 = OpConstantNull %__atomic_compare_exchange_result_i32
 %tint_zero_workgroup_memory = OpFunction %void None %7
   %local_idx = OpFunctionParameter %uint
          %11 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %16
+         %13 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %15 None
+               OpBranchConditional %13 %16 %15
+         %16 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %21
+               OpBranch %15
+         %15 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicCompareExchangeWeak_e88938 = OpFunction %void None %19
-         %21 = OpLabel
-        %res = OpVariable %_ptr_Function___atomic_compare_exchange_result_i32 Function %31
-         %27 = OpAtomicCompareExchange %int %arg_0 %uint_2 %uint_0 %uint_0 %int_1 %int_1
-         %28 = OpIEqual %bool %27 %int_1
-         %22 = OpCompositeConstruct %__atomic_compare_exchange_result_i32 %27 %28
-               OpStore %res %22
+%atomicCompareExchangeWeak_e88938 = OpFunction %void None %24
+         %26 = OpLabel
+        %res = OpVariable %_ptr_Function___atomic_compare_exchange_result_i32 Function %35
+         %31 = OpAtomicCompareExchange %int %arg_0 %uint_2 %uint_0 %uint_0 %int_1 %int_1
+         %32 = OpIEqual %bool %31 %int_1
+         %27 = OpCompositeConstruct %__atomic_compare_exchange_result_i32 %31 %32
+               OpStore %res %27
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %7
 %local_invocation_index = OpFunctionParameter %uint
-         %34 = OpLabel
-         %35 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %36 = OpFunctionCall %void %atomicCompareExchangeWeak_e88938
+         %38 = OpLabel
+         %39 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %40 = OpFunctionCall %void %atomicCompareExchangeWeak_e88938
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %19
-         %38 = OpLabel
-         %40 = OpLoad %uint %local_invocation_index_1
-         %39 = OpFunctionCall %void %compute_main_inner %40
+%compute_main = OpFunction %void None %24
+         %42 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %43 = OpFunctionCall %void %compute_main_inner %44
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.dxc.hlsl
index 820e5d1..b8d1a50 100644
--- a/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.fxc.hlsl
index 820e5d1..b8d1a50 100644
--- a/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.glsl
index c86deeb..28fb054 100644
--- a/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.msl
index 94dd528..eae5191 100644
--- a/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.spvasm
index ea1faa7..26861d3 100644
--- a/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atomicExchange/0a5dca.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 41
+; Bound: 45
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -34,41 +34,48 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %18 = OpConstantNull %uint
+         %23 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %void
-     %uint_1 = OpConstant %uint 1
+         %26 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %18
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %23
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicExchange_0a5dca = OpFunction %void None %21
-         %23 = OpLabel
-        %res = OpVariable %_ptr_Function_uint Function %18
-         %24 = OpAtomicExchange %uint %arg_0 %uint_2 %uint_0 %uint_1
-               OpStore %res %24
-         %30 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
-         %31 = OpLoad %uint %res
-               OpStore %30 %31
+%atomicExchange_0a5dca = OpFunction %void None %26
+         %28 = OpLabel
+        %res = OpVariable %_ptr_Function_uint Function %23
+         %29 = OpAtomicExchange %uint %arg_0 %uint_2 %uint_0 %uint_1
+               OpStore %res %29
+         %34 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
+         %35 = OpLoad %uint %res
+               OpStore %34 %35
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %34 = OpLabel
-         %35 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %36 = OpFunctionCall %void %atomicExchange_0a5dca
+         %38 = OpLabel
+         %39 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %40 = OpFunctionCall %void %atomicExchange_0a5dca
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %21
-         %38 = OpLabel
-         %40 = OpLoad %uint %local_invocation_index_1
-         %39 = OpFunctionCall %void %compute_main_inner %40
+%compute_main = OpFunction %void None %26
+         %42 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %43 = OpFunctionCall %void %compute_main_inner %44
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.dxc.hlsl
index 88d36f8..0a36404 100644
--- a/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.fxc.hlsl
index 88d36f8..0a36404 100644
--- a/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.glsl
index 318a139..9693f97 100644
--- a/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.msl
index 71a79d7..c37cd7d 100644
--- a/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.spvasm
index 802be3b..4fdd973 100644
--- a/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atomicExchange/e114ba.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 42
+; Bound: 47
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -35,41 +35,49 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
       %int_1 = OpConstant %int 1
 %_ptr_Function_int = OpTypePointer Function %int
 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicExchange_e114ba = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %19
-         %25 = OpAtomicExchange %int %arg_0 %uint_2 %uint_0 %int_1
-               OpStore %res %25
-         %31 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
-         %32 = OpLoad %int %res
-               OpStore %31 %32
+%atomicExchange_e114ba = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %24
+         %30 = OpAtomicExchange %int %arg_0 %uint_2 %uint_0 %int_1
+               OpStore %res %30
+         %36 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
+         %37 = OpLoad %int %res
+               OpStore %36 %37
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %35 = OpLabel
-         %36 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %37 = OpFunctionCall %void %atomicExchange_e114ba
+         %40 = OpLabel
+         %41 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %42 = OpFunctionCall %void %atomicExchange_e114ba
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %39 = OpLabel
-         %41 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %41
+%compute_main = OpFunction %void None %27
+         %44 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.dxc.hlsl
index e608399..163be61 100644
--- a/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.fxc.hlsl
index e608399..163be61 100644
--- a/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.glsl
index a68bfa4..fb09e7f 100644
--- a/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.msl
index 6d5d145..a674677 100644
--- a/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.spvasm
index d980cb3..0ffd7ee 100644
--- a/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atomicLoad/361bf1.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 40
+; Bound: 45
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -34,40 +34,48 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %18 = OpConstantNull %uint
+         %23 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %void
+         %26 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %18
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %23
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicLoad_361bf1 = OpFunction %void None %21
-         %23 = OpLabel
-        %res = OpVariable %_ptr_Function_uint Function %18
-         %24 = OpAtomicLoad %uint %arg_0 %uint_2 %uint_0
-               OpStore %res %24
-         %29 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
-         %30 = OpLoad %uint %res
-               OpStore %29 %30
+%atomicLoad_361bf1 = OpFunction %void None %26
+         %28 = OpLabel
+        %res = OpVariable %_ptr_Function_uint Function %23
+         %29 = OpAtomicLoad %uint %arg_0 %uint_2 %uint_0
+               OpStore %res %29
+         %34 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
+         %35 = OpLoad %uint %res
+               OpStore %34 %35
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %33 = OpLabel
-         %34 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %35 = OpFunctionCall %void %atomicLoad_361bf1
+         %38 = OpLabel
+         %39 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %40 = OpFunctionCall %void %atomicLoad_361bf1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %21
-         %37 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %38 = OpFunctionCall %void %compute_main_inner %39
+%compute_main = OpFunction %void None %26
+         %42 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %43 = OpFunctionCall %void %compute_main_inner %44
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.dxc.hlsl
index c89739f..0975b8b 100644
--- a/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.fxc.hlsl
index c89739f..0975b8b 100644
--- a/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.glsl
index ea65f03..1bae699 100644
--- a/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.msl
index c943946..031ed71 100644
--- a/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.spvasm
index d97cf21..09dddcf 100644
--- a/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atomicLoad/afcc03.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 41
+; Bound: 46
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -35,40 +35,48 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicLoad_afcc03 = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %19
-         %25 = OpAtomicLoad %int %arg_0 %uint_2 %uint_0
-               OpStore %res %25
-         %30 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
-         %31 = OpLoad %int %res
-               OpStore %30 %31
+%atomicLoad_afcc03 = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %24
+         %30 = OpAtomicLoad %int %arg_0 %uint_2 %uint_0
+               OpStore %res %30
+         %35 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
+         %36 = OpLoad %int %res
+               OpStore %35 %36
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %34 = OpLabel
-         %35 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %36 = OpFunctionCall %void %atomicLoad_afcc03
+         %39 = OpLabel
+         %40 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %41 = OpFunctionCall %void %atomicLoad_afcc03
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %38 = OpLabel
-         %40 = OpLoad %uint %local_invocation_index_1
-         %39 = OpFunctionCall %void %compute_main_inner %40
+%compute_main = OpFunction %void None %27
+         %43 = OpLabel
+         %45 = OpLoad %uint %local_invocation_index_1
+         %44 = OpFunctionCall %void %compute_main_inner %45
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.dxc.hlsl
index 7d6bc91..378fb3d 100644
--- a/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.fxc.hlsl
index 7d6bc91..378fb3d 100644
--- a/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.glsl
index 94c5214..ea17b3d 100644
--- a/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.msl
index 393035b..409994b 100644
--- a/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.spvasm
index f013474..0a33f69 100644
--- a/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atomicMax/a89cc3.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 42
+; Bound: 47
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -35,41 +35,49 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
       %int_1 = OpConstant %int 1
 %_ptr_Function_int = OpTypePointer Function %int
 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicMax_a89cc3 = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %19
-         %25 = OpAtomicSMax %int %arg_0 %uint_2 %uint_0 %int_1
-               OpStore %res %25
-         %31 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
-         %32 = OpLoad %int %res
-               OpStore %31 %32
+%atomicMax_a89cc3 = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %24
+         %30 = OpAtomicSMax %int %arg_0 %uint_2 %uint_0 %int_1
+               OpStore %res %30
+         %36 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
+         %37 = OpLoad %int %res
+               OpStore %36 %37
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %35 = OpLabel
-         %36 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %37 = OpFunctionCall %void %atomicMax_a89cc3
+         %40 = OpLabel
+         %41 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %42 = OpFunctionCall %void %atomicMax_a89cc3
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %39 = OpLabel
-         %41 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %41
+%compute_main = OpFunction %void None %27
+         %44 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.dxc.hlsl
index be631a4..b618ef1 100644
--- a/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.fxc.hlsl
index be631a4..b618ef1 100644
--- a/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.glsl
index c21f36f..5d943a4 100644
--- a/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.msl
index 11d2ff0..b7d4e5a 100644
--- a/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.spvasm
index a1977a2..d05c2d8 100644
--- a/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atomicMax/beccfc.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 41
+; Bound: 45
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -34,41 +34,48 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %18 = OpConstantNull %uint
+         %23 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %void
-     %uint_1 = OpConstant %uint 1
+         %26 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %18
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %23
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicMax_beccfc = OpFunction %void None %21
-         %23 = OpLabel
-        %res = OpVariable %_ptr_Function_uint Function %18
-         %24 = OpAtomicUMax %uint %arg_0 %uint_2 %uint_0 %uint_1
-               OpStore %res %24
-         %30 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
-         %31 = OpLoad %uint %res
-               OpStore %30 %31
+%atomicMax_beccfc = OpFunction %void None %26
+         %28 = OpLabel
+        %res = OpVariable %_ptr_Function_uint Function %23
+         %29 = OpAtomicUMax %uint %arg_0 %uint_2 %uint_0 %uint_1
+               OpStore %res %29
+         %34 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
+         %35 = OpLoad %uint %res
+               OpStore %34 %35
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %34 = OpLabel
-         %35 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %36 = OpFunctionCall %void %atomicMax_beccfc
+         %38 = OpLabel
+         %39 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %40 = OpFunctionCall %void %atomicMax_beccfc
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %21
-         %38 = OpLabel
-         %40 = OpLoad %uint %local_invocation_index_1
-         %39 = OpFunctionCall %void %compute_main_inner %40
+%compute_main = OpFunction %void None %26
+         %42 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %43 = OpFunctionCall %void %compute_main_inner %44
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.dxc.hlsl
index d3d95ca..bbad797 100644
--- a/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.fxc.hlsl
index d3d95ca..bbad797 100644
--- a/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.glsl
index be1d651..331ddd0 100644
--- a/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.msl
index d054a6b..2b2e181 100644
--- a/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.spvasm
index ab643d2..7c81041 100644
--- a/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atomicMin/278235.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 42
+; Bound: 47
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -35,41 +35,49 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
       %int_1 = OpConstant %int 1
 %_ptr_Function_int = OpTypePointer Function %int
 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicMin_278235 = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %19
-         %25 = OpAtomicSMin %int %arg_0 %uint_2 %uint_0 %int_1
-               OpStore %res %25
-         %31 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
-         %32 = OpLoad %int %res
-               OpStore %31 %32
+%atomicMin_278235 = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %24
+         %30 = OpAtomicSMin %int %arg_0 %uint_2 %uint_0 %int_1
+               OpStore %res %30
+         %36 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
+         %37 = OpLoad %int %res
+               OpStore %36 %37
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %35 = OpLabel
-         %36 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %37 = OpFunctionCall %void %atomicMin_278235
+         %40 = OpLabel
+         %41 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %42 = OpFunctionCall %void %atomicMin_278235
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %39 = OpLabel
-         %41 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %41
+%compute_main = OpFunction %void None %27
+         %44 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.dxc.hlsl
index 75e8e3f..6bdd23c 100644
--- a/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.fxc.hlsl
index 75e8e3f..6bdd23c 100644
--- a/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.glsl
index cba7786..1b846af 100644
--- a/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.msl
index 5da6233..7d0dbbc 100644
--- a/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.spvasm
index 37a1203..06b7558 100644
--- a/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atomicMin/69d383.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 41
+; Bound: 45
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -34,41 +34,48 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %18 = OpConstantNull %uint
+         %23 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %void
-     %uint_1 = OpConstant %uint 1
+         %26 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %18
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %23
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicMin_69d383 = OpFunction %void None %21
-         %23 = OpLabel
-        %res = OpVariable %_ptr_Function_uint Function %18
-         %24 = OpAtomicUMin %uint %arg_0 %uint_2 %uint_0 %uint_1
-               OpStore %res %24
-         %30 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
-         %31 = OpLoad %uint %res
-               OpStore %30 %31
+%atomicMin_69d383 = OpFunction %void None %26
+         %28 = OpLabel
+        %res = OpVariable %_ptr_Function_uint Function %23
+         %29 = OpAtomicUMin %uint %arg_0 %uint_2 %uint_0 %uint_1
+               OpStore %res %29
+         %34 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
+         %35 = OpLoad %uint %res
+               OpStore %34 %35
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %34 = OpLabel
-         %35 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %36 = OpFunctionCall %void %atomicMin_69d383
+         %38 = OpLabel
+         %39 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %40 = OpFunctionCall %void %atomicMin_69d383
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %21
-         %38 = OpLabel
-         %40 = OpLoad %uint %local_invocation_index_1
-         %39 = OpFunctionCall %void %compute_main_inner %40
+%compute_main = OpFunction %void None %26
+         %42 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %43 = OpFunctionCall %void %compute_main_inner %44
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.dxc.hlsl
index cc3b377..1765481 100644
--- a/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.fxc.hlsl
index cc3b377..1765481 100644
--- a/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.glsl
index 8f29c92..e58c51b 100644
--- a/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.msl
index fff53a5..fa7ce51 100644
--- a/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.spvasm
index dc9eef2..c9de1d9 100644
--- a/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atomicOr/5e3d61.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 41
+; Bound: 45
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -34,41 +34,48 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %18 = OpConstantNull %uint
+         %23 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %void
-     %uint_1 = OpConstant %uint 1
+         %26 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %18
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %23
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicOr_5e3d61 = OpFunction %void None %21
-         %23 = OpLabel
-        %res = OpVariable %_ptr_Function_uint Function %18
-         %24 = OpAtomicOr %uint %arg_0 %uint_2 %uint_0 %uint_1
-               OpStore %res %24
-         %30 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
-         %31 = OpLoad %uint %res
-               OpStore %30 %31
+%atomicOr_5e3d61 = OpFunction %void None %26
+         %28 = OpLabel
+        %res = OpVariable %_ptr_Function_uint Function %23
+         %29 = OpAtomicOr %uint %arg_0 %uint_2 %uint_0 %uint_1
+               OpStore %res %29
+         %34 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
+         %35 = OpLoad %uint %res
+               OpStore %34 %35
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %34 = OpLabel
-         %35 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %36 = OpFunctionCall %void %atomicOr_5e3d61
+         %38 = OpLabel
+         %39 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %40 = OpFunctionCall %void %atomicOr_5e3d61
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %21
-         %38 = OpLabel
-         %40 = OpLoad %uint %local_invocation_index_1
-         %39 = OpFunctionCall %void %compute_main_inner %40
+%compute_main = OpFunction %void None %26
+         %42 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %43 = OpFunctionCall %void %compute_main_inner %44
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.dxc.hlsl
index 80ea0bf..2144edc 100644
--- a/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.fxc.hlsl
index 80ea0bf..2144edc 100644
--- a/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.glsl
index 8cb6ab4..7ff80cb 100644
--- a/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.msl
index d60afd5..be34558 100644
--- a/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.spvasm
index f6ef9b8..55d4937 100644
--- a/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atomicOr/d09248.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 42
+; Bound: 47
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -35,41 +35,49 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
       %int_1 = OpConstant %int 1
 %_ptr_Function_int = OpTypePointer Function %int
 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicOr_d09248 = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %19
-         %25 = OpAtomicOr %int %arg_0 %uint_2 %uint_0 %int_1
-               OpStore %res %25
-         %31 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
-         %32 = OpLoad %int %res
-               OpStore %31 %32
+%atomicOr_d09248 = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %24
+         %30 = OpAtomicOr %int %arg_0 %uint_2 %uint_0 %int_1
+               OpStore %res %30
+         %36 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
+         %37 = OpLoad %int %res
+               OpStore %36 %37
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %35 = OpLabel
-         %36 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %37 = OpFunctionCall %void %atomicOr_d09248
+         %40 = OpLabel
+         %41 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %42 = OpFunctionCall %void %atomicOr_d09248
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %39 = OpLabel
-         %41 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %41
+%compute_main = OpFunction %void None %27
+         %44 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.dxc.hlsl
index 690f99f..7fd7d5e 100644
--- a/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.fxc.hlsl
index 690f99f..7fd7d5e 100644
--- a/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.glsl
index fa62cfc..8a1fbd8 100644
--- a/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.msl
index 90f339a..234acdb 100644
--- a/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.spvasm
index 113d110..06feaf1 100644
--- a/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atomicStore/726882.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 33
+; Bound: 37
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -23,34 +23,41 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %6 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %15 = OpConstantNull %uint
+         %20 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %18 = OpTypeFunction %void
-     %uint_1 = OpConstant %uint 1
+         %23 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %6
   %local_idx = OpFunctionParameter %uint
          %10 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %15
+         %12 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %14 None
+               OpBranchConditional %12 %15 %14
+         %15 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %20
+               OpBranch %14
+         %14 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicStore_726882 = OpFunction %void None %18
-         %20 = OpLabel
+%atomicStore_726882 = OpFunction %void None %23
+         %25 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %uint_1
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %6
 %local_invocation_index = OpFunctionParameter %uint
-         %26 = OpLabel
-         %27 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %28 = OpFunctionCall %void %atomicStore_726882
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %32 = OpFunctionCall %void %atomicStore_726882
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %18
-         %30 = OpLabel
-         %32 = OpLoad %uint %local_invocation_index_1
-         %31 = OpFunctionCall %void %compute_main_inner %32
+%compute_main = OpFunction %void None %23
+         %34 = OpLabel
+         %36 = OpLoad %uint %local_invocation_index_1
+         %35 = OpFunctionCall %void %compute_main_inner %36
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.dxc.hlsl
index 1b9f844..049aa88 100644
--- a/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.fxc.hlsl
index 1b9f844..049aa88 100644
--- a/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.glsl
index 5714b9b..30f1cc1 100644
--- a/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.msl
index 02ff6c1..d3018ac 100644
--- a/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.spvasm
index 3fbc211..b5e146a 100644
--- a/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atomicStore/8bea94.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 34
+; Bound: 39
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -24,34 +24,42 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
           %7 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %16 = OpConstantNull %int
+         %21 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %19 = OpTypeFunction %void
+         %24 = OpTypeFunction %void
       %int_1 = OpConstant %int 1
 %tint_zero_workgroup_memory = OpFunction %void None %7
   %local_idx = OpFunctionParameter %uint
          %11 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %16
+         %13 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %15 None
+               OpBranchConditional %13 %16 %15
+         %16 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %21
+               OpBranch %15
+         %15 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicStore_8bea94 = OpFunction %void None %19
-         %21 = OpLabel
+%atomicStore_8bea94 = OpFunction %void None %24
+         %26 = OpLabel
                OpAtomicStore %arg_0 %uint_2 %uint_0 %int_1
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %7
 %local_invocation_index = OpFunctionParameter %uint
-         %27 = OpLabel
-         %28 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %29 = OpFunctionCall %void %atomicStore_8bea94
+         %32 = OpLabel
+         %33 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %34 = OpFunctionCall %void %atomicStore_8bea94
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %19
-         %31 = OpLabel
-         %33 = OpLoad %uint %local_invocation_index_1
-         %32 = OpFunctionCall %void %compute_main_inner %33
+%compute_main = OpFunction %void None %24
+         %36 = OpLabel
+         %38 = OpLoad %uint %local_invocation_index_1
+         %37 = OpFunctionCall %void %compute_main_inner %38
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.dxc.hlsl
index 3b6c10c..40009aa 100644
--- a/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.fxc.hlsl
index 3b6c10c..40009aa 100644
--- a/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.glsl
index 5203f37..022b6bc 100644
--- a/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.msl
index a4b7251..ae640cc 100644
--- a/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.spvasm
index 1ba0b00..6a491ac 100644
--- a/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atomicSub/0d26c2.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 41
+; Bound: 45
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -34,41 +34,48 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %18 = OpConstantNull %uint
+         %23 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %void
-     %uint_1 = OpConstant %uint 1
+         %26 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %18
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %23
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicSub_0d26c2 = OpFunction %void None %21
-         %23 = OpLabel
-        %res = OpVariable %_ptr_Function_uint Function %18
-         %24 = OpAtomicISub %uint %arg_0 %uint_2 %uint_0 %uint_1
-               OpStore %res %24
-         %30 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
-         %31 = OpLoad %uint %res
-               OpStore %30 %31
+%atomicSub_0d26c2 = OpFunction %void None %26
+         %28 = OpLabel
+        %res = OpVariable %_ptr_Function_uint Function %23
+         %29 = OpAtomicISub %uint %arg_0 %uint_2 %uint_0 %uint_1
+               OpStore %res %29
+         %34 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
+         %35 = OpLoad %uint %res
+               OpStore %34 %35
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %34 = OpLabel
-         %35 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %36 = OpFunctionCall %void %atomicSub_0d26c2
+         %38 = OpLabel
+         %39 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %40 = OpFunctionCall %void %atomicSub_0d26c2
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %21
-         %38 = OpLabel
-         %40 = OpLoad %uint %local_invocation_index_1
-         %39 = OpFunctionCall %void %compute_main_inner %40
+%compute_main = OpFunction %void None %26
+         %42 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %43 = OpFunctionCall %void %compute_main_inner %44
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.dxc.hlsl
index 1792e11..d480c6a 100644
--- a/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.fxc.hlsl
index 1792e11..d480c6a 100644
--- a/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.glsl
index 8357c4c..f2b6724 100644
--- a/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.msl
index cb0a453..2052ac8 100644
--- a/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.spvasm
index a3e0d89..ecca709 100644
--- a/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atomicSub/77883a.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 42
+; Bound: 47
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -35,41 +35,49 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
       %int_1 = OpConstant %int 1
 %_ptr_Function_int = OpTypePointer Function %int
 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicSub_77883a = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %19
-         %25 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %int_1
-               OpStore %res %25
-         %31 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
-         %32 = OpLoad %int %res
-               OpStore %31 %32
+%atomicSub_77883a = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %24
+         %30 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %int_1
+               OpStore %res %30
+         %36 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
+         %37 = OpLoad %int %res
+               OpStore %36 %37
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %35 = OpLabel
-         %36 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %37 = OpFunctionCall %void %atomicSub_77883a
+         %40 = OpLabel
+         %41 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %42 = OpFunctionCall %void %atomicSub_77883a
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %39 = OpLabel
-         %41 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %41
+%compute_main = OpFunction %void None %27
+         %44 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.dxc.hlsl
index 2c087af..caf3a96 100644
--- a/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.fxc.hlsl
index 2c087af..caf3a96 100644
--- a/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.glsl
index 88b60ab..f18de2d 100644
--- a/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.msl
index c0f02c0..e393369 100644
--- a/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.spvasm
index b614272..52af882 100644
--- a/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atomicXor/75dc95.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 42
+; Bound: 47
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -35,41 +35,49 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
       %int_1 = OpConstant %int 1
 %_ptr_Function_int = OpTypePointer Function %int
 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicXor_75dc95 = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %19
-         %25 = OpAtomicXor %int %arg_0 %uint_2 %uint_0 %int_1
-               OpStore %res %25
-         %31 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
-         %32 = OpLoad %int %res
-               OpStore %31 %32
+%atomicXor_75dc95 = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %24
+         %30 = OpAtomicXor %int %arg_0 %uint_2 %uint_0 %int_1
+               OpStore %res %30
+         %36 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
+         %37 = OpLoad %int %res
+               OpStore %36 %37
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %35 = OpLabel
-         %36 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %37 = OpFunctionCall %void %atomicXor_75dc95
+         %40 = OpLabel
+         %41 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %42 = OpFunctionCall %void %atomicXor_75dc95
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %39 = OpLabel
-         %41 = OpLoad %uint %local_invocation_index_1
-         %40 = OpFunctionCall %void %compute_main_inner %41
+%compute_main = OpFunction %void None %27
+         %44 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.dxc.hlsl
index 915208e..9905efe 100644
--- a/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.fxc.hlsl
index 915208e..9905efe 100644
--- a/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.glsl
index 6f325c3..5b0b63e 100644
--- a/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.msl b/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.msl
index 6bc3329..0e417f1 100644
--- a/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.spvasm
index 6d2abf0..ef76069 100644
--- a/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atomicXor/c8e6be.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 41
+; Bound: 45
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -34,41 +34,48 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %18 = OpConstantNull %uint
+         %23 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %void
-     %uint_1 = OpConstant %uint 1
+         %26 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %18
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %23
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicXor_c8e6be = OpFunction %void None %21
-         %23 = OpLabel
-        %res = OpVariable %_ptr_Function_uint Function %18
-         %24 = OpAtomicXor %uint %arg_0 %uint_2 %uint_0 %uint_1
-               OpStore %res %24
-         %30 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
-         %31 = OpLoad %uint %res
-               OpStore %30 %31
+%atomicXor_c8e6be = OpFunction %void None %26
+         %28 = OpLabel
+        %res = OpVariable %_ptr_Function_uint Function %23
+         %29 = OpAtomicXor %uint %arg_0 %uint_2 %uint_0 %uint_1
+               OpStore %res %29
+         %34 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
+         %35 = OpLoad %uint %res
+               OpStore %34 %35
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %34 = OpLabel
-         %35 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %36 = OpFunctionCall %void %atomicXor_c8e6be
+         %38 = OpLabel
+         %39 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %40 = OpFunctionCall %void %atomicXor_c8e6be
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %21
-         %38 = OpLabel
-         %40 = OpLoad %uint %local_invocation_index_1
-         %39 = OpFunctionCall %void %compute_main_inner %40
+%compute_main = OpFunction %void None %26
+         %42 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %43 = OpFunctionCall %void %compute_main_inner %44
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.dxc.hlsl
index e5f174a..8f2a467 100644
--- a/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     arg_0 = 0u;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.fxc.hlsl
index e5f174a..8f2a467 100644
--- a/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     arg_0 = 0u;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.glsl
index 5808d5a..26e3013 100644
--- a/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     arg_0 = 0u;
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.msl b/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.msl
index bb40546..ec0012b 100644
--- a/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = 0u;
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.spvasm
index 3555fb1..9cb7da0 100644
--- a/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 43
+; Bound: 48
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -35,48 +35,56 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
-         %14 = OpConstantNull %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %19 = OpConstantNull %uint
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %18 = OpTypeFunction %uint
-         %24 = OpTypeFunction %void
+         %23 = OpTypeFunction %uint
+         %29 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
      %uint_0 = OpConstant %uint 0
 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpStore %arg_0 %14
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpStore %arg_0 %19
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%tint_workgroupUniformLoad_arg_0 = OpFunction %uint None %18
-         %20 = OpLabel
+%tint_workgroupUniformLoad_arg_0 = OpFunction %uint None %23
+         %25 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %22 = OpLoad %uint %arg_0
+         %27 = OpLoad %uint %arg_0
                OpControlBarrier %uint_2 %uint_2 %uint_264
-               OpReturnValue %22
+               OpReturnValue %27
                OpFunctionEnd
-%workgroupUniformLoad_37307c = OpFunction %void None %24
-         %26 = OpLabel
-        %res = OpVariable %_ptr_Function_uint Function %14
-         %27 = OpFunctionCall %uint %tint_workgroupUniformLoad_arg_0
-               OpStore %res %27
-         %32 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
-         %33 = OpLoad %uint %res
-               OpStore %32 %33
+%workgroupUniformLoad_37307c = OpFunction %void None %29
+         %31 = OpLabel
+        %res = OpVariable %_ptr_Function_uint Function %19
+         %32 = OpFunctionCall %uint %tint_workgroupUniformLoad_arg_0
+               OpStore %res %32
+         %37 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
+         %38 = OpLoad %uint %res
+               OpStore %37 %38
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %36 = OpLabel
-         %37 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %38 = OpFunctionCall %void %workgroupUniformLoad_37307c
+         %41 = OpLabel
+         %42 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %43 = OpFunctionCall %void %workgroupUniformLoad_37307c
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %24
-         %40 = OpLabel
-         %42 = OpLoad %uint %local_invocation_index_1
-         %41 = OpFunctionCall %void %compute_main_inner %42
+%compute_main = OpFunction %void None %29
+         %45 = OpLabel
+         %47 = OpLoad %uint %local_invocation_index_1
+         %46 = OpFunctionCall %void %compute_main_inner %47
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.dxc.hlsl
index eda928e..d9bb0a1 100644
--- a/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     arg_0 = 0.0f;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.fxc.hlsl
index eda928e..d9bb0a1 100644
--- a/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     arg_0 = 0.0f;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.glsl
index a08fb8a..776fee2 100644
--- a/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared float arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     arg_0 = 0.0f;
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.msl b/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.msl
index 2bd0d92..216a543 100644
--- a/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = 0.0f;
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.spvasm
index eccd612..a8c918f 100644
--- a/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 44
+; Bound: 49
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -36,48 +36,56 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
-         %15 = OpConstantNull %float
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %20 = OpConstantNull %float
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %19 = OpTypeFunction %float
-         %25 = OpTypeFunction %void
+         %24 = OpTypeFunction %float
+         %30 = OpTypeFunction %void
 %_ptr_Function_float = OpTypePointer Function %float
      %uint_0 = OpConstant %uint 0
 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpStore %arg_0 %15
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpStore %arg_0 %20
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%tint_workgroupUniformLoad_arg_0 = OpFunction %float None %19
-         %21 = OpLabel
+%tint_workgroupUniformLoad_arg_0 = OpFunction %float None %24
+         %26 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %23 = OpLoad %float %arg_0
+         %28 = OpLoad %float %arg_0
                OpControlBarrier %uint_2 %uint_2 %uint_264
-               OpReturnValue %23
+               OpReturnValue %28
                OpFunctionEnd
-%workgroupUniformLoad_7a857c = OpFunction %void None %25
-         %27 = OpLabel
-        %res = OpVariable %_ptr_Function_float Function %15
-         %28 = OpFunctionCall %float %tint_workgroupUniformLoad_arg_0
-               OpStore %res %28
-         %33 = OpAccessChain %_ptr_StorageBuffer_float %prevent_dce %uint_0
-         %34 = OpLoad %float %res
-               OpStore %33 %34
+%workgroupUniformLoad_7a857c = OpFunction %void None %30
+         %32 = OpLabel
+        %res = OpVariable %_ptr_Function_float Function %20
+         %33 = OpFunctionCall %float %tint_workgroupUniformLoad_arg_0
+               OpStore %res %33
+         %38 = OpAccessChain %_ptr_StorageBuffer_float %prevent_dce %uint_0
+         %39 = OpLoad %float %res
+               OpStore %38 %39
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %37 = OpLabel
-         %38 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %39 = OpFunctionCall %void %workgroupUniformLoad_7a857c
+         %42 = OpLabel
+         %43 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %44 = OpFunctionCall %void %workgroupUniformLoad_7a857c
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %25
-         %41 = OpLabel
-         %43 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %43
+%compute_main = OpFunction %void None %30
+         %46 = OpLabel
+         %48 = OpLoad %uint %local_invocation_index_1
+         %47 = OpFunctionCall %void %compute_main_inner %48
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.dxc.hlsl
index 5dcfc3e..2c5c117 100644
--- a/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     arg_0 = 0;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.fxc.hlsl
index 5dcfc3e..2c5c117 100644
--- a/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     arg_0 = 0;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.glsl b/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.glsl
index 9de7f63..709b13f 100644
--- a/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     arg_0 = 0;
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.msl b/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.msl
index e2daece..330157a 100644
--- a/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = 0;
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.spvasm
index 4af09a0..83b4371 100644
--- a/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 44
+; Bound: 49
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -36,48 +36,56 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
-         %15 = OpConstantNull %int
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %20 = OpConstantNull %int
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %19 = OpTypeFunction %int
-         %25 = OpTypeFunction %void
+         %24 = OpTypeFunction %int
+         %30 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
      %uint_0 = OpConstant %uint 0
 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpStore %arg_0 %15
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpStore %arg_0 %20
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%tint_workgroupUniformLoad_arg_0 = OpFunction %int None %19
-         %21 = OpLabel
+%tint_workgroupUniformLoad_arg_0 = OpFunction %int None %24
+         %26 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %23 = OpLoad %int %arg_0
+         %28 = OpLoad %int %arg_0
                OpControlBarrier %uint_2 %uint_2 %uint_264
-               OpReturnValue %23
+               OpReturnValue %28
                OpFunctionEnd
-%workgroupUniformLoad_9d33de = OpFunction %void None %25
-         %27 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %15
-         %28 = OpFunctionCall %int %tint_workgroupUniformLoad_arg_0
-               OpStore %res %28
-         %33 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
-         %34 = OpLoad %int %res
-               OpStore %33 %34
+%workgroupUniformLoad_9d33de = OpFunction %void None %30
+         %32 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %20
+         %33 = OpFunctionCall %int %tint_workgroupUniformLoad_arg_0
+               OpStore %res %33
+         %38 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
+         %39 = OpLoad %int %res
+               OpStore %38 %39
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %37 = OpLabel
-         %38 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %39 = OpFunctionCall %void %workgroupUniformLoad_9d33de
+         %42 = OpLabel
+         %43 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %44 = OpFunctionCall %void %workgroupUniformLoad_9d33de
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %25
-         %41 = OpLabel
-         %43 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %43
+%compute_main = OpFunction %void None %30
+         %46 = OpLabel
+         %48 = OpLoad %uint %local_invocation_index_1
+         %47 = OpFunctionCall %void %compute_main_inner %48
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.dxc.hlsl
index 11c6726..7c77008 100644
--- a/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float16_t arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     arg_0 = float16_t(0.0h);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.glsl b/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.glsl
index 9f4ef5e..32e1b5d 100644
--- a/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.glsl
@@ -3,7 +3,7 @@
 
 shared float16_t arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     arg_0 = 0.0hf;
   }
   barrier();
diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.msl b/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.msl
index 9f16611..cde3a1d 100644
--- a/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup half* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = 0.0h;
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.spvasm
index e72386f..912bff3 100644
--- a/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 44
+; Bound: 49
 ; Schema: 0
                OpCapability Shader
                OpCapability Float16
@@ -39,48 +39,56 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
-         %15 = OpConstantNull %half
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %20 = OpConstantNull %half
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %19 = OpTypeFunction %half
-         %25 = OpTypeFunction %void
+         %24 = OpTypeFunction %half
+         %30 = OpTypeFunction %void
 %_ptr_Function_half = OpTypePointer Function %half
      %uint_0 = OpConstant %uint 0
 %_ptr_StorageBuffer_half = OpTypePointer StorageBuffer %half
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpStore %arg_0 %15
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpStore %arg_0 %20
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%tint_workgroupUniformLoad_arg_0 = OpFunction %half None %19
-         %21 = OpLabel
+%tint_workgroupUniformLoad_arg_0 = OpFunction %half None %24
+         %26 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %23 = OpLoad %half %arg_0
+         %28 = OpLoad %half %arg_0
                OpControlBarrier %uint_2 %uint_2 %uint_264
-               OpReturnValue %23
+               OpReturnValue %28
                OpFunctionEnd
-%workgroupUniformLoad_e07d08 = OpFunction %void None %25
-         %27 = OpLabel
-        %res = OpVariable %_ptr_Function_half Function %15
-         %28 = OpFunctionCall %half %tint_workgroupUniformLoad_arg_0
-               OpStore %res %28
-         %33 = OpAccessChain %_ptr_StorageBuffer_half %prevent_dce %uint_0
-         %34 = OpLoad %half %res
-               OpStore %33 %34
+%workgroupUniformLoad_e07d08 = OpFunction %void None %30
+         %32 = OpLabel
+        %res = OpVariable %_ptr_Function_half Function %20
+         %33 = OpFunctionCall %half %tint_workgroupUniformLoad_arg_0
+               OpStore %res %33
+         %38 = OpAccessChain %_ptr_StorageBuffer_half %prevent_dce %uint_0
+         %39 = OpLoad %half %res
+               OpStore %38 %39
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %37 = OpLabel
-         %38 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %39 = OpFunctionCall %void %workgroupUniformLoad_e07d08
+         %42 = OpLabel
+         %43 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %44 = OpFunctionCall %void %workgroupUniformLoad_e07d08
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %25
-         %41 = OpLabel
-         %43 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %43
+%compute_main = OpFunction %void None %30
+         %46 = OpLabel
+         %48 = OpLoad %uint %local_invocation_index_1
+         %47 = OpFunctionCall %void %compute_main_inner %48
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.dxc.hlsl
index 9b4ceff..e2bb3a1 100644
--- a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.fxc.hlsl
index 9b4ceff..e2bb3a1 100644
--- a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.glsl
index 2ee2998..e89e139 100644
--- a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.msl
index 82cae46..886df8c 100644
--- a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.spvasm
index b4d95c8..6039b45 100644
--- a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 44
+; Bound: 49
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -36,44 +36,52 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
       %int_1 = OpConstant %int 1
 %_ptr_Function_int = OpTypePointer Function %int
 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAdd_794055 = OpFunction %void None %22
-         %24 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_int Function %19
-        %res = OpVariable %_ptr_Function_int Function %19
+%atomicAdd_794055 = OpFunction %void None %27
+         %29 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_int Function %24
+        %res = OpVariable %_ptr_Function_int Function %24
                OpStore %arg_1 %int_1
-         %30 = OpLoad %int %arg_1
-         %28 = OpAtomicIAdd %int %arg_0 %uint_2 %uint_0 %30
-               OpStore %res %28
-         %33 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
-         %34 = OpLoad %int %res
-               OpStore %33 %34
+         %35 = OpLoad %int %arg_1
+         %33 = OpAtomicIAdd %int %arg_0 %uint_2 %uint_0 %35
+               OpStore %res %33
+         %38 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
+         %39 = OpLoad %int %res
+               OpStore %38 %39
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %37 = OpLabel
-         %38 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %39 = OpFunctionCall %void %atomicAdd_794055
+         %42 = OpLabel
+         %43 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %44 = OpFunctionCall %void %atomicAdd_794055
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %41 = OpLabel
-         %43 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %43
+%compute_main = OpFunction %void None %27
+         %46 = OpLabel
+         %48 = OpLoad %uint %local_invocation_index_1
+         %47 = OpFunctionCall %void %compute_main_inner %48
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.dxc.hlsl
index dd6cb2d..1ed9fab 100644
--- a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.fxc.hlsl
index dd6cb2d..1ed9fab 100644
--- a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.glsl
index 6b5e36f..85ab6c5 100644
--- a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.msl
index 50f3873..64c3c0d 100644
--- a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.spvasm
index c6b0e5a..56cd96d 100644
--- a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 43
+; Bound: 47
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -35,44 +35,51 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %18 = OpConstantNull %uint
+         %23 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %void
-     %uint_1 = OpConstant %uint 1
+         %26 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %18
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %23
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAdd_d5db1d = OpFunction %void None %21
-         %23 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_uint Function %18
-        %res = OpVariable %_ptr_Function_uint Function %18
+%atomicAdd_d5db1d = OpFunction %void None %26
+         %28 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_uint Function %23
+        %res = OpVariable %_ptr_Function_uint Function %23
                OpStore %arg_1 %uint_1
-         %29 = OpLoad %uint %arg_1
-         %27 = OpAtomicIAdd %uint %arg_0 %uint_2 %uint_0 %29
-               OpStore %res %27
-         %32 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
-         %33 = OpLoad %uint %res
-               OpStore %32 %33
+         %33 = OpLoad %uint %arg_1
+         %31 = OpAtomicIAdd %uint %arg_0 %uint_2 %uint_0 %33
+               OpStore %res %31
+         %36 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
+         %37 = OpLoad %uint %res
+               OpStore %36 %37
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %36 = OpLabel
-         %37 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %38 = OpFunctionCall %void %atomicAdd_d5db1d
+         %40 = OpLabel
+         %41 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %42 = OpFunctionCall %void %atomicAdd_d5db1d
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %21
-         %40 = OpLabel
-         %42 = OpLoad %uint %local_invocation_index_1
-         %41 = OpFunctionCall %void %compute_main_inner %42
+%compute_main = OpFunction %void None %26
+         %44 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.dxc.hlsl
index d0100b2..be2a58b 100644
--- a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.fxc.hlsl
index d0100b2..be2a58b 100644
--- a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.glsl
index 0c2b326..f424082 100644
--- a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.msl
index 1f9f48a..80bc178 100644
--- a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.spvasm
index 51cb946..367a241 100644
--- a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 43
+; Bound: 47
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -35,44 +35,51 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %18 = OpConstantNull %uint
+         %23 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %void
-     %uint_1 = OpConstant %uint 1
+         %26 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %18
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %23
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAnd_34edd3 = OpFunction %void None %21
-         %23 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_uint Function %18
-        %res = OpVariable %_ptr_Function_uint Function %18
+%atomicAnd_34edd3 = OpFunction %void None %26
+         %28 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_uint Function %23
+        %res = OpVariable %_ptr_Function_uint Function %23
                OpStore %arg_1 %uint_1
-         %29 = OpLoad %uint %arg_1
-         %27 = OpAtomicAnd %uint %arg_0 %uint_2 %uint_0 %29
-               OpStore %res %27
-         %32 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
-         %33 = OpLoad %uint %res
-               OpStore %32 %33
+         %33 = OpLoad %uint %arg_1
+         %31 = OpAtomicAnd %uint %arg_0 %uint_2 %uint_0 %33
+               OpStore %res %31
+         %36 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
+         %37 = OpLoad %uint %res
+               OpStore %36 %37
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %36 = OpLabel
-         %37 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %38 = OpFunctionCall %void %atomicAnd_34edd3
+         %40 = OpLabel
+         %41 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %42 = OpFunctionCall %void %atomicAnd_34edd3
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %21
-         %40 = OpLabel
-         %42 = OpLoad %uint %local_invocation_index_1
-         %41 = OpFunctionCall %void %compute_main_inner %42
+%compute_main = OpFunction %void None %26
+         %44 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.dxc.hlsl
index 9426d68..52c0f5a 100644
--- a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.fxc.hlsl
index 9426d68..52c0f5a 100644
--- a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.glsl
index 98345c5..ab896f7 100644
--- a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.msl
index 44537d2..16a3eff 100644
--- a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.spvasm
index 32b3e8c..57b8fda 100644
--- a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 44
+; Bound: 49
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -36,44 +36,52 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
       %int_1 = OpConstant %int 1
 %_ptr_Function_int = OpTypePointer Function %int
 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicAnd_45a819 = OpFunction %void None %22
-         %24 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_int Function %19
-        %res = OpVariable %_ptr_Function_int Function %19
+%atomicAnd_45a819 = OpFunction %void None %27
+         %29 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_int Function %24
+        %res = OpVariable %_ptr_Function_int Function %24
                OpStore %arg_1 %int_1
-         %30 = OpLoad %int %arg_1
-         %28 = OpAtomicAnd %int %arg_0 %uint_2 %uint_0 %30
-               OpStore %res %28
-         %33 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
-         %34 = OpLoad %int %res
-               OpStore %33 %34
+         %35 = OpLoad %int %arg_1
+         %33 = OpAtomicAnd %int %arg_0 %uint_2 %uint_0 %35
+               OpStore %res %33
+         %38 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
+         %39 = OpLoad %int %res
+               OpStore %38 %39
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %37 = OpLabel
-         %38 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %39 = OpFunctionCall %void %atomicAnd_45a819
+         %42 = OpLabel
+         %43 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %44 = OpFunctionCall %void %atomicAnd_45a819
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %41 = OpLabel
-         %43 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %43
+%compute_main = OpFunction %void None %27
+         %46 = OpLabel
+         %48 = OpLoad %uint %local_invocation_index_1
+         %47 = OpFunctionCall %void %compute_main_inner %48
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.dxc.hlsl
index d4f5c16..394c6d9 100644
--- a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.dxc.hlsl
@@ -5,7 +5,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.fxc.hlsl
index d4f5c16..394c6d9 100644
--- a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.fxc.hlsl
@@ -5,7 +5,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.glsl
index c731cec..3425717 100644
--- a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.glsl
@@ -8,7 +8,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.msl
index a55cf6f..a5b4001 100644
--- a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.msl
@@ -13,7 +13,7 @@
 }
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.spvasm
index 6e162ae..136fea4 100644
--- a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 45
+; Bound: 48
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -31,49 +31,55 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %6 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %15 = OpConstantNull %uint
+         %20 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %18 = OpTypeFunction %void
-     %uint_1 = OpConstant %uint 1
+         %23 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
-       %bool = OpTypeBool
 %__atomic_compare_exchange_result_u32 = OpTypeStruct %uint %bool
 %_ptr_Function___atomic_compare_exchange_result_u32 = OpTypePointer Function %__atomic_compare_exchange_result_u32
-         %35 = OpConstantNull %__atomic_compare_exchange_result_u32
+         %38 = OpConstantNull %__atomic_compare_exchange_result_u32
 %tint_zero_workgroup_memory = OpFunction %void None %6
   %local_idx = OpFunctionParameter %uint
          %10 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %15
+         %12 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %14 None
+               OpBranchConditional %12 %15 %14
+         %15 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %20
+               OpBranch %14
+         %14 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicCompareExchangeWeak_83580d = OpFunction %void None %18
-         %20 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_uint Function %15
-      %arg_2 = OpVariable %_ptr_Function_uint Function %15
-        %res = OpVariable %_ptr_Function___atomic_compare_exchange_result_u32 Function %35
+%atomicCompareExchangeWeak_83580d = OpFunction %void None %23
+         %25 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_uint Function %20
+      %arg_2 = OpVariable %_ptr_Function_uint Function %20
+        %res = OpVariable %_ptr_Function___atomic_compare_exchange_result_u32 Function %38
                OpStore %arg_1 %uint_1
                OpStore %arg_2 %uint_1
-         %29 = OpLoad %uint %arg_2
-         %30 = OpLoad %uint %arg_1
-         %31 = OpAtomicCompareExchange %uint %arg_0 %uint_2 %uint_0 %uint_0 %29 %30
-         %32 = OpIEqual %bool %31 %30
-         %25 = OpCompositeConstruct %__atomic_compare_exchange_result_u32 %31 %32
-               OpStore %res %25
+         %32 = OpLoad %uint %arg_2
+         %33 = OpLoad %uint %arg_1
+         %34 = OpAtomicCompareExchange %uint %arg_0 %uint_2 %uint_0 %uint_0 %32 %33
+         %35 = OpIEqual %bool %34 %33
+         %29 = OpCompositeConstruct %__atomic_compare_exchange_result_u32 %34 %35
+               OpStore %res %29
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %6
 %local_invocation_index = OpFunctionParameter %uint
-         %38 = OpLabel
-         %39 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %40 = OpFunctionCall %void %atomicCompareExchangeWeak_83580d
+         %41 = OpLabel
+         %42 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %43 = OpFunctionCall %void %atomicCompareExchangeWeak_83580d
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %18
-         %42 = OpLabel
-         %44 = OpLoad %uint %local_invocation_index_1
-         %43 = OpFunctionCall %void %compute_main_inner %44
+%compute_main = OpFunction %void None %23
+         %45 = OpLabel
+         %47 = OpLoad %uint %local_invocation_index_1
+         %46 = OpFunctionCall %void %compute_main_inner %47
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.dxc.hlsl
index 02ffffd..2164764 100644
--- a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.dxc.hlsl
@@ -5,7 +5,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.fxc.hlsl
index 02ffffd..2164764 100644
--- a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.fxc.hlsl
@@ -5,7 +5,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.glsl
index b9b7646..fcc1cdc 100644
--- a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.glsl
@@ -8,7 +8,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.msl
index a8937e9..f521e69 100644
--- a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.msl
@@ -13,7 +13,7 @@
 }
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.spvasm
index b25c339..6e58297 100644
--- a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 46
+; Bound: 50
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -32,49 +32,56 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
           %7 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %16 = OpConstantNull %int
+         %21 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %19 = OpTypeFunction %void
+         %24 = OpTypeFunction %void
       %int_1 = OpConstant %int 1
 %_ptr_Function_int = OpTypePointer Function %int
-       %bool = OpTypeBool
 %__atomic_compare_exchange_result_i32 = OpTypeStruct %int %bool
 %_ptr_Function___atomic_compare_exchange_result_i32 = OpTypePointer Function %__atomic_compare_exchange_result_i32
-         %36 = OpConstantNull %__atomic_compare_exchange_result_i32
+         %40 = OpConstantNull %__atomic_compare_exchange_result_i32
 %tint_zero_workgroup_memory = OpFunction %void None %7
   %local_idx = OpFunctionParameter %uint
          %11 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %16
+         %13 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %15 None
+               OpBranchConditional %13 %16 %15
+         %16 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %21
+               OpBranch %15
+         %15 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicCompareExchangeWeak_e88938 = OpFunction %void None %19
-         %21 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_int Function %16
-      %arg_2 = OpVariable %_ptr_Function_int Function %16
-        %res = OpVariable %_ptr_Function___atomic_compare_exchange_result_i32 Function %36
+%atomicCompareExchangeWeak_e88938 = OpFunction %void None %24
+         %26 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_int Function %21
+      %arg_2 = OpVariable %_ptr_Function_int Function %21
+        %res = OpVariable %_ptr_Function___atomic_compare_exchange_result_i32 Function %40
                OpStore %arg_1 %int_1
                OpStore %arg_2 %int_1
-         %30 = OpLoad %int %arg_2
-         %31 = OpLoad %int %arg_1
-         %32 = OpAtomicCompareExchange %int %arg_0 %uint_2 %uint_0 %uint_0 %30 %31
-         %33 = OpIEqual %bool %32 %31
-         %26 = OpCompositeConstruct %__atomic_compare_exchange_result_i32 %32 %33
-               OpStore %res %26
+         %34 = OpLoad %int %arg_2
+         %35 = OpLoad %int %arg_1
+         %36 = OpAtomicCompareExchange %int %arg_0 %uint_2 %uint_0 %uint_0 %34 %35
+         %37 = OpIEqual %bool %36 %35
+         %31 = OpCompositeConstruct %__atomic_compare_exchange_result_i32 %36 %37
+               OpStore %res %31
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %7
 %local_invocation_index = OpFunctionParameter %uint
-         %39 = OpLabel
-         %40 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %41 = OpFunctionCall %void %atomicCompareExchangeWeak_e88938
+         %43 = OpLabel
+         %44 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %45 = OpFunctionCall %void %atomicCompareExchangeWeak_e88938
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %19
-         %43 = OpLabel
-         %45 = OpLoad %uint %local_invocation_index_1
-         %44 = OpFunctionCall %void %compute_main_inner %45
+%compute_main = OpFunction %void None %24
+         %47 = OpLabel
+         %49 = OpLoad %uint %local_invocation_index_1
+         %48 = OpFunctionCall %void %compute_main_inner %49
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.dxc.hlsl
index 49fe990..b565e13 100644
--- a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.fxc.hlsl
index 49fe990..b565e13 100644
--- a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.glsl
index 3cd1d4b..9586579 100644
--- a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.msl
index 6222621..e4bf873 100644
--- a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.spvasm
index 7897ffe..a5b8b38 100644
--- a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 43
+; Bound: 47
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -35,44 +35,51 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %18 = OpConstantNull %uint
+         %23 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %void
-     %uint_1 = OpConstant %uint 1
+         %26 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %18
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %23
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicExchange_0a5dca = OpFunction %void None %21
-         %23 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_uint Function %18
-        %res = OpVariable %_ptr_Function_uint Function %18
+%atomicExchange_0a5dca = OpFunction %void None %26
+         %28 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_uint Function %23
+        %res = OpVariable %_ptr_Function_uint Function %23
                OpStore %arg_1 %uint_1
-         %29 = OpLoad %uint %arg_1
-         %27 = OpAtomicExchange %uint %arg_0 %uint_2 %uint_0 %29
-               OpStore %res %27
-         %32 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
-         %33 = OpLoad %uint %res
-               OpStore %32 %33
+         %33 = OpLoad %uint %arg_1
+         %31 = OpAtomicExchange %uint %arg_0 %uint_2 %uint_0 %33
+               OpStore %res %31
+         %36 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
+         %37 = OpLoad %uint %res
+               OpStore %36 %37
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %36 = OpLabel
-         %37 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %38 = OpFunctionCall %void %atomicExchange_0a5dca
+         %40 = OpLabel
+         %41 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %42 = OpFunctionCall %void %atomicExchange_0a5dca
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %21
-         %40 = OpLabel
-         %42 = OpLoad %uint %local_invocation_index_1
-         %41 = OpFunctionCall %void %compute_main_inner %42
+%compute_main = OpFunction %void None %26
+         %44 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.dxc.hlsl
index 1d11f72..5202c7b 100644
--- a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.fxc.hlsl
index 1d11f72..5202c7b 100644
--- a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.glsl
index 0939068..74f54ab 100644
--- a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.msl
index 6083c9d..8739fde 100644
--- a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.spvasm
index 4f91940..5ac7749 100644
--- a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 44
+; Bound: 49
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -36,44 +36,52 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
       %int_1 = OpConstant %int 1
 %_ptr_Function_int = OpTypePointer Function %int
 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicExchange_e114ba = OpFunction %void None %22
-         %24 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_int Function %19
-        %res = OpVariable %_ptr_Function_int Function %19
+%atomicExchange_e114ba = OpFunction %void None %27
+         %29 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_int Function %24
+        %res = OpVariable %_ptr_Function_int Function %24
                OpStore %arg_1 %int_1
-         %30 = OpLoad %int %arg_1
-         %28 = OpAtomicExchange %int %arg_0 %uint_2 %uint_0 %30
-               OpStore %res %28
-         %33 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
-         %34 = OpLoad %int %res
-               OpStore %33 %34
+         %35 = OpLoad %int %arg_1
+         %33 = OpAtomicExchange %int %arg_0 %uint_2 %uint_0 %35
+               OpStore %res %33
+         %38 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
+         %39 = OpLoad %int %res
+               OpStore %38 %39
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %37 = OpLabel
-         %38 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %39 = OpFunctionCall %void %atomicExchange_e114ba
+         %42 = OpLabel
+         %43 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %44 = OpFunctionCall %void %atomicExchange_e114ba
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %41 = OpLabel
-         %43 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %43
+%compute_main = OpFunction %void None %27
+         %46 = OpLabel
+         %48 = OpLoad %uint %local_invocation_index_1
+         %47 = OpFunctionCall %void %compute_main_inner %48
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.dxc.hlsl
index e608399..163be61 100644
--- a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.fxc.hlsl
index e608399..163be61 100644
--- a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.glsl
index a68bfa4..fb09e7f 100644
--- a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.msl
index 6d5d145..a674677 100644
--- a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.spvasm
index d980cb3..0ffd7ee 100644
--- a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 40
+; Bound: 45
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -34,40 +34,48 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %18 = OpConstantNull %uint
+         %23 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %void
+         %26 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %18
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %23
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicLoad_361bf1 = OpFunction %void None %21
-         %23 = OpLabel
-        %res = OpVariable %_ptr_Function_uint Function %18
-         %24 = OpAtomicLoad %uint %arg_0 %uint_2 %uint_0
-               OpStore %res %24
-         %29 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
-         %30 = OpLoad %uint %res
-               OpStore %29 %30
+%atomicLoad_361bf1 = OpFunction %void None %26
+         %28 = OpLabel
+        %res = OpVariable %_ptr_Function_uint Function %23
+         %29 = OpAtomicLoad %uint %arg_0 %uint_2 %uint_0
+               OpStore %res %29
+         %34 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
+         %35 = OpLoad %uint %res
+               OpStore %34 %35
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %33 = OpLabel
-         %34 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %35 = OpFunctionCall %void %atomicLoad_361bf1
+         %38 = OpLabel
+         %39 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %40 = OpFunctionCall %void %atomicLoad_361bf1
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %21
-         %37 = OpLabel
-         %39 = OpLoad %uint %local_invocation_index_1
-         %38 = OpFunctionCall %void %compute_main_inner %39
+%compute_main = OpFunction %void None %26
+         %42 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %43 = OpFunctionCall %void %compute_main_inner %44
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.dxc.hlsl
index c89739f..0975b8b 100644
--- a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.fxc.hlsl
index c89739f..0975b8b 100644
--- a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.glsl
index ea65f03..1bae699 100644
--- a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.msl
index c943946..031ed71 100644
--- a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.spvasm
index d97cf21..09dddcf 100644
--- a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 41
+; Bound: 46
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -35,40 +35,48 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicLoad_afcc03 = OpFunction %void None %22
-         %24 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %19
-         %25 = OpAtomicLoad %int %arg_0 %uint_2 %uint_0
-               OpStore %res %25
-         %30 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
-         %31 = OpLoad %int %res
-               OpStore %30 %31
+%atomicLoad_afcc03 = OpFunction %void None %27
+         %29 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %24
+         %30 = OpAtomicLoad %int %arg_0 %uint_2 %uint_0
+               OpStore %res %30
+         %35 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
+         %36 = OpLoad %int %res
+               OpStore %35 %36
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %34 = OpLabel
-         %35 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %36 = OpFunctionCall %void %atomicLoad_afcc03
+         %39 = OpLabel
+         %40 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %41 = OpFunctionCall %void %atomicLoad_afcc03
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %38 = OpLabel
-         %40 = OpLoad %uint %local_invocation_index_1
-         %39 = OpFunctionCall %void %compute_main_inner %40
+%compute_main = OpFunction %void None %27
+         %43 = OpLabel
+         %45 = OpLoad %uint %local_invocation_index_1
+         %44 = OpFunctionCall %void %compute_main_inner %45
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.dxc.hlsl
index 5dfc188..1fcc5fa 100644
--- a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.fxc.hlsl
index 5dfc188..1fcc5fa 100644
--- a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.glsl
index 2632e95..ac3e7ef 100644
--- a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.msl
index 61e7a26..7698d25 100644
--- a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.spvasm
index 7cbb23b..2e067c4 100644
--- a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 44
+; Bound: 49
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -36,44 +36,52 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
       %int_1 = OpConstant %int 1
 %_ptr_Function_int = OpTypePointer Function %int
 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicMax_a89cc3 = OpFunction %void None %22
-         %24 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_int Function %19
-        %res = OpVariable %_ptr_Function_int Function %19
+%atomicMax_a89cc3 = OpFunction %void None %27
+         %29 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_int Function %24
+        %res = OpVariable %_ptr_Function_int Function %24
                OpStore %arg_1 %int_1
-         %30 = OpLoad %int %arg_1
-         %28 = OpAtomicSMax %int %arg_0 %uint_2 %uint_0 %30
-               OpStore %res %28
-         %33 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
-         %34 = OpLoad %int %res
-               OpStore %33 %34
+         %35 = OpLoad %int %arg_1
+         %33 = OpAtomicSMax %int %arg_0 %uint_2 %uint_0 %35
+               OpStore %res %33
+         %38 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
+         %39 = OpLoad %int %res
+               OpStore %38 %39
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %37 = OpLabel
-         %38 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %39 = OpFunctionCall %void %atomicMax_a89cc3
+         %42 = OpLabel
+         %43 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %44 = OpFunctionCall %void %atomicMax_a89cc3
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %41 = OpLabel
-         %43 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %43
+%compute_main = OpFunction %void None %27
+         %46 = OpLabel
+         %48 = OpLoad %uint %local_invocation_index_1
+         %47 = OpFunctionCall %void %compute_main_inner %48
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.dxc.hlsl
index 35278b4..e0dad3a 100644
--- a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.fxc.hlsl
index 35278b4..e0dad3a 100644
--- a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.glsl
index 6d8db28..850c4d4 100644
--- a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.msl
index 77d499a..4cf9005 100644
--- a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.spvasm
index d21183b..b509d22 100644
--- a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 43
+; Bound: 47
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -35,44 +35,51 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %18 = OpConstantNull %uint
+         %23 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %void
-     %uint_1 = OpConstant %uint 1
+         %26 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %18
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %23
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicMax_beccfc = OpFunction %void None %21
-         %23 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_uint Function %18
-        %res = OpVariable %_ptr_Function_uint Function %18
+%atomicMax_beccfc = OpFunction %void None %26
+         %28 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_uint Function %23
+        %res = OpVariable %_ptr_Function_uint Function %23
                OpStore %arg_1 %uint_1
-         %29 = OpLoad %uint %arg_1
-         %27 = OpAtomicUMax %uint %arg_0 %uint_2 %uint_0 %29
-               OpStore %res %27
-         %32 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
-         %33 = OpLoad %uint %res
-               OpStore %32 %33
+         %33 = OpLoad %uint %arg_1
+         %31 = OpAtomicUMax %uint %arg_0 %uint_2 %uint_0 %33
+               OpStore %res %31
+         %36 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
+         %37 = OpLoad %uint %res
+               OpStore %36 %37
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %36 = OpLabel
-         %37 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %38 = OpFunctionCall %void %atomicMax_beccfc
+         %40 = OpLabel
+         %41 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %42 = OpFunctionCall %void %atomicMax_beccfc
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %21
-         %40 = OpLabel
-         %42 = OpLoad %uint %local_invocation_index_1
-         %41 = OpFunctionCall %void %compute_main_inner %42
+%compute_main = OpFunction %void None %26
+         %44 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.dxc.hlsl
index 77fde5a..f085f17 100644
--- a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.fxc.hlsl
index 77fde5a..f085f17 100644
--- a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.glsl
index fa7357d..1a072c7 100644
--- a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.msl
index d425ecd..5c24414 100644
--- a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.spvasm
index 996308c..8523524 100644
--- a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 44
+; Bound: 49
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -36,44 +36,52 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
       %int_1 = OpConstant %int 1
 %_ptr_Function_int = OpTypePointer Function %int
 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicMin_278235 = OpFunction %void None %22
-         %24 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_int Function %19
-        %res = OpVariable %_ptr_Function_int Function %19
+%atomicMin_278235 = OpFunction %void None %27
+         %29 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_int Function %24
+        %res = OpVariable %_ptr_Function_int Function %24
                OpStore %arg_1 %int_1
-         %30 = OpLoad %int %arg_1
-         %28 = OpAtomicSMin %int %arg_0 %uint_2 %uint_0 %30
-               OpStore %res %28
-         %33 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
-         %34 = OpLoad %int %res
-               OpStore %33 %34
+         %35 = OpLoad %int %arg_1
+         %33 = OpAtomicSMin %int %arg_0 %uint_2 %uint_0 %35
+               OpStore %res %33
+         %38 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
+         %39 = OpLoad %int %res
+               OpStore %38 %39
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %37 = OpLabel
-         %38 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %39 = OpFunctionCall %void %atomicMin_278235
+         %42 = OpLabel
+         %43 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %44 = OpFunctionCall %void %atomicMin_278235
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %41 = OpLabel
-         %43 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %43
+%compute_main = OpFunction %void None %27
+         %46 = OpLabel
+         %48 = OpLoad %uint %local_invocation_index_1
+         %47 = OpFunctionCall %void %compute_main_inner %48
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.dxc.hlsl
index d26cee7..a4ce341 100644
--- a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.fxc.hlsl
index d26cee7..a4ce341 100644
--- a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.glsl
index 2f5092a..3562afa 100644
--- a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.msl
index 6dfd986..072b271 100644
--- a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.spvasm
index b1a454c..e7f405c 100644
--- a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 43
+; Bound: 47
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -35,44 +35,51 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %18 = OpConstantNull %uint
+         %23 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %void
-     %uint_1 = OpConstant %uint 1
+         %26 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %18
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %23
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicMin_69d383 = OpFunction %void None %21
-         %23 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_uint Function %18
-        %res = OpVariable %_ptr_Function_uint Function %18
+%atomicMin_69d383 = OpFunction %void None %26
+         %28 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_uint Function %23
+        %res = OpVariable %_ptr_Function_uint Function %23
                OpStore %arg_1 %uint_1
-         %29 = OpLoad %uint %arg_1
-         %27 = OpAtomicUMin %uint %arg_0 %uint_2 %uint_0 %29
-               OpStore %res %27
-         %32 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
-         %33 = OpLoad %uint %res
-               OpStore %32 %33
+         %33 = OpLoad %uint %arg_1
+         %31 = OpAtomicUMin %uint %arg_0 %uint_2 %uint_0 %33
+               OpStore %res %31
+         %36 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
+         %37 = OpLoad %uint %res
+               OpStore %36 %37
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %36 = OpLabel
-         %37 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %38 = OpFunctionCall %void %atomicMin_69d383
+         %40 = OpLabel
+         %41 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %42 = OpFunctionCall %void %atomicMin_69d383
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %21
-         %40 = OpLabel
-         %42 = OpLoad %uint %local_invocation_index_1
-         %41 = OpFunctionCall %void %compute_main_inner %42
+%compute_main = OpFunction %void None %26
+         %44 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.dxc.hlsl
index 43d750f..65c2b68 100644
--- a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.fxc.hlsl
index 43d750f..65c2b68 100644
--- a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.glsl
index 218b351..6731d8e 100644
--- a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.msl
index b0e2b5b..074873e 100644
--- a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.spvasm
index 49e4c51..ed58118 100644
--- a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 43
+; Bound: 47
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -35,44 +35,51 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %18 = OpConstantNull %uint
+         %23 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %void
-     %uint_1 = OpConstant %uint 1
+         %26 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %18
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %23
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicOr_5e3d61 = OpFunction %void None %21
-         %23 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_uint Function %18
-        %res = OpVariable %_ptr_Function_uint Function %18
+%atomicOr_5e3d61 = OpFunction %void None %26
+         %28 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_uint Function %23
+        %res = OpVariable %_ptr_Function_uint Function %23
                OpStore %arg_1 %uint_1
-         %29 = OpLoad %uint %arg_1
-         %27 = OpAtomicOr %uint %arg_0 %uint_2 %uint_0 %29
-               OpStore %res %27
-         %32 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
-         %33 = OpLoad %uint %res
-               OpStore %32 %33
+         %33 = OpLoad %uint %arg_1
+         %31 = OpAtomicOr %uint %arg_0 %uint_2 %uint_0 %33
+               OpStore %res %31
+         %36 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
+         %37 = OpLoad %uint %res
+               OpStore %36 %37
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %36 = OpLabel
-         %37 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %38 = OpFunctionCall %void %atomicOr_5e3d61
+         %40 = OpLabel
+         %41 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %42 = OpFunctionCall %void %atomicOr_5e3d61
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %21
-         %40 = OpLabel
-         %42 = OpLoad %uint %local_invocation_index_1
-         %41 = OpFunctionCall %void %compute_main_inner %42
+%compute_main = OpFunction %void None %26
+         %44 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.dxc.hlsl
index 82029db..74f4097 100644
--- a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.fxc.hlsl
index 82029db..74f4097 100644
--- a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.glsl
index 5abb825..0523424 100644
--- a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.msl
index 81fcf35..e0bcb69 100644
--- a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.spvasm
index 82821eb..82aa8a6 100644
--- a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 44
+; Bound: 49
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -36,44 +36,52 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
       %int_1 = OpConstant %int 1
 %_ptr_Function_int = OpTypePointer Function %int
 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicOr_d09248 = OpFunction %void None %22
-         %24 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_int Function %19
-        %res = OpVariable %_ptr_Function_int Function %19
+%atomicOr_d09248 = OpFunction %void None %27
+         %29 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_int Function %24
+        %res = OpVariable %_ptr_Function_int Function %24
                OpStore %arg_1 %int_1
-         %30 = OpLoad %int %arg_1
-         %28 = OpAtomicOr %int %arg_0 %uint_2 %uint_0 %30
-               OpStore %res %28
-         %33 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
-         %34 = OpLoad %int %res
-               OpStore %33 %34
+         %35 = OpLoad %int %arg_1
+         %33 = OpAtomicOr %int %arg_0 %uint_2 %uint_0 %35
+               OpStore %res %33
+         %38 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
+         %39 = OpLoad %int %res
+               OpStore %38 %39
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %37 = OpLabel
-         %38 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %39 = OpFunctionCall %void %atomicOr_d09248
+         %42 = OpLabel
+         %43 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %44 = OpFunctionCall %void %atomicOr_d09248
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %41 = OpLabel
-         %43 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %43
+%compute_main = OpFunction %void None %27
+         %46 = OpLabel
+         %48 = OpLoad %uint %local_invocation_index_1
+         %47 = OpFunctionCall %void %compute_main_inner %48
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.dxc.hlsl
index 33b8031..40d728f 100644
--- a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.fxc.hlsl
index 33b8031..40d728f 100644
--- a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.glsl
index 34ef150..969a3b5 100644
--- a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.msl
index aa65d2e..d4251e0 100644
--- a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.spvasm
index 39b3eca..3dd68f9 100644
--- a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 36
+; Bound: 40
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -24,38 +24,45 @@
       %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
        %void = OpTypeVoid
           %6 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %15 = OpConstantNull %uint
+         %20 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %18 = OpTypeFunction %void
-     %uint_1 = OpConstant %uint 1
+         %23 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
 %tint_zero_workgroup_memory = OpFunction %void None %6
   %local_idx = OpFunctionParameter %uint
          %10 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %15
+         %12 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %14 None
+               OpBranchConditional %12 %15 %14
+         %15 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %20
+               OpBranch %14
+         %14 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicStore_726882 = OpFunction %void None %18
-         %20 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_uint Function %15
+%atomicStore_726882 = OpFunction %void None %23
+         %25 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_uint Function %20
                OpStore %arg_1 %uint_1
-         %26 = OpLoad %uint %arg_1
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %26
+         %30 = OpLoad %uint %arg_1
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %30
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %6
 %local_invocation_index = OpFunctionParameter %uint
-         %29 = OpLabel
-         %30 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %31 = OpFunctionCall %void %atomicStore_726882
+         %33 = OpLabel
+         %34 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %35 = OpFunctionCall %void %atomicStore_726882
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %18
-         %33 = OpLabel
-         %35 = OpLoad %uint %local_invocation_index_1
-         %34 = OpFunctionCall %void %compute_main_inner %35
+%compute_main = OpFunction %void None %23
+         %37 = OpLabel
+         %39 = OpLoad %uint %local_invocation_index_1
+         %38 = OpFunctionCall %void %compute_main_inner %39
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.dxc.hlsl
index af925cb..231e2a1 100644
--- a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.fxc.hlsl
index af925cb..231e2a1 100644
--- a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.glsl
index 19661a4..cd69df3 100644
--- a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.msl
index cd4ded6..577e7c0 100644
--- a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.spvasm
index 657b2d7..d0c8e3a 100644
--- a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 37
+; Bound: 42
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -25,38 +25,46 @@
       %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
           %7 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %16 = OpConstantNull %int
+         %21 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %19 = OpTypeFunction %void
+         %24 = OpTypeFunction %void
       %int_1 = OpConstant %int 1
 %_ptr_Function_int = OpTypePointer Function %int
 %tint_zero_workgroup_memory = OpFunction %void None %7
   %local_idx = OpFunctionParameter %uint
          %11 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %16
+         %13 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %15 None
+               OpBranchConditional %13 %16 %15
+         %16 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %21
+               OpBranch %15
+         %15 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicStore_8bea94 = OpFunction %void None %19
-         %21 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_int Function %16
+%atomicStore_8bea94 = OpFunction %void None %24
+         %26 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_int Function %21
                OpStore %arg_1 %int_1
-         %27 = OpLoad %int %arg_1
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %27
+         %32 = OpLoad %int %arg_1
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %32
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %7
 %local_invocation_index = OpFunctionParameter %uint
-         %30 = OpLabel
-         %31 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %32 = OpFunctionCall %void %atomicStore_8bea94
+         %35 = OpLabel
+         %36 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %37 = OpFunctionCall %void %atomicStore_8bea94
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %19
-         %34 = OpLabel
-         %36 = OpLoad %uint %local_invocation_index_1
-         %35 = OpFunctionCall %void %compute_main_inner %36
+%compute_main = OpFunction %void None %24
+         %39 = OpLabel
+         %41 = OpLoad %uint %local_invocation_index_1
+         %40 = OpFunctionCall %void %compute_main_inner %41
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.dxc.hlsl
index 2ed4de0..493401c 100644
--- a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.fxc.hlsl
index 2ed4de0..493401c 100644
--- a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.glsl
index 4f65ecd..988b56f 100644
--- a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.msl
index 6fd45b2..b4ad381 100644
--- a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.spvasm
index 77d5ea7..1ebfd25 100644
--- a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 43
+; Bound: 47
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -35,44 +35,51 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %18 = OpConstantNull %uint
+         %23 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %void
-     %uint_1 = OpConstant %uint 1
+         %26 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %18
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %23
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicSub_0d26c2 = OpFunction %void None %21
-         %23 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_uint Function %18
-        %res = OpVariable %_ptr_Function_uint Function %18
+%atomicSub_0d26c2 = OpFunction %void None %26
+         %28 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_uint Function %23
+        %res = OpVariable %_ptr_Function_uint Function %23
                OpStore %arg_1 %uint_1
-         %29 = OpLoad %uint %arg_1
-         %27 = OpAtomicISub %uint %arg_0 %uint_2 %uint_0 %29
-               OpStore %res %27
-         %32 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
-         %33 = OpLoad %uint %res
-               OpStore %32 %33
+         %33 = OpLoad %uint %arg_1
+         %31 = OpAtomicISub %uint %arg_0 %uint_2 %uint_0 %33
+               OpStore %res %31
+         %36 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
+         %37 = OpLoad %uint %res
+               OpStore %36 %37
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %36 = OpLabel
-         %37 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %38 = OpFunctionCall %void %atomicSub_0d26c2
+         %40 = OpLabel
+         %41 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %42 = OpFunctionCall %void %atomicSub_0d26c2
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %21
-         %40 = OpLabel
-         %42 = OpLoad %uint %local_invocation_index_1
-         %41 = OpFunctionCall %void %compute_main_inner %42
+%compute_main = OpFunction %void None %26
+         %44 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.dxc.hlsl
index 10cbc0d..f1bc756 100644
--- a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.fxc.hlsl
index 10cbc0d..f1bc756 100644
--- a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.glsl
index 60cd496..a7fb878 100644
--- a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.msl
index 7f2a0c5..fde5325 100644
--- a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.spvasm
index 432d51f..067c76e 100644
--- a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 44
+; Bound: 49
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -36,44 +36,52 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
       %int_1 = OpConstant %int 1
 %_ptr_Function_int = OpTypePointer Function %int
 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicSub_77883a = OpFunction %void None %22
-         %24 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_int Function %19
-        %res = OpVariable %_ptr_Function_int Function %19
+%atomicSub_77883a = OpFunction %void None %27
+         %29 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_int Function %24
+        %res = OpVariable %_ptr_Function_int Function %24
                OpStore %arg_1 %int_1
-         %30 = OpLoad %int %arg_1
-         %28 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %30
-               OpStore %res %28
-         %33 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
-         %34 = OpLoad %int %res
-               OpStore %33 %34
+         %35 = OpLoad %int %arg_1
+         %33 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %35
+               OpStore %res %33
+         %38 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
+         %39 = OpLoad %int %res
+               OpStore %38 %39
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %37 = OpLabel
-         %38 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %39 = OpFunctionCall %void %atomicSub_77883a
+         %42 = OpLabel
+         %43 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %44 = OpFunctionCall %void %atomicSub_77883a
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %41 = OpLabel
-         %43 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %43
+%compute_main = OpFunction %void None %27
+         %46 = OpLabel
+         %48 = OpLoad %uint %local_invocation_index_1
+         %47 = OpFunctionCall %void %compute_main_inner %48
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.dxc.hlsl
index 3b8c73e..46f6678 100644
--- a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.fxc.hlsl
index 3b8c73e..46f6678 100644
--- a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     int atomic_result = 0;
     InterlockedExchange(arg_0, 0, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.glsl
index 3fda49a..ffe656a 100644
--- a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0);
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.msl
index cf8e2e3..10d0195 100644
--- a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.spvasm
index 05946c4..53a311d 100644
--- a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 44
+; Bound: 49
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -36,44 +36,52 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %19 = OpConstantNull %int
+         %24 = OpConstantNull %int
    %uint_264 = OpConstant %uint 264
-         %22 = OpTypeFunction %void
+         %27 = OpTypeFunction %void
       %int_1 = OpConstant %int 1
 %_ptr_Function_int = OpTypePointer Function %int
 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %24
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicXor_75dc95 = OpFunction %void None %22
-         %24 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_int Function %19
-        %res = OpVariable %_ptr_Function_int Function %19
+%atomicXor_75dc95 = OpFunction %void None %27
+         %29 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_int Function %24
+        %res = OpVariable %_ptr_Function_int Function %24
                OpStore %arg_1 %int_1
-         %30 = OpLoad %int %arg_1
-         %28 = OpAtomicXor %int %arg_0 %uint_2 %uint_0 %30
-               OpStore %res %28
-         %33 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
-         %34 = OpLoad %int %res
-               OpStore %33 %34
+         %35 = OpLoad %int %arg_1
+         %33 = OpAtomicXor %int %arg_0 %uint_2 %uint_0 %35
+               OpStore %res %33
+         %38 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
+         %39 = OpLoad %int %res
+               OpStore %38 %39
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %37 = OpLabel
-         %38 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %39 = OpFunctionCall %void %atomicXor_75dc95
+         %42 = OpLabel
+         %43 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %44 = OpFunctionCall %void %atomicXor_75dc95
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %22
-         %41 = OpLabel
-         %43 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %43
+%compute_main = OpFunction %void None %27
+         %46 = OpLabel
+         %48 = OpLoad %uint %local_invocation_index_1
+         %47 = OpFunctionCall %void %compute_main_inner %48
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.dxc.hlsl
index 17053fe..836740b 100644
--- a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.fxc.hlsl
index 17053fe..836740b 100644
--- a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     uint atomic_result = 0u;
     InterlockedExchange(arg_0, 0u, atomic_result);
   }
diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.glsl
index a428f9c..ad042b2 100644
--- a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     atomicExchange(arg_0, 0u);
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.msl
index 4847d34..b1efbfc 100644
--- a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup atomic_uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     atomic_store_explicit(tint_symbol, 0u, memory_order_relaxed);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.spvasm
index 4c80e84..48e4cf8 100644
--- a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 43
+; Bound: 47
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -35,44 +35,51 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
      %uint_0 = OpConstant %uint 0
-         %18 = OpConstantNull %uint
+         %23 = OpConstantNull %uint
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %void
-     %uint_1 = OpConstant %uint 1
+         %26 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpAtomicStore %arg_0 %uint_2 %uint_0 %18
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpAtomicStore %arg_0 %uint_2 %uint_0 %23
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%atomicXor_c8e6be = OpFunction %void None %21
-         %23 = OpLabel
-      %arg_1 = OpVariable %_ptr_Function_uint Function %18
-        %res = OpVariable %_ptr_Function_uint Function %18
+%atomicXor_c8e6be = OpFunction %void None %26
+         %28 = OpLabel
+      %arg_1 = OpVariable %_ptr_Function_uint Function %23
+        %res = OpVariable %_ptr_Function_uint Function %23
                OpStore %arg_1 %uint_1
-         %29 = OpLoad %uint %arg_1
-         %27 = OpAtomicXor %uint %arg_0 %uint_2 %uint_0 %29
-               OpStore %res %27
-         %32 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
-         %33 = OpLoad %uint %res
-               OpStore %32 %33
+         %33 = OpLoad %uint %arg_1
+         %31 = OpAtomicXor %uint %arg_0 %uint_2 %uint_0 %33
+               OpStore %res %31
+         %36 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
+         %37 = OpLoad %uint %res
+               OpStore %36 %37
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %36 = OpLabel
-         %37 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %38 = OpFunctionCall %void %atomicXor_c8e6be
+         %40 = OpLabel
+         %41 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %42 = OpFunctionCall %void %atomicXor_c8e6be
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %21
-         %40 = OpLabel
-         %42 = OpLoad %uint %local_invocation_index_1
-         %41 = OpFunctionCall %void %compute_main_inner %42
+%compute_main = OpFunction %void None %26
+         %44 = OpLabel
+         %46 = OpLoad %uint %local_invocation_index_1
+         %45 = OpFunctionCall %void %compute_main_inner %46
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.dxc.hlsl
index e5f174a..8f2a467 100644
--- a/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     arg_0 = 0u;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.fxc.hlsl
index e5f174a..8f2a467 100644
--- a/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared uint arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     arg_0 = 0u;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.glsl b/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.glsl
index 5808d5a..26e3013 100644
--- a/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared uint arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     arg_0 = 0u;
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.msl b/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.msl
index bb40546..ec0012b 100644
--- a/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup uint* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = 0u;
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.spvasm
index 3555fb1..9cb7da0 100644
--- a/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 43
+; Bound: 48
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -35,48 +35,56 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
-         %14 = OpConstantNull %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %19 = OpConstantNull %uint
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %18 = OpTypeFunction %uint
-         %24 = OpTypeFunction %void
+         %23 = OpTypeFunction %uint
+         %29 = OpTypeFunction %void
 %_ptr_Function_uint = OpTypePointer Function %uint
      %uint_0 = OpConstant %uint 0
 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpStore %arg_0 %14
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpStore %arg_0 %19
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%tint_workgroupUniformLoad_arg_0 = OpFunction %uint None %18
-         %20 = OpLabel
+%tint_workgroupUniformLoad_arg_0 = OpFunction %uint None %23
+         %25 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %22 = OpLoad %uint %arg_0
+         %27 = OpLoad %uint %arg_0
                OpControlBarrier %uint_2 %uint_2 %uint_264
-               OpReturnValue %22
+               OpReturnValue %27
                OpFunctionEnd
-%workgroupUniformLoad_37307c = OpFunction %void None %24
-         %26 = OpLabel
-        %res = OpVariable %_ptr_Function_uint Function %14
-         %27 = OpFunctionCall %uint %tint_workgroupUniformLoad_arg_0
-               OpStore %res %27
-         %32 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
-         %33 = OpLoad %uint %res
-               OpStore %32 %33
+%workgroupUniformLoad_37307c = OpFunction %void None %29
+         %31 = OpLabel
+        %res = OpVariable %_ptr_Function_uint Function %19
+         %32 = OpFunctionCall %uint %tint_workgroupUniformLoad_arg_0
+               OpStore %res %32
+         %37 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
+         %38 = OpLoad %uint %res
+               OpStore %37 %38
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %36 = OpLabel
-         %37 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %38 = OpFunctionCall %void %workgroupUniformLoad_37307c
+         %41 = OpLabel
+         %42 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %43 = OpFunctionCall %void %workgroupUniformLoad_37307c
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %24
-         %40 = OpLabel
-         %42 = OpLoad %uint %local_invocation_index_1
-         %41 = OpFunctionCall %void %compute_main_inner %42
+%compute_main = OpFunction %void None %29
+         %45 = OpLabel
+         %47 = OpLoad %uint %local_invocation_index_1
+         %46 = OpFunctionCall %void %compute_main_inner %47
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.dxc.hlsl
index eda928e..d9bb0a1 100644
--- a/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     arg_0 = 0.0f;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.fxc.hlsl
index eda928e..d9bb0a1 100644
--- a/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     arg_0 = 0.0f;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.glsl b/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.glsl
index a08fb8a..776fee2 100644
--- a/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared float arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     arg_0 = 0.0f;
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.msl b/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.msl
index 2bd0d92..216a543 100644
--- a/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = 0.0f;
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.spvasm
index eccd612..a8c918f 100644
--- a/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 44
+; Bound: 49
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -36,48 +36,56 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
-         %15 = OpConstantNull %float
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %20 = OpConstantNull %float
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %19 = OpTypeFunction %float
-         %25 = OpTypeFunction %void
+         %24 = OpTypeFunction %float
+         %30 = OpTypeFunction %void
 %_ptr_Function_float = OpTypePointer Function %float
      %uint_0 = OpConstant %uint 0
 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpStore %arg_0 %15
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpStore %arg_0 %20
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%tint_workgroupUniformLoad_arg_0 = OpFunction %float None %19
-         %21 = OpLabel
+%tint_workgroupUniformLoad_arg_0 = OpFunction %float None %24
+         %26 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %23 = OpLoad %float %arg_0
+         %28 = OpLoad %float %arg_0
                OpControlBarrier %uint_2 %uint_2 %uint_264
-               OpReturnValue %23
+               OpReturnValue %28
                OpFunctionEnd
-%workgroupUniformLoad_7a857c = OpFunction %void None %25
-         %27 = OpLabel
-        %res = OpVariable %_ptr_Function_float Function %15
-         %28 = OpFunctionCall %float %tint_workgroupUniformLoad_arg_0
-               OpStore %res %28
-         %33 = OpAccessChain %_ptr_StorageBuffer_float %prevent_dce %uint_0
-         %34 = OpLoad %float %res
-               OpStore %33 %34
+%workgroupUniformLoad_7a857c = OpFunction %void None %30
+         %32 = OpLabel
+        %res = OpVariable %_ptr_Function_float Function %20
+         %33 = OpFunctionCall %float %tint_workgroupUniformLoad_arg_0
+               OpStore %res %33
+         %38 = OpAccessChain %_ptr_StorageBuffer_float %prevent_dce %uint_0
+         %39 = OpLoad %float %res
+               OpStore %38 %39
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %37 = OpLabel
-         %38 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %39 = OpFunctionCall %void %workgroupUniformLoad_7a857c
+         %42 = OpLabel
+         %43 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %44 = OpFunctionCall %void %workgroupUniformLoad_7a857c
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %25
-         %41 = OpLabel
-         %43 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %43
+%compute_main = OpFunction %void None %30
+         %46 = OpLabel
+         %48 = OpLoad %uint %local_invocation_index_1
+         %47 = OpFunctionCall %void %compute_main_inner %48
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.dxc.hlsl
index 5dcfc3e..2c5c117 100644
--- a/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     arg_0 = 0;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.fxc.hlsl
index 5dcfc3e..2c5c117 100644
--- a/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     arg_0 = 0;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.glsl b/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.glsl
index 9de7f63..709b13f 100644
--- a/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     arg_0 = 0;
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.msl b/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.msl
index e2daece..330157a 100644
--- a/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = 0;
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.spvasm b/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.spvasm
index 4af09a0..83b4371 100644
--- a/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 44
+; Bound: 49
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -36,48 +36,56 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
-         %15 = OpConstantNull %int
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %20 = OpConstantNull %int
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %19 = OpTypeFunction %int
-         %25 = OpTypeFunction %void
+         %24 = OpTypeFunction %int
+         %30 = OpTypeFunction %void
 %_ptr_Function_int = OpTypePointer Function %int
      %uint_0 = OpConstant %uint 0
 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpStore %arg_0 %15
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpStore %arg_0 %20
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%tint_workgroupUniformLoad_arg_0 = OpFunction %int None %19
-         %21 = OpLabel
+%tint_workgroupUniformLoad_arg_0 = OpFunction %int None %24
+         %26 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %23 = OpLoad %int %arg_0
+         %28 = OpLoad %int %arg_0
                OpControlBarrier %uint_2 %uint_2 %uint_264
-               OpReturnValue %23
+               OpReturnValue %28
                OpFunctionEnd
-%workgroupUniformLoad_9d33de = OpFunction %void None %25
-         %27 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %15
-         %28 = OpFunctionCall %int %tint_workgroupUniformLoad_arg_0
-               OpStore %res %28
-         %33 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
-         %34 = OpLoad %int %res
-               OpStore %33 %34
+%workgroupUniformLoad_9d33de = OpFunction %void None %30
+         %32 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %20
+         %33 = OpFunctionCall %int %tint_workgroupUniformLoad_arg_0
+               OpStore %res %33
+         %38 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
+         %39 = OpLoad %int %res
+               OpStore %38 %39
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %37 = OpLabel
-         %38 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %39 = OpFunctionCall %void %workgroupUniformLoad_9d33de
+         %42 = OpLabel
+         %43 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %44 = OpFunctionCall %void %workgroupUniformLoad_9d33de
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %25
-         %41 = OpLabel
-         %43 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %43
+%compute_main = OpFunction %void None %30
+         %46 = OpLabel
+         %48 = OpLoad %uint %local_invocation_index_1
+         %47 = OpFunctionCall %void %compute_main_inner %48
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.dxc.hlsl
index 11c6726..7c77008 100644
--- a/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float16_t arg_0;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     arg_0 = float16_t(0.0h);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.glsl b/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.glsl
index 9f4ef5e..32e1b5d 100644
--- a/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.glsl
@@ -3,7 +3,7 @@
 
 shared float16_t arg_0;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     arg_0 = 0.0hf;
   }
   barrier();
diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.msl b/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.msl
index 9f16611..cde3a1d 100644
--- a/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup half* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = 0.0h;
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.spvasm b/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.spvasm
index e72386f..912bff3 100644
--- a/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 44
+; Bound: 49
 ; Schema: 0
                OpCapability Shader
                OpCapability Float16
@@ -39,48 +39,56 @@
 %prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
-         %15 = OpConstantNull %half
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %20 = OpConstantNull %half
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %19 = OpTypeFunction %half
-         %25 = OpTypeFunction %void
+         %24 = OpTypeFunction %half
+         %30 = OpTypeFunction %void
 %_ptr_Function_half = OpTypePointer Function %half
      %uint_0 = OpConstant %uint 0
 %_ptr_StorageBuffer_half = OpTypePointer StorageBuffer %half
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
-               OpStore %arg_0 %15
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
+               OpStore %arg_0 %20
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-%tint_workgroupUniformLoad_arg_0 = OpFunction %half None %19
-         %21 = OpLabel
+%tint_workgroupUniformLoad_arg_0 = OpFunction %half None %24
+         %26 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
-         %23 = OpLoad %half %arg_0
+         %28 = OpLoad %half %arg_0
                OpControlBarrier %uint_2 %uint_2 %uint_264
-               OpReturnValue %23
+               OpReturnValue %28
                OpFunctionEnd
-%workgroupUniformLoad_e07d08 = OpFunction %void None %25
-         %27 = OpLabel
-        %res = OpVariable %_ptr_Function_half Function %15
-         %28 = OpFunctionCall %half %tint_workgroupUniformLoad_arg_0
-               OpStore %res %28
-         %33 = OpAccessChain %_ptr_StorageBuffer_half %prevent_dce %uint_0
-         %34 = OpLoad %half %res
-               OpStore %33 %34
+%workgroupUniformLoad_e07d08 = OpFunction %void None %30
+         %32 = OpLabel
+        %res = OpVariable %_ptr_Function_half Function %20
+         %33 = OpFunctionCall %half %tint_workgroupUniformLoad_arg_0
+               OpStore %res %33
+         %38 = OpAccessChain %_ptr_StorageBuffer_half %prevent_dce %uint_0
+         %39 = OpLoad %half %res
+               OpStore %38 %39
                OpReturn
                OpFunctionEnd
 %compute_main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %37 = OpLabel
-         %38 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %39 = OpFunctionCall %void %workgroupUniformLoad_e07d08
+         %42 = OpLabel
+         %43 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %44 = OpFunctionCall %void %workgroupUniformLoad_e07d08
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %25
-         %41 = OpLabel
-         %43 = OpLoad %uint %local_invocation_index_1
-         %42 = OpFunctionCall %void %compute_main_inner %43
+%compute_main = OpFunction %void None %30
+         %46 = OpLabel
+         %48 = OpLoad %uint %local_invocation_index_1
+         %47 = OpFunctionCall %void %compute_main_inner %48
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.dxc.hlsl
index e1120a7..4c5de49 100644
--- a/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.dxc.hlsl
+++ b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int i;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     i = 0;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.fxc.hlsl
index e1120a7..4c5de49 100644
--- a/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.fxc.hlsl
+++ b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int i;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     i = 0;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.glsl b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.glsl
index 1be2d8b..88dff26 100644
--- a/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.glsl
+++ b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int i;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     i = 0;
   }
   barrier();
diff --git a/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.msl b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.msl
index a09a9a6..4f4caf8 100644
--- a/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.msl
+++ b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup int* const tint_symbol_1) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol_1) = 0;
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.spvasm b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.spvasm
index 7b352f7..5db10ce 100644
--- a/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.spvasm
+++ b/test/tint/ptr_ref/load/local/ptr_workgroup.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 29
+; Bound: 34
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -23,31 +23,39 @@
           %i = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
           %7 = OpTypeFunction %void %uint
-         %12 = OpConstantNull %int
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %17 = OpConstantNull %int
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
     %int_123 = OpConstant %int 123
       %int_1 = OpConstant %int 1
-         %24 = OpTypeFunction %void
+         %29 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %7
   %local_idx = OpFunctionParameter %uint
          %11 = OpLabel
-               OpStore %i %12
+         %13 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %15 None
+               OpBranchConditional %13 %16 %15
+         %16 = OpLabel
+               OpStore %i %17
+               OpBranch %15
+         %15 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
  %main_inner = OpFunction %void None %7
 %local_invocation_index = OpFunctionParameter %uint
-         %18 = OpLabel
-         %19 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %23 = OpLabel
+         %24 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
                OpStore %i %int_123
-         %21 = OpLoad %int %i
-         %23 = OpIAdd %int %21 %int_1
+         %26 = OpLoad %int %i
+         %28 = OpIAdd %int %26 %int_1
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %24
-         %26 = OpLabel
-         %28 = OpLoad %uint %local_invocation_index_1
-         %27 = OpFunctionCall %void %main_inner %28
+       %main = OpFunction %void None %29
+         %31 = OpLabel
+         %33 = OpLoad %uint %local_invocation_index_1
+         %32 = OpFunctionCall %void %main_inner %33
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/ptr_ref/load/param/workgroup/i32.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/load/param/workgroup/i32.wgsl.expected.dxc.hlsl
index b581764..8ce73eb 100644
--- a/test/tint/ptr_ref/load/param/workgroup/i32.wgsl.expected.dxc.hlsl
+++ b/test/tint/ptr_ref/load/param/workgroup/i32.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = 0;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/ptr_ref/load/param/workgroup/i32.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/load/param/workgroup/i32.wgsl.expected.fxc.hlsl
index b581764..8ce73eb 100644
--- a/test/tint/ptr_ref/load/param/workgroup/i32.wgsl.expected.fxc.hlsl
+++ b/test/tint/ptr_ref/load/param/workgroup/i32.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = 0;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/ptr_ref/load/param/workgroup/i32.wgsl.expected.glsl b/test/tint/ptr_ref/load/param/workgroup/i32.wgsl.expected.glsl
index 66fd5ad..61f38d0 100644
--- a/test/tint/ptr_ref/load/param/workgroup/i32.wgsl.expected.glsl
+++ b/test/tint/ptr_ref/load/param/workgroup/i32.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int S;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = 0;
   }
   barrier();
diff --git a/test/tint/ptr_ref/load/param/workgroup/i32.wgsl.expected.msl b/test/tint/ptr_ref/load/param/workgroup/i32.wgsl.expected.msl
index 6d50bbd..6f91f64 100644
--- a/test/tint/ptr_ref/load/param/workgroup/i32.wgsl.expected.msl
+++ b/test/tint/ptr_ref/load/param/workgroup/i32.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup int* const tint_symbol_1) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol_1) = 0;
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/ptr_ref/load/param/workgroup/i32.wgsl.expected.spvasm b/test/tint/ptr_ref/load/param/workgroup/i32.wgsl.expected.spvasm
index 25f57ba..b74dcdf 100644
--- a/test/tint/ptr_ref/load/param/workgroup/i32.wgsl.expected.spvasm
+++ b/test/tint/ptr_ref/load/param/workgroup/i32.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 30
+; Bound: 35
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -24,33 +24,41 @@
           %S = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
           %7 = OpTypeFunction %void %uint
-         %12 = OpConstantNull %int
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %17 = OpConstantNull %int
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %16 = OpTypeFunction %int
-         %25 = OpTypeFunction %void
+         %21 = OpTypeFunction %int
+         %30 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %7
   %local_idx = OpFunctionParameter %uint
          %11 = OpLabel
-               OpStore %S %12
+         %13 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %15 None
+               OpBranchConditional %13 %16 %15
+         %16 = OpLabel
+               OpStore %S %17
+               OpBranch %15
+         %15 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-     %func_S = OpFunction %int None %16
-         %18 = OpLabel
-         %19 = OpLoad %int %S
-               OpReturnValue %19
+     %func_S = OpFunction %int None %21
+         %23 = OpLabel
+         %24 = OpLoad %int %S
+               OpReturnValue %24
                OpFunctionEnd
  %main_inner = OpFunction %void None %7
 %local_invocation_index = OpFunctionParameter %uint
-         %22 = OpLabel
-         %23 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %24 = OpFunctionCall %int %func_S
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %29 = OpFunctionCall %int %func_S
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %25
-         %27 = OpLabel
-         %29 = OpLoad %uint %local_invocation_index_1
-         %28 = OpFunctionCall %void %main_inner %29
+       %main = OpFunction %void None %30
+         %32 = OpLabel
+         %34 = OpLoad %uint %local_invocation_index_1
+         %33 = OpFunctionCall %void %main_inner %34
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/ptr_ref/load/param/workgroup/i32_in_struct.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/load/param/workgroup/i32_in_struct.wgsl.expected.dxc.hlsl
index b1faf09..798e60c 100644
--- a/test/tint/ptr_ref/load/param/workgroup/i32_in_struct.wgsl.expected.dxc.hlsl
+++ b/test/tint/ptr_ref/load/param/workgroup/i32_in_struct.wgsl.expected.dxc.hlsl
@@ -5,7 +5,7 @@
 groupshared str S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     str tint_symbol_2 = (str)0;
     S = tint_symbol_2;
   }
diff --git a/test/tint/ptr_ref/load/param/workgroup/i32_in_struct.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/load/param/workgroup/i32_in_struct.wgsl.expected.fxc.hlsl
index b1faf09..798e60c 100644
--- a/test/tint/ptr_ref/load/param/workgroup/i32_in_struct.wgsl.expected.fxc.hlsl
+++ b/test/tint/ptr_ref/load/param/workgroup/i32_in_struct.wgsl.expected.fxc.hlsl
@@ -5,7 +5,7 @@
 groupshared str S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     str tint_symbol_2 = (str)0;
     S = tint_symbol_2;
   }
diff --git a/test/tint/ptr_ref/load/param/workgroup/i32_in_struct.wgsl.expected.glsl b/test/tint/ptr_ref/load/param/workgroup/i32_in_struct.wgsl.expected.glsl
index fef574e..e87a8b9 100644
--- a/test/tint/ptr_ref/load/param/workgroup/i32_in_struct.wgsl.expected.glsl
+++ b/test/tint/ptr_ref/load/param/workgroup/i32_in_struct.wgsl.expected.glsl
@@ -6,7 +6,7 @@
 
 shared str S;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     str tint_symbol_1 = str(0);
     S = tint_symbol_1;
   }
diff --git a/test/tint/ptr_ref/load/param/workgroup/i32_in_struct.wgsl.expected.msl b/test/tint/ptr_ref/load/param/workgroup/i32_in_struct.wgsl.expected.msl
index c602af7..9f3be99 100644
--- a/test/tint/ptr_ref/load/param/workgroup/i32_in_struct.wgsl.expected.msl
+++ b/test/tint/ptr_ref/load/param/workgroup/i32_in_struct.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup str* const tint_symbol_2) {
-  {
+  if ((local_idx < 1u)) {
     str const tint_symbol_1 = str{};
     *(tint_symbol_2) = tint_symbol_1;
   }
diff --git a/test/tint/ptr_ref/load/param/workgroup/i32_in_struct.wgsl.expected.spvasm b/test/tint/ptr_ref/load/param/workgroup/i32_in_struct.wgsl.expected.spvasm
index f6cc01b..f08514e 100644
--- a/test/tint/ptr_ref/load/param/workgroup/i32_in_struct.wgsl.expected.spvasm
+++ b/test/tint/ptr_ref/load/param/workgroup/i32_in_struct.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 34
+; Bound: 39
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -28,36 +28,44 @@
           %S = OpVariable %_ptr_Workgroup_str Workgroup
        %void = OpTypeVoid
           %8 = OpTypeFunction %void %uint
-         %13 = OpConstantNull %str
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %18 = OpConstantNull %str
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %17 = OpTypeFunction %int
+         %22 = OpTypeFunction %int
      %uint_0 = OpConstant %uint 0
 %_ptr_Workgroup_int = OpTypePointer Workgroup %int
-         %29 = OpTypeFunction %void
+         %34 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %8
   %local_idx = OpFunctionParameter %uint
          %12 = OpLabel
-               OpStore %S %13
+         %14 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %16 None
+               OpBranchConditional %14 %17 %16
+         %17 = OpLabel
+               OpStore %S %18
+               OpBranch %16
+         %16 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-   %func_S_i = OpFunction %int None %17
-         %19 = OpLabel
-         %22 = OpAccessChain %_ptr_Workgroup_int %S %uint_0
-         %23 = OpLoad %int %22
-               OpReturnValue %23
+   %func_S_i = OpFunction %int None %22
+         %24 = OpLabel
+         %27 = OpAccessChain %_ptr_Workgroup_int %S %uint_0
+         %28 = OpLoad %int %27
+               OpReturnValue %28
                OpFunctionEnd
  %main_inner = OpFunction %void None %8
 %local_invocation_index = OpFunctionParameter %uint
-         %26 = OpLabel
-         %27 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %28 = OpFunctionCall %int %func_S_i
+         %31 = OpLabel
+         %32 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %33 = OpFunctionCall %int %func_S_i
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %29
-         %31 = OpLabel
-         %33 = OpLoad %uint %local_invocation_index_1
-         %32 = OpFunctionCall %void %main_inner %33
+       %main = OpFunction %void None %34
+         %36 = OpLabel
+         %38 = OpLoad %uint %local_invocation_index_1
+         %37 = OpFunctionCall %void %main_inner %38
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/ptr_ref/load/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/load/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.dxc.hlsl
index ab51c8863..f05c134 100644
--- a/test/tint/ptr_ref/load/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.dxc.hlsl
+++ b/test/tint/ptr_ref/load/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float2x2 S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = float2x2((0.0f).xx, (0.0f).xx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/ptr_ref/load/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/load/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.fxc.hlsl
index ab51c8863..f05c134 100644
--- a/test/tint/ptr_ref/load/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.fxc.hlsl
+++ b/test/tint/ptr_ref/load/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float2x2 S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = float2x2((0.0f).xx, (0.0f).xx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/ptr_ref/load/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.glsl b/test/tint/ptr_ref/load/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.glsl
index 9c0bd23..93f5bc8 100644
--- a/test/tint/ptr_ref/load/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.glsl
+++ b/test/tint/ptr_ref/load/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared mat2 S;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = mat2(vec2(0.0f), vec2(0.0f));
   }
   barrier();
diff --git a/test/tint/ptr_ref/load/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.msl b/test/tint/ptr_ref/load/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.msl
index 68817c2..7a56bbc 100644
--- a/test/tint/ptr_ref/load/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.msl
+++ b/test/tint/ptr_ref/load/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float2x2* const tint_symbol_1) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol_1) = float2x2(float2(0.0f), float2(0.0f));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/ptr_ref/load/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.spvasm b/test/tint/ptr_ref/load/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.spvasm
index 7125afd..719b833 100644
--- a/test/tint/ptr_ref/load/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.spvasm
+++ b/test/tint/ptr_ref/load/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 41
+; Bound: 45
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -28,42 +28,49 @@
           %S = OpVariable %_ptr_Workgroup_mat2v2float Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
-         %14 = OpConstantNull %mat2v2float
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %19 = OpConstantNull %mat2v2float
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-     %uint_1 = OpConstant %uint 1
 %_arr_uint_uint_1 = OpTypeArray %uint %uint_1
-         %18 = OpTypeFunction %v2float %_arr_uint_uint_1
+         %23 = OpTypeFunction %v2float %_arr_uint_uint_1
         %int = OpTypeInt 32 1
-         %25 = OpConstantNull %int
+         %29 = OpConstantNull %int
 %_ptr_Workgroup_v2float = OpTypePointer Workgroup %v2float
-         %35 = OpConstantComposite %_arr_uint_uint_1 %uint_1
-         %36 = OpTypeFunction %void
+         %39 = OpConstantComposite %_arr_uint_uint_1 %uint_1
+         %40 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpStore %S %14
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpStore %S %19
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-   %func_S_X = OpFunction %v2float None %18
+   %func_S_X = OpFunction %v2float None %23
     %pointer = OpFunctionParameter %_arr_uint_uint_1
-         %23 = OpLabel
-         %26 = OpCompositeExtract %uint %pointer 0
-         %28 = OpAccessChain %_ptr_Workgroup_v2float %S %26
-         %29 = OpLoad %v2float %28
-               OpReturnValue %29
+         %27 = OpLabel
+         %30 = OpCompositeExtract %uint %pointer 0
+         %32 = OpAccessChain %_ptr_Workgroup_v2float %S %30
+         %33 = OpLoad %v2float %32
+               OpReturnValue %33
                OpFunctionEnd
  %main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %32 = OpLabel
-         %33 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %34 = OpFunctionCall %v2float %func_S_X %35
+         %36 = OpLabel
+         %37 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %38 = OpFunctionCall %v2float %func_S_X %39
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %36
-         %38 = OpLabel
-         %40 = OpLoad %uint %local_invocation_index_1
-         %39 = OpFunctionCall %void %main_inner %40
+       %main = OpFunction %void None %40
+         %42 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %43 = OpFunctionCall %void %main_inner %44
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/ptr_ref/load/param/workgroup/vec4_f32.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/load/param/workgroup/vec4_f32.wgsl.expected.dxc.hlsl
index 7214eab..5696a58 100644
--- a/test/tint/ptr_ref/load/param/workgroup/vec4_f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/ptr_ref/load/param/workgroup/vec4_f32.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float4 S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = (0.0f).xxxx;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/ptr_ref/load/param/workgroup/vec4_f32.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/load/param/workgroup/vec4_f32.wgsl.expected.fxc.hlsl
index 7214eab..5696a58 100644
--- a/test/tint/ptr_ref/load/param/workgroup/vec4_f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/ptr_ref/load/param/workgroup/vec4_f32.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float4 S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = (0.0f).xxxx;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/ptr_ref/load/param/workgroup/vec4_f32.wgsl.expected.glsl b/test/tint/ptr_ref/load/param/workgroup/vec4_f32.wgsl.expected.glsl
index 7dc1984..fa0f14c 100644
--- a/test/tint/ptr_ref/load/param/workgroup/vec4_f32.wgsl.expected.glsl
+++ b/test/tint/ptr_ref/load/param/workgroup/vec4_f32.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared vec4 S;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = vec4(0.0f);
   }
   barrier();
diff --git a/test/tint/ptr_ref/load/param/workgroup/vec4_f32.wgsl.expected.msl b/test/tint/ptr_ref/load/param/workgroup/vec4_f32.wgsl.expected.msl
index 989b8c1..64a47ae 100644
--- a/test/tint/ptr_ref/load/param/workgroup/vec4_f32.wgsl.expected.msl
+++ b/test/tint/ptr_ref/load/param/workgroup/vec4_f32.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float4* const tint_symbol_1) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol_1) = float4(0.0f);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/ptr_ref/load/param/workgroup/vec4_f32.wgsl.expected.spvasm b/test/tint/ptr_ref/load/param/workgroup/vec4_f32.wgsl.expected.spvasm
index 9458c04..337b173 100644
--- a/test/tint/ptr_ref/load/param/workgroup/vec4_f32.wgsl.expected.spvasm
+++ b/test/tint/ptr_ref/load/param/workgroup/vec4_f32.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 31
+; Bound: 36
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -25,33 +25,41 @@
           %S = OpVariable %_ptr_Workgroup_v4float Workgroup
        %void = OpTypeVoid
           %8 = OpTypeFunction %void %uint
-         %13 = OpConstantNull %v4float
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %18 = OpConstantNull %v4float
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %17 = OpTypeFunction %v4float
-         %26 = OpTypeFunction %void
+         %22 = OpTypeFunction %v4float
+         %31 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %8
   %local_idx = OpFunctionParameter %uint
          %12 = OpLabel
-               OpStore %S %13
+         %14 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %16 None
+               OpBranchConditional %14 %17 %16
+         %17 = OpLabel
+               OpStore %S %18
+               OpBranch %16
+         %16 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-     %func_S = OpFunction %v4float None %17
-         %19 = OpLabel
-         %20 = OpLoad %v4float %S
-               OpReturnValue %20
+     %func_S = OpFunction %v4float None %22
+         %24 = OpLabel
+         %25 = OpLoad %v4float %S
+               OpReturnValue %25
                OpFunctionEnd
  %main_inner = OpFunction %void None %8
 %local_invocation_index = OpFunctionParameter %uint
-         %23 = OpLabel
-         %24 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %25 = OpFunctionCall %v4float %func_S
+         %28 = OpLabel
+         %29 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %30 = OpFunctionCall %v4float %func_S
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %26
-         %28 = OpLabel
-         %30 = OpLoad %uint %local_invocation_index_1
-         %29 = OpFunctionCall %void %main_inner %30
+       %main = OpFunction %void None %31
+         %33 = OpLabel
+         %35 = OpLoad %uint %local_invocation_index_1
+         %34 = OpFunctionCall %void %main_inner %35
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.dxc.hlsl
index c1280c2..7e48abb 100644
--- a/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.dxc.hlsl
+++ b/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float2x4 S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = float2x4((0.0f).xxxx, (0.0f).xxxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.fxc.hlsl
index c1280c2..7e48abb 100644
--- a/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.fxc.hlsl
+++ b/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float2x4 S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = float2x4((0.0f).xxxx, (0.0f).xxxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.glsl b/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.glsl
index 367dfff..d308c97 100644
--- a/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.glsl
+++ b/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared mat2x4 S;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = mat2x4(vec4(0.0f), vec4(0.0f));
   }
   barrier();
diff --git a/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.msl b/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.msl
index f1c6242..1d5f314 100644
--- a/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.msl
+++ b/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float2x4* const tint_symbol_1) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol_1) = float2x4(float4(0.0f), float4(0.0f));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.spvasm b/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.spvasm
index 7185c1b..b59bfa3 100644
--- a/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.spvasm
+++ b/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 41
+; Bound: 45
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -28,42 +28,49 @@
           %S = OpVariable %_ptr_Workgroup_mat2v4float Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
-         %14 = OpConstantNull %mat2v4float
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %19 = OpConstantNull %mat2v4float
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-     %uint_1 = OpConstant %uint 1
 %_arr_uint_uint_1 = OpTypeArray %uint %uint_1
-         %18 = OpTypeFunction %v4float %_arr_uint_uint_1
+         %23 = OpTypeFunction %v4float %_arr_uint_uint_1
         %int = OpTypeInt 32 1
-         %25 = OpConstantNull %int
+         %29 = OpConstantNull %int
 %_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float
-         %35 = OpConstantComposite %_arr_uint_uint_1 %uint_1
-         %36 = OpTypeFunction %void
+         %39 = OpConstantComposite %_arr_uint_uint_1 %uint_1
+         %40 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpStore %S %14
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpStore %S %19
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-   %func_S_X = OpFunction %v4float None %18
+   %func_S_X = OpFunction %v4float None %23
     %pointer = OpFunctionParameter %_arr_uint_uint_1
-         %23 = OpLabel
-         %26 = OpCompositeExtract %uint %pointer 0
-         %28 = OpAccessChain %_ptr_Workgroup_v4float %S %26
-         %29 = OpLoad %v4float %28
-               OpReturnValue %29
+         %27 = OpLabel
+         %30 = OpCompositeExtract %uint %pointer 0
+         %32 = OpAccessChain %_ptr_Workgroup_v4float %S %30
+         %33 = OpLoad %v4float %32
+               OpReturnValue %33
                OpFunctionEnd
  %main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %32 = OpLabel
-         %33 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %34 = OpFunctionCall %v4float %func_S_X %35
+         %36 = OpLabel
+         %37 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %38 = OpFunctionCall %v4float %func_S_X %39
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %36
-         %38 = OpLabel
-         %40 = OpLoad %uint %local_invocation_index_1
-         %39 = OpFunctionCall %void %main_inner %40
+       %main = OpFunction %void None %40
+         %42 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %43 = OpFunctionCall %void %main_inner %44
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_struct.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_struct.wgsl.expected.dxc.hlsl
index 92459e2..857ff46 100644
--- a/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_struct.wgsl.expected.dxc.hlsl
+++ b/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_struct.wgsl.expected.dxc.hlsl
@@ -5,7 +5,7 @@
 groupshared str S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     str tint_symbol_2 = (str)0;
     S = tint_symbol_2;
   }
diff --git a/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_struct.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_struct.wgsl.expected.fxc.hlsl
index 92459e2..857ff46 100644
--- a/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_struct.wgsl.expected.fxc.hlsl
+++ b/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_struct.wgsl.expected.fxc.hlsl
@@ -5,7 +5,7 @@
 groupshared str S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     str tint_symbol_2 = (str)0;
     S = tint_symbol_2;
   }
diff --git a/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_struct.wgsl.expected.glsl b/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_struct.wgsl.expected.glsl
index 2fc4367..8f0a5d4 100644
--- a/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_struct.wgsl.expected.glsl
+++ b/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_struct.wgsl.expected.glsl
@@ -6,7 +6,7 @@
 
 shared str S;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     str tint_symbol_1 = str(vec4(0.0f));
     S = tint_symbol_1;
   }
diff --git a/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_struct.wgsl.expected.msl b/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_struct.wgsl.expected.msl
index b20b54c..1ffdf08 100644
--- a/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_struct.wgsl.expected.msl
+++ b/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_struct.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup str* const tint_symbol_2) {
-  {
+  if ((local_idx < 1u)) {
     str const tint_symbol_1 = str{};
     *(tint_symbol_2) = tint_symbol_1;
   }
diff --git a/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_struct.wgsl.expected.spvasm b/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_struct.wgsl.expected.spvasm
index 516c63b..6b881a0 100644
--- a/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_struct.wgsl.expected.spvasm
+++ b/test/tint/ptr_ref/load/param/workgroup/vec4_f32_in_struct.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 35
+; Bound: 40
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -29,36 +29,44 @@
           %S = OpVariable %_ptr_Workgroup_str Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
-         %14 = OpConstantNull %str
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %19 = OpConstantNull %str
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %18 = OpTypeFunction %v4float
+         %23 = OpTypeFunction %v4float
      %uint_0 = OpConstant %uint 0
 %_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float
-         %30 = OpTypeFunction %void
+         %35 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpStore %S %14
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpStore %S %19
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-   %func_S_i = OpFunction %v4float None %18
-         %20 = OpLabel
-         %23 = OpAccessChain %_ptr_Workgroup_v4float %S %uint_0
-         %24 = OpLoad %v4float %23
-               OpReturnValue %24
+   %func_S_i = OpFunction %v4float None %23
+         %25 = OpLabel
+         %28 = OpAccessChain %_ptr_Workgroup_v4float %S %uint_0
+         %29 = OpLoad %v4float %28
+               OpReturnValue %29
                OpFunctionEnd
  %main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %27 = OpLabel
-         %28 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %29 = OpFunctionCall %v4float %func_S_i
+         %32 = OpLabel
+         %33 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %34 = OpFunctionCall %v4float %func_S_i
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %30
-         %32 = OpLabel
-         %34 = OpLoad %uint %local_invocation_index_1
-         %33 = OpFunctionCall %void %main_inner %34
+       %main = OpFunction %void None %35
+         %37 = OpLabel
+         %39 = OpLoad %uint %local_invocation_index_1
+         %38 = OpFunctionCall %void %main_inner %39
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/ptr_ref/store/param/workgroup/i32.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/store/param/workgroup/i32.wgsl.expected.dxc.hlsl
index 341d5a4..015dc14 100644
--- a/test/tint/ptr_ref/store/param/workgroup/i32.wgsl.expected.dxc.hlsl
+++ b/test/tint/ptr_ref/store/param/workgroup/i32.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = 0;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/ptr_ref/store/param/workgroup/i32.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/store/param/workgroup/i32.wgsl.expected.fxc.hlsl
index 341d5a4..015dc14 100644
--- a/test/tint/ptr_ref/store/param/workgroup/i32.wgsl.expected.fxc.hlsl
+++ b/test/tint/ptr_ref/store/param/workgroup/i32.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = 0;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/ptr_ref/store/param/workgroup/i32.wgsl.expected.glsl b/test/tint/ptr_ref/store/param/workgroup/i32.wgsl.expected.glsl
index 461f5bf..e04541b 100644
--- a/test/tint/ptr_ref/store/param/workgroup/i32.wgsl.expected.glsl
+++ b/test/tint/ptr_ref/store/param/workgroup/i32.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int S;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = 0;
   }
   barrier();
diff --git a/test/tint/ptr_ref/store/param/workgroup/i32.wgsl.expected.msl b/test/tint/ptr_ref/store/param/workgroup/i32.wgsl.expected.msl
index a5479b1..441877c 100644
--- a/test/tint/ptr_ref/store/param/workgroup/i32.wgsl.expected.msl
+++ b/test/tint/ptr_ref/store/param/workgroup/i32.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup int* const tint_symbol_1) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol_1) = 0;
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/ptr_ref/store/param/workgroup/i32.wgsl.expected.spvasm b/test/tint/ptr_ref/store/param/workgroup/i32.wgsl.expected.spvasm
index cd83ba7..e45b626 100644
--- a/test/tint/ptr_ref/store/param/workgroup/i32.wgsl.expected.spvasm
+++ b/test/tint/ptr_ref/store/param/workgroup/i32.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 29
+; Bound: 34
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -24,33 +24,41 @@
           %S = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
           %7 = OpTypeFunction %void %uint
-         %12 = OpConstantNull %int
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %17 = OpConstantNull %int
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %16 = OpTypeFunction %void
+         %21 = OpTypeFunction %void
      %int_42 = OpConstant %int 42
 %tint_zero_workgroup_memory = OpFunction %void None %7
   %local_idx = OpFunctionParameter %uint
          %11 = OpLabel
-               OpStore %S %12
+         %13 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %15 None
+               OpBranchConditional %13 %16 %15
+         %16 = OpLabel
+               OpStore %S %17
+               OpBranch %15
+         %15 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-     %func_S = OpFunction %void None %16
-         %18 = OpLabel
+     %func_S = OpFunction %void None %21
+         %23 = OpLabel
                OpStore %S %int_42
                OpReturn
                OpFunctionEnd
  %main_inner = OpFunction %void None %7
 %local_invocation_index = OpFunctionParameter %uint
-         %22 = OpLabel
-         %23 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %24 = OpFunctionCall %void %func_S
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %29 = OpFunctionCall %void %func_S
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %16
-         %26 = OpLabel
-         %28 = OpLoad %uint %local_invocation_index_1
-         %27 = OpFunctionCall %void %main_inner %28
+       %main = OpFunction %void None %21
+         %31 = OpLabel
+         %33 = OpLoad %uint %local_invocation_index_1
+         %32 = OpFunctionCall %void %main_inner %33
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/ptr_ref/store/param/workgroup/i32_in_struct.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/store/param/workgroup/i32_in_struct.wgsl.expected.dxc.hlsl
index e298f35..27c1b72 100644
--- a/test/tint/ptr_ref/store/param/workgroup/i32_in_struct.wgsl.expected.dxc.hlsl
+++ b/test/tint/ptr_ref/store/param/workgroup/i32_in_struct.wgsl.expected.dxc.hlsl
@@ -5,7 +5,7 @@
 groupshared str S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     str tint_symbol_2 = (str)0;
     S = tint_symbol_2;
   }
diff --git a/test/tint/ptr_ref/store/param/workgroup/i32_in_struct.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/store/param/workgroup/i32_in_struct.wgsl.expected.fxc.hlsl
index e298f35..27c1b72 100644
--- a/test/tint/ptr_ref/store/param/workgroup/i32_in_struct.wgsl.expected.fxc.hlsl
+++ b/test/tint/ptr_ref/store/param/workgroup/i32_in_struct.wgsl.expected.fxc.hlsl
@@ -5,7 +5,7 @@
 groupshared str S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     str tint_symbol_2 = (str)0;
     S = tint_symbol_2;
   }
diff --git a/test/tint/ptr_ref/store/param/workgroup/i32_in_struct.wgsl.expected.glsl b/test/tint/ptr_ref/store/param/workgroup/i32_in_struct.wgsl.expected.glsl
index e70ab46..f99542b 100644
--- a/test/tint/ptr_ref/store/param/workgroup/i32_in_struct.wgsl.expected.glsl
+++ b/test/tint/ptr_ref/store/param/workgroup/i32_in_struct.wgsl.expected.glsl
@@ -6,7 +6,7 @@
 
 shared str S;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     str tint_symbol_1 = str(0);
     S = tint_symbol_1;
   }
diff --git a/test/tint/ptr_ref/store/param/workgroup/i32_in_struct.wgsl.expected.msl b/test/tint/ptr_ref/store/param/workgroup/i32_in_struct.wgsl.expected.msl
index c412256..56a97f9 100644
--- a/test/tint/ptr_ref/store/param/workgroup/i32_in_struct.wgsl.expected.msl
+++ b/test/tint/ptr_ref/store/param/workgroup/i32_in_struct.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup str* const tint_symbol_2) {
-  {
+  if ((local_idx < 1u)) {
     str const tint_symbol_1 = str{};
     *(tint_symbol_2) = tint_symbol_1;
   }
diff --git a/test/tint/ptr_ref/store/param/workgroup/i32_in_struct.wgsl.expected.spvasm b/test/tint/ptr_ref/store/param/workgroup/i32_in_struct.wgsl.expected.spvasm
index 5c146ce..39657df 100644
--- a/test/tint/ptr_ref/store/param/workgroup/i32_in_struct.wgsl.expected.spvasm
+++ b/test/tint/ptr_ref/store/param/workgroup/i32_in_struct.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 33
+; Bound: 38
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -28,36 +28,44 @@
           %S = OpVariable %_ptr_Workgroup_str Workgroup
        %void = OpTypeVoid
           %8 = OpTypeFunction %void %uint
-         %13 = OpConstantNull %str
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %18 = OpConstantNull %str
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %17 = OpTypeFunction %void
+         %22 = OpTypeFunction %void
      %uint_0 = OpConstant %uint 0
 %_ptr_Workgroup_int = OpTypePointer Workgroup %int
      %int_42 = OpConstant %int 42
 %tint_zero_workgroup_memory = OpFunction %void None %8
   %local_idx = OpFunctionParameter %uint
          %12 = OpLabel
-               OpStore %S %13
+         %14 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %16 None
+               OpBranchConditional %14 %17 %16
+         %17 = OpLabel
+               OpStore %S %18
+               OpBranch %16
+         %16 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-   %func_S_i = OpFunction %void None %17
-         %19 = OpLabel
-         %22 = OpAccessChain %_ptr_Workgroup_int %S %uint_0
-               OpStore %22 %int_42
+   %func_S_i = OpFunction %void None %22
+         %24 = OpLabel
+         %27 = OpAccessChain %_ptr_Workgroup_int %S %uint_0
+               OpStore %27 %int_42
                OpReturn
                OpFunctionEnd
  %main_inner = OpFunction %void None %8
 %local_invocation_index = OpFunctionParameter %uint
-         %26 = OpLabel
-         %27 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %28 = OpFunctionCall %void %func_S_i
+         %31 = OpLabel
+         %32 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %33 = OpFunctionCall %void %func_S_i
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %17
-         %30 = OpLabel
-         %32 = OpLoad %uint %local_invocation_index_1
-         %31 = OpFunctionCall %void %main_inner %32
+       %main = OpFunction %void None %22
+         %35 = OpLabel
+         %37 = OpLoad %uint %local_invocation_index_1
+         %36 = OpFunctionCall %void %main_inner %37
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.dxc.hlsl
index 4895286..1b8acb3 100644
--- a/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.dxc.hlsl
+++ b/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.dxc.hlsl
@@ -8,7 +8,7 @@
 groupshared float2x2 S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = float2x2((0.0f).xx, (0.0f).xx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.fxc.hlsl
index 4895286..1b8acb3 100644
--- a/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.fxc.hlsl
+++ b/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.fxc.hlsl
@@ -8,7 +8,7 @@
 groupshared float2x2 S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = float2x2((0.0f).xx, (0.0f).xx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.glsl b/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.glsl
index 4823bb1..7cf7a37 100644
--- a/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.glsl
+++ b/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared mat2 S;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = mat2(vec2(0.0f), vec2(0.0f));
   }
   barrier();
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.msl b/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.msl
index b616175..32f8886 100644
--- a/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.msl
+++ b/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float2x2* const tint_symbol_1) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol_1) = float2x2(float2(0.0f), float2(0.0f));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.spvasm b/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.spvasm
index 62d6679..2fb97bc 100644
--- a/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.spvasm
+++ b/test/tint/ptr_ref/store/param/workgroup/vec2_f32_in_mat2x2.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 41
+; Bound: 45
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -28,43 +28,50 @@
           %S = OpVariable %_ptr_Workgroup_mat2v2float Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
-         %14 = OpConstantNull %mat2v2float
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %19 = OpConstantNull %mat2v2float
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-     %uint_1 = OpConstant %uint 1
 %_arr_uint_uint_1 = OpTypeArray %uint %uint_1
-         %18 = OpTypeFunction %void %_arr_uint_uint_1
+         %23 = OpTypeFunction %void %_arr_uint_uint_1
         %int = OpTypeInt 32 1
-         %25 = OpConstantNull %int
+         %29 = OpConstantNull %int
 %_ptr_Workgroup_v2float = OpTypePointer Workgroup %v2float
-         %29 = OpConstantNull %v2float
-         %35 = OpConstantComposite %_arr_uint_uint_1 %uint_1
-         %36 = OpTypeFunction %void
+         %33 = OpConstantNull %v2float
+         %39 = OpConstantComposite %_arr_uint_uint_1 %uint_1
+         %40 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpStore %S %14
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpStore %S %19
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-   %func_S_X = OpFunction %void None %18
+   %func_S_X = OpFunction %void None %23
     %pointer = OpFunctionParameter %_arr_uint_uint_1
-         %23 = OpLabel
-         %26 = OpCompositeExtract %uint %pointer 0
-         %28 = OpAccessChain %_ptr_Workgroup_v2float %S %26
-               OpStore %28 %29
+         %27 = OpLabel
+         %30 = OpCompositeExtract %uint %pointer 0
+         %32 = OpAccessChain %_ptr_Workgroup_v2float %S %30
+               OpStore %32 %33
                OpReturn
                OpFunctionEnd
  %main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %32 = OpLabel
-         %33 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %34 = OpFunctionCall %void %func_S_X %35
+         %36 = OpLabel
+         %37 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %38 = OpFunctionCall %void %func_S_X %39
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %36
-         %38 = OpLabel
-         %40 = OpLoad %uint %local_invocation_index_1
-         %39 = OpFunctionCall %void %main_inner %40
+       %main = OpFunction %void None %40
+         %42 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %43 = OpFunctionCall %void %main_inner %44
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec4_f32.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/store/param/workgroup/vec4_f32.wgsl.expected.dxc.hlsl
index b983dd5..b564777 100644
--- a/test/tint/ptr_ref/store/param/workgroup/vec4_f32.wgsl.expected.dxc.hlsl
+++ b/test/tint/ptr_ref/store/param/workgroup/vec4_f32.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float4 S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = (0.0f).xxxx;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec4_f32.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/store/param/workgroup/vec4_f32.wgsl.expected.fxc.hlsl
index b983dd5..b564777 100644
--- a/test/tint/ptr_ref/store/param/workgroup/vec4_f32.wgsl.expected.fxc.hlsl
+++ b/test/tint/ptr_ref/store/param/workgroup/vec4_f32.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float4 S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = (0.0f).xxxx;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec4_f32.wgsl.expected.glsl b/test/tint/ptr_ref/store/param/workgroup/vec4_f32.wgsl.expected.glsl
index 7763882..8117256 100644
--- a/test/tint/ptr_ref/store/param/workgroup/vec4_f32.wgsl.expected.glsl
+++ b/test/tint/ptr_ref/store/param/workgroup/vec4_f32.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared vec4 S;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = vec4(0.0f);
   }
   barrier();
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec4_f32.wgsl.expected.msl b/test/tint/ptr_ref/store/param/workgroup/vec4_f32.wgsl.expected.msl
index e225662..aca075d 100644
--- a/test/tint/ptr_ref/store/param/workgroup/vec4_f32.wgsl.expected.msl
+++ b/test/tint/ptr_ref/store/param/workgroup/vec4_f32.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float4* const tint_symbol_1) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol_1) = float4(0.0f);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec4_f32.wgsl.expected.spvasm b/test/tint/ptr_ref/store/param/workgroup/vec4_f32.wgsl.expected.spvasm
index 305712c..ccd0d39 100644
--- a/test/tint/ptr_ref/store/param/workgroup/vec4_f32.wgsl.expected.spvasm
+++ b/test/tint/ptr_ref/store/param/workgroup/vec4_f32.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 29
+; Bound: 34
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -25,32 +25,40 @@
           %S = OpVariable %_ptr_Workgroup_v4float Workgroup
        %void = OpTypeVoid
           %8 = OpTypeFunction %void %uint
-         %13 = OpConstantNull %v4float
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %18 = OpConstantNull %v4float
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %17 = OpTypeFunction %void
+         %22 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %8
   %local_idx = OpFunctionParameter %uint
          %12 = OpLabel
-               OpStore %S %13
+         %14 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %16 None
+               OpBranchConditional %14 %17 %16
+         %17 = OpLabel
+               OpStore %S %18
+               OpBranch %16
+         %16 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-     %func_S = OpFunction %void None %17
-         %19 = OpLabel
-               OpStore %S %13
+     %func_S = OpFunction %void None %22
+         %24 = OpLabel
+               OpStore %S %18
                OpReturn
                OpFunctionEnd
  %main_inner = OpFunction %void None %8
 %local_invocation_index = OpFunctionParameter %uint
-         %22 = OpLabel
-         %23 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %24 = OpFunctionCall %void %func_S
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %29 = OpFunctionCall %void %func_S
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %17
-         %26 = OpLabel
-         %28 = OpLoad %uint %local_invocation_index_1
-         %27 = OpFunctionCall %void %main_inner %28
+       %main = OpFunction %void None %22
+         %31 = OpLabel
+         %33 = OpLoad %uint %local_invocation_index_1
+         %32 = OpFunctionCall %void %main_inner %33
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.dxc.hlsl
index b92816d..ee0aa2c 100644
--- a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.dxc.hlsl
+++ b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.dxc.hlsl
@@ -8,7 +8,7 @@
 groupshared float2x4 S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = float2x4((0.0f).xxxx, (0.0f).xxxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.fxc.hlsl
index b92816d..ee0aa2c 100644
--- a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.fxc.hlsl
+++ b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.fxc.hlsl
@@ -8,7 +8,7 @@
 groupshared float2x4 S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = float2x4((0.0f).xxxx, (0.0f).xxxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.glsl b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.glsl
index 77a9486..7e7b90b 100644
--- a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.glsl
+++ b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared mat2x4 S;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S = mat2x4(vec4(0.0f), vec4(0.0f));
   }
   barrier();
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.msl b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.msl
index eb6380f..e413c36 100644
--- a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.msl
+++ b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float2x4* const tint_symbol_1) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol_1) = float2x4(float4(0.0f), float4(0.0f));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.spvasm b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.spvasm
index 0d42779..c531f47 100644
--- a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.spvasm
+++ b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_mat2x4.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 41
+; Bound: 45
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -28,43 +28,50 @@
           %S = OpVariable %_ptr_Workgroup_mat2v4float Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
-         %14 = OpConstantNull %mat2v4float
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %19 = OpConstantNull %mat2v4float
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-     %uint_1 = OpConstant %uint 1
 %_arr_uint_uint_1 = OpTypeArray %uint %uint_1
-         %18 = OpTypeFunction %void %_arr_uint_uint_1
+         %23 = OpTypeFunction %void %_arr_uint_uint_1
         %int = OpTypeInt 32 1
-         %25 = OpConstantNull %int
+         %29 = OpConstantNull %int
 %_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float
-         %29 = OpConstantNull %v4float
-         %35 = OpConstantComposite %_arr_uint_uint_1 %uint_1
-         %36 = OpTypeFunction %void
+         %33 = OpConstantNull %v4float
+         %39 = OpConstantComposite %_arr_uint_uint_1 %uint_1
+         %40 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpStore %S %14
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpStore %S %19
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-   %func_S_X = OpFunction %void None %18
+   %func_S_X = OpFunction %void None %23
     %pointer = OpFunctionParameter %_arr_uint_uint_1
-         %23 = OpLabel
-         %26 = OpCompositeExtract %uint %pointer 0
-         %28 = OpAccessChain %_ptr_Workgroup_v4float %S %26
-               OpStore %28 %29
+         %27 = OpLabel
+         %30 = OpCompositeExtract %uint %pointer 0
+         %32 = OpAccessChain %_ptr_Workgroup_v4float %S %30
+               OpStore %32 %33
                OpReturn
                OpFunctionEnd
  %main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %32 = OpLabel
-         %33 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %34 = OpFunctionCall %void %func_S_X %35
+         %36 = OpLabel
+         %37 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %38 = OpFunctionCall %void %func_S_X %39
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %36
-         %38 = OpLabel
-         %40 = OpLoad %uint %local_invocation_index_1
-         %39 = OpFunctionCall %void %main_inner %40
+       %main = OpFunction %void None %40
+         %42 = OpLabel
+         %44 = OpLoad %uint %local_invocation_index_1
+         %43 = OpFunctionCall %void %main_inner %44
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_struct.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_struct.wgsl.expected.dxc.hlsl
index a3a1596..fd65103 100644
--- a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_struct.wgsl.expected.dxc.hlsl
+++ b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_struct.wgsl.expected.dxc.hlsl
@@ -5,7 +5,7 @@
 groupshared str S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     str tint_symbol_2 = (str)0;
     S = tint_symbol_2;
   }
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_struct.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_struct.wgsl.expected.fxc.hlsl
index a3a1596..fd65103 100644
--- a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_struct.wgsl.expected.fxc.hlsl
+++ b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_struct.wgsl.expected.fxc.hlsl
@@ -5,7 +5,7 @@
 groupshared str S;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     str tint_symbol_2 = (str)0;
     S = tint_symbol_2;
   }
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_struct.wgsl.expected.glsl b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_struct.wgsl.expected.glsl
index c802512..3abbde6 100644
--- a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_struct.wgsl.expected.glsl
+++ b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_struct.wgsl.expected.glsl
@@ -6,7 +6,7 @@
 
 shared str S;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     str tint_symbol_1 = str(vec4(0.0f));
     S = tint_symbol_1;
   }
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_struct.wgsl.expected.msl b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_struct.wgsl.expected.msl
index 1b8cdfa..9bd1757 100644
--- a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_struct.wgsl.expected.msl
+++ b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_struct.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup str* const tint_symbol_2) {
-  {
+  if ((local_idx < 1u)) {
     str const tint_symbol_1 = str{};
     *(tint_symbol_2) = tint_symbol_1;
   }
diff --git a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_struct.wgsl.expected.spvasm b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_struct.wgsl.expected.spvasm
index 7cd6048..54ad60f 100644
--- a/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_struct.wgsl.expected.spvasm
+++ b/test/tint/ptr_ref/store/param/workgroup/vec4_f32_in_struct.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 34
+; Bound: 39
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -29,36 +29,44 @@
           %S = OpVariable %_ptr_Workgroup_str Workgroup
        %void = OpTypeVoid
           %9 = OpTypeFunction %void %uint
-         %14 = OpConstantNull %str
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %19 = OpConstantNull %str
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %18 = OpTypeFunction %void
+         %23 = OpTypeFunction %void
      %uint_0 = OpConstant %uint 0
 %_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float
-         %24 = OpConstantNull %v4float
+         %29 = OpConstantNull %v4float
 %tint_zero_workgroup_memory = OpFunction %void None %9
   %local_idx = OpFunctionParameter %uint
          %13 = OpLabel
-               OpStore %S %14
+         %15 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %17 None
+               OpBranchConditional %15 %18 %17
+         %18 = OpLabel
+               OpStore %S %19
+               OpBranch %17
+         %17 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-   %func_S_i = OpFunction %void None %18
-         %20 = OpLabel
-         %23 = OpAccessChain %_ptr_Workgroup_v4float %S %uint_0
-               OpStore %23 %24
+   %func_S_i = OpFunction %void None %23
+         %25 = OpLabel
+         %28 = OpAccessChain %_ptr_Workgroup_v4float %S %uint_0
+               OpStore %28 %29
                OpReturn
                OpFunctionEnd
  %main_inner = OpFunction %void None %9
 %local_invocation_index = OpFunctionParameter %uint
-         %27 = OpLabel
-         %28 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %29 = OpFunctionCall %void %func_S_i
+         %32 = OpLabel
+         %33 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %34 = OpFunctionCall %void %func_S_i
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %18
-         %31 = OpLabel
-         %33 = OpLoad %uint %local_invocation_index_1
-         %32 = OpFunctionCall %void %main_inner %33
+       %main = OpFunction %void None %23
+         %36 = OpLabel
+         %38 = OpLoad %uint %local_invocation_index_1
+         %37 = OpFunctionCall %void %main_inner %38
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/types/module_scope_used_in_functions.wgsl.expected.dxc.hlsl b/test/tint/types/module_scope_used_in_functions.wgsl.expected.dxc.hlsl
index 1b40a80..989e64a 100644
--- a/test/tint/types/module_scope_used_in_functions.wgsl.expected.dxc.hlsl
+++ b/test/tint/types/module_scope_used_in_functions.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = 0.0f;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/types/module_scope_used_in_functions.wgsl.expected.fxc.hlsl b/test/tint/types/module_scope_used_in_functions.wgsl.expected.fxc.hlsl
index 1b40a80..989e64a 100644
--- a/test/tint/types/module_scope_used_in_functions.wgsl.expected.fxc.hlsl
+++ b/test/tint/types/module_scope_used_in_functions.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = 0.0f;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/types/module_scope_used_in_functions.wgsl.expected.glsl b/test/tint/types/module_scope_used_in_functions.wgsl.expected.glsl
index 0b1da1c..47df24b 100644
--- a/test/tint/types/module_scope_used_in_functions.wgsl.expected.glsl
+++ b/test/tint/types/module_scope_used_in_functions.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared float w;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = 0.0f;
   }
   barrier();
diff --git a/test/tint/types/module_scope_used_in_functions.wgsl.expected.msl b/test/tint/types/module_scope_used_in_functions.wgsl.expected.msl
index ada1fd2..ddf7ed0 100644
--- a/test/tint/types/module_scope_used_in_functions.wgsl.expected.msl
+++ b/test/tint/types/module_scope_used_in_functions.wgsl.expected.msl
@@ -23,7 +23,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float* const tint_symbol_1) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol_1) = 0.0f;
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/types/module_scope_used_in_functions.wgsl.expected.spvasm b/test/tint/types/module_scope_used_in_functions.wgsl.expected.spvasm
index b29e37f..5aea680 100644
--- a/test/tint/types/module_scope_used_in_functions.wgsl.expected.spvasm
+++ b/test/tint/types/module_scope_used_in_functions.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 63
+; Bound: 68
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -58,65 +58,73 @@
    %storages = OpVariable %_ptr_StorageBuffer_storages_block StorageBuffer
        %void = OpTypeVoid
          %18 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %26 = OpTypeFunction %void
+         %31 = OpTypeFunction %void
     %float_2 = OpConstant %float 2
-         %34 = OpTypeFunction %void %float %float
+         %39 = OpTypeFunction %void %float %float
      %uint_0 = OpConstant %uint 0
         %int = OpTypeInt 32 1
-         %41 = OpConstantNull %int
+         %46 = OpConstantNull %int
 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
-         %47 = OpTypeFunction %void %float
+         %52 = OpTypeFunction %void %float
     %float_1 = OpConstant %float 1
 %tint_zero_workgroup_memory = OpFunction %void None %18
   %local_idx = OpFunctionParameter %uint
          %22 = OpLabel
+         %24 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %26 None
+               OpBranchConditional %24 %27 %26
+         %27 = OpLabel
                OpStore %w %7
+               OpBranch %26
+         %26 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-    %no_uses = OpFunction %void None %26
-         %28 = OpLabel
+    %no_uses = OpFunction %void None %31
+         %33 = OpLabel
                OpReturn
                OpFunctionEnd
-        %zoo = OpFunction %void None %26
-         %30 = OpLabel
-         %31 = OpLoad %float %p
-         %33 = OpFMul %float %31 %float_2
-               OpStore %p %33
+        %zoo = OpFunction %void None %31
+         %35 = OpLabel
+         %36 = OpLoad %float %p
+         %38 = OpFMul %float %36 %float_2
+               OpStore %p %38
                OpReturn
                OpFunctionEnd
-        %bar = OpFunction %void None %34
+        %bar = OpFunction %void None %39
           %a = OpFunctionParameter %float
           %b = OpFunctionParameter %float
-         %38 = OpLabel
+         %43 = OpLabel
                OpStore %p %a
                OpStore %w %b
-         %43 = OpAccessChain %_ptr_StorageBuffer_float %storages %uint_0 %41
-         %44 = OpAccessChain %_ptr_StorageBuffer_float %uniforms %uint_0 %uint_0
-         %45 = OpLoad %float %44
-               OpStore %43 %45
-         %46 = OpFunctionCall %void %zoo
+         %48 = OpAccessChain %_ptr_StorageBuffer_float %storages %uint_0 %46
+         %49 = OpAccessChain %_ptr_StorageBuffer_float %uniforms %uint_0 %uint_0
+         %50 = OpLoad %float %49
+               OpStore %48 %50
+         %51 = OpFunctionCall %void %zoo
                OpReturn
                OpFunctionEnd
-        %foo = OpFunction %void None %47
+        %foo = OpFunction %void None %52
         %a_0 = OpFunctionParameter %float
-         %50 = OpLabel
-         %51 = OpFunctionCall %void %bar %a_0 %float_2
-         %52 = OpFunctionCall %void %no_uses
+         %55 = OpLabel
+         %56 = OpFunctionCall %void %bar %a_0 %float_2
+         %57 = OpFunctionCall %void %no_uses
                OpReturn
                OpFunctionEnd
  %main_inner = OpFunction %void None %18
 %local_invocation_index = OpFunctionParameter %uint
-         %55 = OpLabel
-         %56 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %57 = OpFunctionCall %void %foo %float_1
+         %60 = OpLabel
+         %61 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %62 = OpFunctionCall %void %foo %float_1
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %26
-         %60 = OpLabel
-         %62 = OpLoad %uint %local_invocation_index_1
-         %61 = OpFunctionCall %void %main_inner %62
+       %main = OpFunction %void None %31
+         %65 = OpLabel
+         %67 = OpLoad %uint %local_invocation_index_1
+         %66 = OpFunctionCall %void %main_inner %67
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/types/module_scope_var.wgsl.expected.dxc.hlsl b/test/tint/types/module_scope_var.wgsl.expected.dxc.hlsl
index 247c416..3e48c68 100644
--- a/test/tint/types/module_scope_var.wgsl.expected.dxc.hlsl
+++ b/test/tint/types/module_scope_var.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float wg_var;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg_var = 0.0f;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/types/module_scope_var.wgsl.expected.fxc.hlsl b/test/tint/types/module_scope_var.wgsl.expected.fxc.hlsl
index 247c416..3e48c68 100644
--- a/test/tint/types/module_scope_var.wgsl.expected.fxc.hlsl
+++ b/test/tint/types/module_scope_var.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float wg_var;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg_var = 0.0f;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/types/module_scope_var.wgsl.expected.glsl b/test/tint/types/module_scope_var.wgsl.expected.glsl
index 9cead53..aed6afe 100644
--- a/test/tint/types/module_scope_var.wgsl.expected.glsl
+++ b/test/tint/types/module_scope_var.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared float wg_var;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     wg_var = 0.0f;
   }
   barrier();
diff --git a/test/tint/types/module_scope_var.wgsl.expected.msl b/test/tint/types/module_scope_var.wgsl.expected.msl
index 4d2b2f8..ab84198 100644
--- a/test/tint/types/module_scope_var.wgsl.expected.msl
+++ b/test/tint/types/module_scope_var.wgsl.expected.msl
@@ -32,7 +32,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float* const tint_symbol_3) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol_3) = 0.0f;
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/types/module_scope_var.wgsl.expected.spvasm b/test/tint/types/module_scope_var.wgsl.expected.spvasm
index e2ee0aa..862eca3 100644
--- a/test/tint/types/module_scope_var.wgsl.expected.spvasm
+++ b/test/tint/types/module_scope_var.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 65
+; Bound: 69
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -77,21 +77,28 @@
      %wg_var = OpVariable %_ptr_Workgroup_float Workgroup
        %void = OpTypeVoid
          %47 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
    %float_42 = OpConstant %float 42
-         %60 = OpTypeFunction %void
+         %64 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %47
   %local_idx = OpFunctionParameter %uint
          %51 = OpLabel
+         %53 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %54 None
+               OpBranchConditional %53 %55 %54
+         %55 = OpLabel
                OpStore %wg_var %18
+               OpBranch %54
+         %54 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
  %main_inner = OpFunction %void None %47
 %local_invocation_index = OpFunctionParameter %uint
-         %57 = OpLabel
-         %58 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %61 = OpLabel
+         %62 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
                OpStore %bool_var %7
                OpStore %i32_var %11
                OpStore %u32_var %14
@@ -105,9 +112,9 @@
                OpStore %wg_var %float_42
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %60
-         %62 = OpLabel
-         %64 = OpLoad %uint %local_invocation_index_1
-         %63 = OpFunctionCall %void %main_inner %64
+       %main = OpFunction %void None %64
+         %66 = OpLabel
+         %68 = OpLoad %uint %local_invocation_index_1
+         %67 = OpFunctionCall %void %main_inner %68
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/types/module_scope_vars_pointers.wgsl.expected.dxc.hlsl b/test/tint/types/module_scope_vars_pointers.wgsl.expected.dxc.hlsl
index 36d70e6..4790171 100644
--- a/test/tint/types/module_scope_vars_pointers.wgsl.expected.dxc.hlsl
+++ b/test/tint/types/module_scope_vars_pointers.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = 0.0f;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/types/module_scope_vars_pointers.wgsl.expected.fxc.hlsl b/test/tint/types/module_scope_vars_pointers.wgsl.expected.fxc.hlsl
index 36d70e6..4790171 100644
--- a/test/tint/types/module_scope_vars_pointers.wgsl.expected.fxc.hlsl
+++ b/test/tint/types/module_scope_vars_pointers.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float w;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = 0.0f;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/types/module_scope_vars_pointers.wgsl.expected.glsl b/test/tint/types/module_scope_vars_pointers.wgsl.expected.glsl
index e913e92..85565bf 100644
--- a/test/tint/types/module_scope_vars_pointers.wgsl.expected.glsl
+++ b/test/tint/types/module_scope_vars_pointers.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared float w;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     w = 0.0f;
   }
   barrier();
diff --git a/test/tint/types/module_scope_vars_pointers.wgsl.expected.msl b/test/tint/types/module_scope_vars_pointers.wgsl.expected.msl
index ac7e626..8a7db67 100644
--- a/test/tint/types/module_scope_vars_pointers.wgsl.expected.msl
+++ b/test/tint/types/module_scope_vars_pointers.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float* const tint_symbol_1) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol_1) = 0.0f;
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/types/module_scope_vars_pointers.wgsl.expected.spvasm b/test/tint/types/module_scope_vars_pointers.wgsl.expected.spvasm
index 3ea0101..6a0aead 100644
--- a/test/tint/types/module_scope_vars_pointers.wgsl.expected.spvasm
+++ b/test/tint/types/module_scope_vars_pointers.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 30
+; Bound: 35
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -27,29 +27,37 @@
           %w = OpVariable %_ptr_Workgroup_float Workgroup
        %void = OpTypeVoid
          %10 = OpTypeFunction %void %uint
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %25 = OpTypeFunction %void
+         %30 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %10
   %local_idx = OpFunctionParameter %uint
          %14 = OpLabel
+         %16 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %18 None
+               OpBranchConditional %16 %19 %18
+         %19 = OpLabel
                OpStore %w %7
+               OpBranch %18
+         %18 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
  %main_inner = OpFunction %void None %10
 %local_invocation_index = OpFunctionParameter %uint
-         %20 = OpLabel
-         %21 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %22 = OpLoad %float %p
-         %23 = OpLoad %float %w
-         %24 = OpFAdd %float %22 %23
-               OpStore %p %24
+         %25 = OpLabel
+         %26 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %27 = OpLoad %float %p
+         %28 = OpLoad %float %w
+         %29 = OpFAdd %float %27 %28
+               OpStore %p %29
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %25
-         %27 = OpLabel
-         %29 = OpLoad %uint %local_invocation_index_1
-         %28 = OpFunctionCall %void %main_inner %29
+       %main = OpFunction %void None %30
+         %32 = OpLabel
+         %34 = OpLoad %uint %local_invocation_index_1
+         %33 = OpFunctionCall %void %main_inner %34
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/var/initialization/workgroup/matrix.wgsl.expected.dxc.hlsl b/test/tint/var/initialization/workgroup/matrix.wgsl.expected.dxc.hlsl
index 684d68e..f266ae5 100644
--- a/test/tint/var/initialization/workgroup/matrix.wgsl.expected.dxc.hlsl
+++ b/test/tint/var/initialization/workgroup/matrix.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float2x3 v;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     v = float2x3((0.0f).xxx, (0.0f).xxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/var/initialization/workgroup/matrix.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/workgroup/matrix.wgsl.expected.fxc.hlsl
index 684d68e..f266ae5 100644
--- a/test/tint/var/initialization/workgroup/matrix.wgsl.expected.fxc.hlsl
+++ b/test/tint/var/initialization/workgroup/matrix.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared float2x3 v;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     v = float2x3((0.0f).xxx, (0.0f).xxx);
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/var/initialization/workgroup/matrix.wgsl.expected.glsl b/test/tint/var/initialization/workgroup/matrix.wgsl.expected.glsl
index 474437f..7d8c8e7 100644
--- a/test/tint/var/initialization/workgroup/matrix.wgsl.expected.glsl
+++ b/test/tint/var/initialization/workgroup/matrix.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared mat2x3 v;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     v = mat2x3(vec3(0.0f), vec3(0.0f));
   }
   barrier();
diff --git a/test/tint/var/initialization/workgroup/matrix.wgsl.expected.msl b/test/tint/var/initialization/workgroup/matrix.wgsl.expected.msl
index f946d0b..41b834d 100644
--- a/test/tint/var/initialization/workgroup/matrix.wgsl.expected.msl
+++ b/test/tint/var/initialization/workgroup/matrix.wgsl.expected.msl
@@ -6,7 +6,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float2x3* const tint_symbol_1) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol_1) = float2x3(float3(0.0f), float3(0.0f));
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.dxc.hlsl b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.dxc.hlsl
index fc88372..ffa3c84 100644
--- a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.dxc.hlsl
+++ b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int v;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     v = 0;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.fxc.hlsl
index fc88372..ffa3c84 100644
--- a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.fxc.hlsl
+++ b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int v;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     v = 0;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.glsl b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.glsl
index 6f0b307..5ba4ffe 100644
--- a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.glsl
+++ b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int v;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     v = 0;
   }
   barrier();
diff --git a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.msl b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.msl
index 65d75e4..25d8fcf 100644
--- a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.msl
+++ b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup int* const tint_symbol_1) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol_1) = 0;
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.spvasm b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.spvasm
index 8a53ab3..0296eb4 100644
--- a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.spvasm
+++ b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 26
+; Bound: 31
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -23,27 +23,35 @@
           %v = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
           %7 = OpTypeFunction %void %uint
-         %12 = OpConstantNull %int
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %17 = OpConstantNull %int
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %21 = OpTypeFunction %void
+         %26 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %7
   %local_idx = OpFunctionParameter %uint
          %11 = OpLabel
-               OpStore %v %12
+         %13 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %15 None
+               OpBranchConditional %13 %16 %15
+         %16 = OpLabel
+               OpStore %v %17
+               OpBranch %15
+         %15 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
  %main_inner = OpFunction %void None %7
 %local_invocation_index = OpFunctionParameter %uint
-         %18 = OpLabel
-         %19 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
-         %20 = OpLoad %int %v
+         %23 = OpLabel
+         %24 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %25 = OpLoad %int %v
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %21
-         %23 = OpLabel
-         %25 = OpLoad %uint %local_invocation_index_1
-         %24 = OpFunctionCall %void %main_inner %25
+       %main = OpFunction %void None %26
+         %28 = OpLabel
+         %30 = OpLoad %uint %local_invocation_index_1
+         %29 = OpFunctionCall %void %main_inner %30
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/var/initialization/workgroup/struct.wgsl.expected.dxc.hlsl b/test/tint/var/initialization/workgroup/struct.wgsl.expected.dxc.hlsl
index 81a5c79..c7d42b9 100644
--- a/test/tint/var/initialization/workgroup/struct.wgsl.expected.dxc.hlsl
+++ b/test/tint/var/initialization/workgroup/struct.wgsl.expected.dxc.hlsl
@@ -6,7 +6,7 @@
 groupshared S v;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S tint_symbol_2 = (S)0;
     v = tint_symbol_2;
   }
diff --git a/test/tint/var/initialization/workgroup/struct.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/workgroup/struct.wgsl.expected.fxc.hlsl
index 81a5c79..c7d42b9 100644
--- a/test/tint/var/initialization/workgroup/struct.wgsl.expected.fxc.hlsl
+++ b/test/tint/var/initialization/workgroup/struct.wgsl.expected.fxc.hlsl
@@ -6,7 +6,7 @@
 groupshared S v;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S tint_symbol_2 = (S)0;
     v = tint_symbol_2;
   }
diff --git a/test/tint/var/initialization/workgroup/struct.wgsl.expected.glsl b/test/tint/var/initialization/workgroup/struct.wgsl.expected.glsl
index 413ac39..ce14f60 100644
--- a/test/tint/var/initialization/workgroup/struct.wgsl.expected.glsl
+++ b/test/tint/var/initialization/workgroup/struct.wgsl.expected.glsl
@@ -7,7 +7,7 @@
 
 shared S v;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     S tint_symbol_1 = S(0, 0.0f);
     v = tint_symbol_1;
   }
diff --git a/test/tint/var/initialization/workgroup/struct.wgsl.expected.msl b/test/tint/var/initialization/workgroup/struct.wgsl.expected.msl
index c72ed35..2232e64 100644
--- a/test/tint/var/initialization/workgroup/struct.wgsl.expected.msl
+++ b/test/tint/var/initialization/workgroup/struct.wgsl.expected.msl
@@ -7,7 +7,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup S* const tint_symbol_2) {
-  {
+  if ((local_idx < 1u)) {
     S const tint_symbol_1 = S{};
     *(tint_symbol_2) = tint_symbol_1;
   }
diff --git a/test/tint/var/initialization/workgroup/vector.wgsl.expected.dxc.hlsl b/test/tint/var/initialization/workgroup/vector.wgsl.expected.dxc.hlsl
index 012df12..ce1dc0b 100644
--- a/test/tint/var/initialization/workgroup/vector.wgsl.expected.dxc.hlsl
+++ b/test/tint/var/initialization/workgroup/vector.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int3 v;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     v = (0).xxx;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/var/initialization/workgroup/vector.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/workgroup/vector.wgsl.expected.fxc.hlsl
index 012df12..ce1dc0b 100644
--- a/test/tint/var/initialization/workgroup/vector.wgsl.expected.fxc.hlsl
+++ b/test/tint/var/initialization/workgroup/vector.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int3 v;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     v = (0).xxx;
   }
   GroupMemoryBarrierWithGroupSync();
diff --git a/test/tint/var/initialization/workgroup/vector.wgsl.expected.glsl b/test/tint/var/initialization/workgroup/vector.wgsl.expected.glsl
index e93a682..e5020e1 100644
--- a/test/tint/var/initialization/workgroup/vector.wgsl.expected.glsl
+++ b/test/tint/var/initialization/workgroup/vector.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared ivec3 v;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     v = ivec3(0);
   }
   barrier();
diff --git a/test/tint/var/initialization/workgroup/vector.wgsl.expected.msl b/test/tint/var/initialization/workgroup/vector.wgsl.expected.msl
index fa9cfff..7942bab 100644
--- a/test/tint/var/initialization/workgroup/vector.wgsl.expected.msl
+++ b/test/tint/var/initialization/workgroup/vector.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup int3* const tint_symbol_1) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol_1) = int3(0);
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
diff --git a/test/tint/var/uses/many_workgroup_vars.wgsl.expected.dxc.hlsl b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.dxc.hlsl
index e80a5d6..744d4e5 100644
--- a/test/tint/var/uses/many_workgroup_vars.wgsl.expected.dxc.hlsl
+++ b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.dxc.hlsl
@@ -100,7 +100,7 @@
 groupshared float2x2 m99;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     m00 = float2x2((0.0f).xx, (0.0f).xx);
     m01 = float2x2((0.0f).xx, (0.0f).xx);
     m02 = float2x2((0.0f).xx, (0.0f).xx);
diff --git a/test/tint/var/uses/many_workgroup_vars.wgsl.expected.fxc.hlsl b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.fxc.hlsl
index e80a5d6..744d4e5 100644
--- a/test/tint/var/uses/many_workgroup_vars.wgsl.expected.fxc.hlsl
+++ b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.fxc.hlsl
@@ -100,7 +100,7 @@
 groupshared float2x2 m99;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     m00 = float2x2((0.0f).xx, (0.0f).xx);
     m01 = float2x2((0.0f).xx, (0.0f).xx);
     m02 = float2x2((0.0f).xx, (0.0f).xx);
diff --git a/test/tint/var/uses/many_workgroup_vars.wgsl.expected.glsl b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.glsl
index 87c8296..decb79c 100644
--- a/test/tint/var/uses/many_workgroup_vars.wgsl.expected.glsl
+++ b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.glsl
@@ -101,7 +101,7 @@
 shared mat2 m98;
 shared mat2 m99;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     m00 = mat2(vec2(0.0f), vec2(0.0f));
     m01 = mat2(vec2(0.0f), vec2(0.0f));
     m02 = mat2(vec2(0.0f), vec2(0.0f));
diff --git a/test/tint/var/uses/many_workgroup_vars.wgsl.expected.msl b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.msl
index 0425a0c..05da560 100644
--- a/test/tint/var/uses/many_workgroup_vars.wgsl.expected.msl
+++ b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.msl
@@ -105,7 +105,7 @@
 };
 
 void tint_zero_workgroup_memory(uint local_idx, threadgroup float2x2* const tint_symbol_1, threadgroup float2x2* const tint_symbol_2, threadgroup float2x2* const tint_symbol_3, threadgroup float2x2* const tint_symbol_4, threadgroup float2x2* const tint_symbol_5, threadgroup float2x2* const tint_symbol_6, threadgroup float2x2* const tint_symbol_7, threadgroup float2x2* const tint_symbol_8, threadgroup float2x2* const tint_symbol_9, threadgroup float2x2* const tint_symbol_10, threadgroup float2x2* const tint_symbol_11, threadgroup float2x2* const tint_symbol_12, threadgroup float2x2* const tint_symbol_13, threadgroup float2x2* const tint_symbol_14, threadgroup float2x2* const tint_symbol_15, threadgroup float2x2* const tint_symbol_16, threadgroup float2x2* const tint_symbol_17, threadgroup float2x2* const tint_symbol_18, threadgroup float2x2* const tint_symbol_19, threadgroup float2x2* const tint_symbol_20, threadgroup float2x2* const tint_symbol_21, threadgroup float2x2* const tint_symbol_22, threadgroup float2x2* const tint_symbol_23, threadgroup float2x2* const tint_symbol_24, threadgroup float2x2* const tint_symbol_25, threadgroup float2x2* const tint_symbol_26, threadgroup float2x2* const tint_symbol_27, threadgroup float2x2* const tint_symbol_28, threadgroup float2x2* const tint_symbol_29, threadgroup float2x2* const tint_symbol_30, threadgroup float2x2* const tint_symbol_31, threadgroup float2x2* const tint_symbol_32, threadgroup float2x2* const tint_symbol_33, threadgroup float2x2* const tint_symbol_34, threadgroup float2x2* const tint_symbol_35, threadgroup float2x2* const tint_symbol_36, threadgroup float2x2* const tint_symbol_37, threadgroup float2x2* const tint_symbol_38, threadgroup float2x2* const tint_symbol_39, threadgroup float2x2* const tint_symbol_40, threadgroup float2x2* const tint_symbol_41, threadgroup float2x2* const tint_symbol_42, threadgroup float2x2* const tint_symbol_43, threadgroup float2x2* const tint_symbol_44, threadgroup float2x2* const tint_symbol_45, threadgroup float2x2* const tint_symbol_46, threadgroup float2x2* const tint_symbol_47, threadgroup float2x2* const tint_symbol_48, threadgroup float2x2* const tint_symbol_49, threadgroup float2x2* const tint_symbol_50, threadgroup float2x2* const tint_symbol_51, threadgroup float2x2* const tint_symbol_52, threadgroup float2x2* const tint_symbol_53, threadgroup float2x2* const tint_symbol_54, threadgroup float2x2* const tint_symbol_55, threadgroup float2x2* const tint_symbol_56, threadgroup float2x2* const tint_symbol_57, threadgroup float2x2* const tint_symbol_58, threadgroup float2x2* const tint_symbol_59, threadgroup float2x2* const tint_symbol_60, threadgroup float2x2* const tint_symbol_61, threadgroup float2x2* const tint_symbol_62, threadgroup float2x2* const tint_symbol_63, threadgroup float2x2* const tint_symbol_64, threadgroup float2x2* const tint_symbol_65, threadgroup float2x2* const tint_symbol_66, threadgroup float2x2* const tint_symbol_67, threadgroup float2x2* const tint_symbol_68, threadgroup float2x2* const tint_symbol_69, threadgroup float2x2* const tint_symbol_70, threadgroup float2x2* const tint_symbol_71, threadgroup float2x2* const tint_symbol_72, threadgroup float2x2* const tint_symbol_73, threadgroup float2x2* const tint_symbol_74, threadgroup float2x2* const tint_symbol_75, threadgroup float2x2* const tint_symbol_76, threadgroup float2x2* const tint_symbol_77, threadgroup float2x2* const tint_symbol_78, threadgroup float2x2* const tint_symbol_79, threadgroup float2x2* const tint_symbol_80, threadgroup float2x2* const tint_symbol_81, threadgroup float2x2* const tint_symbol_82, threadgroup float2x2* const tint_symbol_83, threadgroup float2x2* const tint_symbol_84, threadgroup float2x2* const tint_symbol_85, threadgroup float2x2* const tint_symbol_86, threadgroup float2x2* const tint_symbol_87, threadgroup float2x2* const tint_symbol_88, threadgroup float2x2* const tint_symbol_89, threadgroup float2x2* const tint_symbol_90, threadgroup float2x2* const tint_symbol_91, threadgroup float2x2* const tint_symbol_92, threadgroup float2x2* const tint_symbol_93, threadgroup float2x2* const tint_symbol_94, threadgroup float2x2* const tint_symbol_95, threadgroup float2x2* const tint_symbol_96, threadgroup float2x2* const tint_symbol_97, threadgroup float2x2* const tint_symbol_98, threadgroup float2x2* const tint_symbol_99, threadgroup float2x2* const tint_symbol_100) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol_1) = float2x2(float2(0.0f), float2(0.0f));
     *(tint_symbol_2) = float2x2(float2(0.0f), float2(0.0f));
     *(tint_symbol_3) = float2x2(float2(0.0f), float2(0.0f));
diff --git a/test/tint/var/uses/many_workgroup_vars.wgsl.expected.spvasm b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.spvasm
index e822b29..fa00999 100644
--- a/test/tint/var/uses/many_workgroup_vars.wgsl.expected.spvasm
+++ b/test/tint/var/uses/many_workgroup_vars.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 230
+; Bound: 235
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -223,329 +223,337 @@
         %m99 = OpVariable %_ptr_Workgroup_mat2v2float Workgroup
        %void = OpTypeVoid
         %108 = OpTypeFunction %void %uint
-        %113 = OpConstantNull %mat2v2float
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+        %118 = OpConstantNull %mat2v2float
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
         %int = OpTypeInt 32 1
-        %122 = OpConstantNull %int
+        %127 = OpConstantNull %int
 %_ptr_Workgroup_float = OpTypePointer Workgroup %float
     %float_1 = OpConstant %float 1
-        %225 = OpTypeFunction %void
+        %230 = OpTypeFunction %void
 %tint_zero_workgroup_memory = OpFunction %void None %108
   %local_idx = OpFunctionParameter %uint
         %112 = OpLabel
-               OpStore %m00 %113
-               OpStore %m01 %113
-               OpStore %m02 %113
-               OpStore %m03 %113
-               OpStore %m04 %113
-               OpStore %m05 %113
-               OpStore %m06 %113
-               OpStore %m07 %113
-               OpStore %m08 %113
-               OpStore %m09 %113
-               OpStore %m10 %113
-               OpStore %m11 %113
-               OpStore %m12 %113
-               OpStore %m13 %113
-               OpStore %m14 %113
-               OpStore %m15 %113
-               OpStore %m16 %113
-               OpStore %m17 %113
-               OpStore %m18 %113
-               OpStore %m19 %113
-               OpStore %m20 %113
-               OpStore %m21 %113
-               OpStore %m22 %113
-               OpStore %m23 %113
-               OpStore %m24 %113
-               OpStore %m25 %113
-               OpStore %m26 %113
-               OpStore %m27 %113
-               OpStore %m28 %113
-               OpStore %m29 %113
-               OpStore %m30 %113
-               OpStore %m31 %113
-               OpStore %m32 %113
-               OpStore %m33 %113
-               OpStore %m34 %113
-               OpStore %m35 %113
-               OpStore %m36 %113
-               OpStore %m37 %113
-               OpStore %m38 %113
-               OpStore %m39 %113
-               OpStore %m40 %113
-               OpStore %m41 %113
-               OpStore %m42 %113
-               OpStore %m43 %113
-               OpStore %m44 %113
-               OpStore %m45 %113
-               OpStore %m46 %113
-               OpStore %m47 %113
-               OpStore %m48 %113
-               OpStore %m49 %113
-               OpStore %m50 %113
-               OpStore %m51 %113
-               OpStore %m52 %113
-               OpStore %m53 %113
-               OpStore %m54 %113
-               OpStore %m55 %113
-               OpStore %m56 %113
-               OpStore %m57 %113
-               OpStore %m58 %113
-               OpStore %m59 %113
-               OpStore %m60 %113
-               OpStore %m61 %113
-               OpStore %m62 %113
-               OpStore %m63 %113
-               OpStore %m64 %113
-               OpStore %m65 %113
-               OpStore %m66 %113
-               OpStore %m67 %113
-               OpStore %m68 %113
-               OpStore %m69 %113
-               OpStore %m70 %113
-               OpStore %m71 %113
-               OpStore %m72 %113
-               OpStore %m73 %113
-               OpStore %m74 %113
-               OpStore %m75 %113
-               OpStore %m76 %113
-               OpStore %m77 %113
-               OpStore %m78 %113
-               OpStore %m79 %113
-               OpStore %m80 %113
-               OpStore %m81 %113
-               OpStore %m82 %113
-               OpStore %m83 %113
-               OpStore %m84 %113
-               OpStore %m85 %113
-               OpStore %m86 %113
-               OpStore %m87 %113
-               OpStore %m88 %113
-               OpStore %m89 %113
-               OpStore %m90 %113
-               OpStore %m91 %113
-               OpStore %m92 %113
-               OpStore %m93 %113
-               OpStore %m94 %113
-               OpStore %m95 %113
-               OpStore %m96 %113
-               OpStore %m97 %113
-               OpStore %m98 %113
-               OpStore %m99 %113
+        %114 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %116 None
+               OpBranchConditional %114 %117 %116
+        %117 = OpLabel
+               OpStore %m00 %118
+               OpStore %m01 %118
+               OpStore %m02 %118
+               OpStore %m03 %118
+               OpStore %m04 %118
+               OpStore %m05 %118
+               OpStore %m06 %118
+               OpStore %m07 %118
+               OpStore %m08 %118
+               OpStore %m09 %118
+               OpStore %m10 %118
+               OpStore %m11 %118
+               OpStore %m12 %118
+               OpStore %m13 %118
+               OpStore %m14 %118
+               OpStore %m15 %118
+               OpStore %m16 %118
+               OpStore %m17 %118
+               OpStore %m18 %118
+               OpStore %m19 %118
+               OpStore %m20 %118
+               OpStore %m21 %118
+               OpStore %m22 %118
+               OpStore %m23 %118
+               OpStore %m24 %118
+               OpStore %m25 %118
+               OpStore %m26 %118
+               OpStore %m27 %118
+               OpStore %m28 %118
+               OpStore %m29 %118
+               OpStore %m30 %118
+               OpStore %m31 %118
+               OpStore %m32 %118
+               OpStore %m33 %118
+               OpStore %m34 %118
+               OpStore %m35 %118
+               OpStore %m36 %118
+               OpStore %m37 %118
+               OpStore %m38 %118
+               OpStore %m39 %118
+               OpStore %m40 %118
+               OpStore %m41 %118
+               OpStore %m42 %118
+               OpStore %m43 %118
+               OpStore %m44 %118
+               OpStore %m45 %118
+               OpStore %m46 %118
+               OpStore %m47 %118
+               OpStore %m48 %118
+               OpStore %m49 %118
+               OpStore %m50 %118
+               OpStore %m51 %118
+               OpStore %m52 %118
+               OpStore %m53 %118
+               OpStore %m54 %118
+               OpStore %m55 %118
+               OpStore %m56 %118
+               OpStore %m57 %118
+               OpStore %m58 %118
+               OpStore %m59 %118
+               OpStore %m60 %118
+               OpStore %m61 %118
+               OpStore %m62 %118
+               OpStore %m63 %118
+               OpStore %m64 %118
+               OpStore %m65 %118
+               OpStore %m66 %118
+               OpStore %m67 %118
+               OpStore %m68 %118
+               OpStore %m69 %118
+               OpStore %m70 %118
+               OpStore %m71 %118
+               OpStore %m72 %118
+               OpStore %m73 %118
+               OpStore %m74 %118
+               OpStore %m75 %118
+               OpStore %m76 %118
+               OpStore %m77 %118
+               OpStore %m78 %118
+               OpStore %m79 %118
+               OpStore %m80 %118
+               OpStore %m81 %118
+               OpStore %m82 %118
+               OpStore %m83 %118
+               OpStore %m84 %118
+               OpStore %m85 %118
+               OpStore %m86 %118
+               OpStore %m87 %118
+               OpStore %m88 %118
+               OpStore %m89 %118
+               OpStore %m90 %118
+               OpStore %m91 %118
+               OpStore %m92 %118
+               OpStore %m93 %118
+               OpStore %m94 %118
+               OpStore %m95 %118
+               OpStore %m96 %118
+               OpStore %m97 %118
+               OpStore %m98 %118
+               OpStore %m99 %118
+               OpBranch %116
+        %116 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
 %tint_symbol_inner = OpFunction %void None %108
         %idx = OpFunctionParameter %uint
-        %119 = OpLabel
-        %120 = OpFunctionCall %void %tint_zero_workgroup_memory %idx
-        %124 = OpAccessChain %_ptr_Workgroup_float %m00 %122 %122
-               OpStore %124 %float_1
-        %126 = OpAccessChain %_ptr_Workgroup_float %m01 %122 %122
-               OpStore %126 %float_1
-        %127 = OpAccessChain %_ptr_Workgroup_float %m02 %122 %122
-               OpStore %127 %float_1
-        %128 = OpAccessChain %_ptr_Workgroup_float %m03 %122 %122
-               OpStore %128 %float_1
-        %129 = OpAccessChain %_ptr_Workgroup_float %m04 %122 %122
+        %124 = OpLabel
+        %125 = OpFunctionCall %void %tint_zero_workgroup_memory %idx
+        %129 = OpAccessChain %_ptr_Workgroup_float %m00 %127 %127
                OpStore %129 %float_1
-        %130 = OpAccessChain %_ptr_Workgroup_float %m05 %122 %122
-               OpStore %130 %float_1
-        %131 = OpAccessChain %_ptr_Workgroup_float %m06 %122 %122
+        %131 = OpAccessChain %_ptr_Workgroup_float %m01 %127 %127
                OpStore %131 %float_1
-        %132 = OpAccessChain %_ptr_Workgroup_float %m07 %122 %122
+        %132 = OpAccessChain %_ptr_Workgroup_float %m02 %127 %127
                OpStore %132 %float_1
-        %133 = OpAccessChain %_ptr_Workgroup_float %m08 %122 %122
+        %133 = OpAccessChain %_ptr_Workgroup_float %m03 %127 %127
                OpStore %133 %float_1
-        %134 = OpAccessChain %_ptr_Workgroup_float %m09 %122 %122
+        %134 = OpAccessChain %_ptr_Workgroup_float %m04 %127 %127
                OpStore %134 %float_1
-        %135 = OpAccessChain %_ptr_Workgroup_float %m10 %122 %122
+        %135 = OpAccessChain %_ptr_Workgroup_float %m05 %127 %127
                OpStore %135 %float_1
-        %136 = OpAccessChain %_ptr_Workgroup_float %m11 %122 %122
+        %136 = OpAccessChain %_ptr_Workgroup_float %m06 %127 %127
                OpStore %136 %float_1
-        %137 = OpAccessChain %_ptr_Workgroup_float %m12 %122 %122
+        %137 = OpAccessChain %_ptr_Workgroup_float %m07 %127 %127
                OpStore %137 %float_1
-        %138 = OpAccessChain %_ptr_Workgroup_float %m13 %122 %122
+        %138 = OpAccessChain %_ptr_Workgroup_float %m08 %127 %127
                OpStore %138 %float_1
-        %139 = OpAccessChain %_ptr_Workgroup_float %m14 %122 %122
+        %139 = OpAccessChain %_ptr_Workgroup_float %m09 %127 %127
                OpStore %139 %float_1
-        %140 = OpAccessChain %_ptr_Workgroup_float %m15 %122 %122
+        %140 = OpAccessChain %_ptr_Workgroup_float %m10 %127 %127
                OpStore %140 %float_1
-        %141 = OpAccessChain %_ptr_Workgroup_float %m16 %122 %122
+        %141 = OpAccessChain %_ptr_Workgroup_float %m11 %127 %127
                OpStore %141 %float_1
-        %142 = OpAccessChain %_ptr_Workgroup_float %m17 %122 %122
+        %142 = OpAccessChain %_ptr_Workgroup_float %m12 %127 %127
                OpStore %142 %float_1
-        %143 = OpAccessChain %_ptr_Workgroup_float %m18 %122 %122
+        %143 = OpAccessChain %_ptr_Workgroup_float %m13 %127 %127
                OpStore %143 %float_1
-        %144 = OpAccessChain %_ptr_Workgroup_float %m19 %122 %122
+        %144 = OpAccessChain %_ptr_Workgroup_float %m14 %127 %127
                OpStore %144 %float_1
-        %145 = OpAccessChain %_ptr_Workgroup_float %m20 %122 %122
+        %145 = OpAccessChain %_ptr_Workgroup_float %m15 %127 %127
                OpStore %145 %float_1
-        %146 = OpAccessChain %_ptr_Workgroup_float %m21 %122 %122
+        %146 = OpAccessChain %_ptr_Workgroup_float %m16 %127 %127
                OpStore %146 %float_1
-        %147 = OpAccessChain %_ptr_Workgroup_float %m22 %122 %122
+        %147 = OpAccessChain %_ptr_Workgroup_float %m17 %127 %127
                OpStore %147 %float_1
-        %148 = OpAccessChain %_ptr_Workgroup_float %m23 %122 %122
+        %148 = OpAccessChain %_ptr_Workgroup_float %m18 %127 %127
                OpStore %148 %float_1
-        %149 = OpAccessChain %_ptr_Workgroup_float %m24 %122 %122
+        %149 = OpAccessChain %_ptr_Workgroup_float %m19 %127 %127
                OpStore %149 %float_1
-        %150 = OpAccessChain %_ptr_Workgroup_float %m25 %122 %122
+        %150 = OpAccessChain %_ptr_Workgroup_float %m20 %127 %127
                OpStore %150 %float_1
-        %151 = OpAccessChain %_ptr_Workgroup_float %m26 %122 %122
+        %151 = OpAccessChain %_ptr_Workgroup_float %m21 %127 %127
                OpStore %151 %float_1
-        %152 = OpAccessChain %_ptr_Workgroup_float %m27 %122 %122
+        %152 = OpAccessChain %_ptr_Workgroup_float %m22 %127 %127
                OpStore %152 %float_1
-        %153 = OpAccessChain %_ptr_Workgroup_float %m28 %122 %122
+        %153 = OpAccessChain %_ptr_Workgroup_float %m23 %127 %127
                OpStore %153 %float_1
-        %154 = OpAccessChain %_ptr_Workgroup_float %m29 %122 %122
+        %154 = OpAccessChain %_ptr_Workgroup_float %m24 %127 %127
                OpStore %154 %float_1
-        %155 = OpAccessChain %_ptr_Workgroup_float %m30 %122 %122
+        %155 = OpAccessChain %_ptr_Workgroup_float %m25 %127 %127
                OpStore %155 %float_1
-        %156 = OpAccessChain %_ptr_Workgroup_float %m31 %122 %122
+        %156 = OpAccessChain %_ptr_Workgroup_float %m26 %127 %127
                OpStore %156 %float_1
-        %157 = OpAccessChain %_ptr_Workgroup_float %m32 %122 %122
+        %157 = OpAccessChain %_ptr_Workgroup_float %m27 %127 %127
                OpStore %157 %float_1
-        %158 = OpAccessChain %_ptr_Workgroup_float %m33 %122 %122
+        %158 = OpAccessChain %_ptr_Workgroup_float %m28 %127 %127
                OpStore %158 %float_1
-        %159 = OpAccessChain %_ptr_Workgroup_float %m34 %122 %122
+        %159 = OpAccessChain %_ptr_Workgroup_float %m29 %127 %127
                OpStore %159 %float_1
-        %160 = OpAccessChain %_ptr_Workgroup_float %m35 %122 %122
+        %160 = OpAccessChain %_ptr_Workgroup_float %m30 %127 %127
                OpStore %160 %float_1
-        %161 = OpAccessChain %_ptr_Workgroup_float %m36 %122 %122
+        %161 = OpAccessChain %_ptr_Workgroup_float %m31 %127 %127
                OpStore %161 %float_1
-        %162 = OpAccessChain %_ptr_Workgroup_float %m37 %122 %122
+        %162 = OpAccessChain %_ptr_Workgroup_float %m32 %127 %127
                OpStore %162 %float_1
-        %163 = OpAccessChain %_ptr_Workgroup_float %m38 %122 %122
+        %163 = OpAccessChain %_ptr_Workgroup_float %m33 %127 %127
                OpStore %163 %float_1
-        %164 = OpAccessChain %_ptr_Workgroup_float %m39 %122 %122
+        %164 = OpAccessChain %_ptr_Workgroup_float %m34 %127 %127
                OpStore %164 %float_1
-        %165 = OpAccessChain %_ptr_Workgroup_float %m40 %122 %122
+        %165 = OpAccessChain %_ptr_Workgroup_float %m35 %127 %127
                OpStore %165 %float_1
-        %166 = OpAccessChain %_ptr_Workgroup_float %m41 %122 %122
+        %166 = OpAccessChain %_ptr_Workgroup_float %m36 %127 %127
                OpStore %166 %float_1
-        %167 = OpAccessChain %_ptr_Workgroup_float %m42 %122 %122
+        %167 = OpAccessChain %_ptr_Workgroup_float %m37 %127 %127
                OpStore %167 %float_1
-        %168 = OpAccessChain %_ptr_Workgroup_float %m43 %122 %122
+        %168 = OpAccessChain %_ptr_Workgroup_float %m38 %127 %127
                OpStore %168 %float_1
-        %169 = OpAccessChain %_ptr_Workgroup_float %m44 %122 %122
+        %169 = OpAccessChain %_ptr_Workgroup_float %m39 %127 %127
                OpStore %169 %float_1
-        %170 = OpAccessChain %_ptr_Workgroup_float %m45 %122 %122
+        %170 = OpAccessChain %_ptr_Workgroup_float %m40 %127 %127
                OpStore %170 %float_1
-        %171 = OpAccessChain %_ptr_Workgroup_float %m46 %122 %122
+        %171 = OpAccessChain %_ptr_Workgroup_float %m41 %127 %127
                OpStore %171 %float_1
-        %172 = OpAccessChain %_ptr_Workgroup_float %m47 %122 %122
+        %172 = OpAccessChain %_ptr_Workgroup_float %m42 %127 %127
                OpStore %172 %float_1
-        %173 = OpAccessChain %_ptr_Workgroup_float %m48 %122 %122
+        %173 = OpAccessChain %_ptr_Workgroup_float %m43 %127 %127
                OpStore %173 %float_1
-        %174 = OpAccessChain %_ptr_Workgroup_float %m49 %122 %122
+        %174 = OpAccessChain %_ptr_Workgroup_float %m44 %127 %127
                OpStore %174 %float_1
-        %175 = OpAccessChain %_ptr_Workgroup_float %m50 %122 %122
+        %175 = OpAccessChain %_ptr_Workgroup_float %m45 %127 %127
                OpStore %175 %float_1
-        %176 = OpAccessChain %_ptr_Workgroup_float %m51 %122 %122
+        %176 = OpAccessChain %_ptr_Workgroup_float %m46 %127 %127
                OpStore %176 %float_1
-        %177 = OpAccessChain %_ptr_Workgroup_float %m52 %122 %122
+        %177 = OpAccessChain %_ptr_Workgroup_float %m47 %127 %127
                OpStore %177 %float_1
-        %178 = OpAccessChain %_ptr_Workgroup_float %m53 %122 %122
+        %178 = OpAccessChain %_ptr_Workgroup_float %m48 %127 %127
                OpStore %178 %float_1
-        %179 = OpAccessChain %_ptr_Workgroup_float %m54 %122 %122
+        %179 = OpAccessChain %_ptr_Workgroup_float %m49 %127 %127
                OpStore %179 %float_1
-        %180 = OpAccessChain %_ptr_Workgroup_float %m55 %122 %122
+        %180 = OpAccessChain %_ptr_Workgroup_float %m50 %127 %127
                OpStore %180 %float_1
-        %181 = OpAccessChain %_ptr_Workgroup_float %m56 %122 %122
+        %181 = OpAccessChain %_ptr_Workgroup_float %m51 %127 %127
                OpStore %181 %float_1
-        %182 = OpAccessChain %_ptr_Workgroup_float %m57 %122 %122
+        %182 = OpAccessChain %_ptr_Workgroup_float %m52 %127 %127
                OpStore %182 %float_1
-        %183 = OpAccessChain %_ptr_Workgroup_float %m58 %122 %122
+        %183 = OpAccessChain %_ptr_Workgroup_float %m53 %127 %127
                OpStore %183 %float_1
-        %184 = OpAccessChain %_ptr_Workgroup_float %m59 %122 %122
+        %184 = OpAccessChain %_ptr_Workgroup_float %m54 %127 %127
                OpStore %184 %float_1
-        %185 = OpAccessChain %_ptr_Workgroup_float %m60 %122 %122
+        %185 = OpAccessChain %_ptr_Workgroup_float %m55 %127 %127
                OpStore %185 %float_1
-        %186 = OpAccessChain %_ptr_Workgroup_float %m61 %122 %122
+        %186 = OpAccessChain %_ptr_Workgroup_float %m56 %127 %127
                OpStore %186 %float_1
-        %187 = OpAccessChain %_ptr_Workgroup_float %m62 %122 %122
+        %187 = OpAccessChain %_ptr_Workgroup_float %m57 %127 %127
                OpStore %187 %float_1
-        %188 = OpAccessChain %_ptr_Workgroup_float %m63 %122 %122
+        %188 = OpAccessChain %_ptr_Workgroup_float %m58 %127 %127
                OpStore %188 %float_1
-        %189 = OpAccessChain %_ptr_Workgroup_float %m64 %122 %122
+        %189 = OpAccessChain %_ptr_Workgroup_float %m59 %127 %127
                OpStore %189 %float_1
-        %190 = OpAccessChain %_ptr_Workgroup_float %m65 %122 %122
+        %190 = OpAccessChain %_ptr_Workgroup_float %m60 %127 %127
                OpStore %190 %float_1
-        %191 = OpAccessChain %_ptr_Workgroup_float %m66 %122 %122
+        %191 = OpAccessChain %_ptr_Workgroup_float %m61 %127 %127
                OpStore %191 %float_1
-        %192 = OpAccessChain %_ptr_Workgroup_float %m67 %122 %122
+        %192 = OpAccessChain %_ptr_Workgroup_float %m62 %127 %127
                OpStore %192 %float_1
-        %193 = OpAccessChain %_ptr_Workgroup_float %m68 %122 %122
+        %193 = OpAccessChain %_ptr_Workgroup_float %m63 %127 %127
                OpStore %193 %float_1
-        %194 = OpAccessChain %_ptr_Workgroup_float %m69 %122 %122
+        %194 = OpAccessChain %_ptr_Workgroup_float %m64 %127 %127
                OpStore %194 %float_1
-        %195 = OpAccessChain %_ptr_Workgroup_float %m70 %122 %122
+        %195 = OpAccessChain %_ptr_Workgroup_float %m65 %127 %127
                OpStore %195 %float_1
-        %196 = OpAccessChain %_ptr_Workgroup_float %m71 %122 %122
+        %196 = OpAccessChain %_ptr_Workgroup_float %m66 %127 %127
                OpStore %196 %float_1
-        %197 = OpAccessChain %_ptr_Workgroup_float %m72 %122 %122
+        %197 = OpAccessChain %_ptr_Workgroup_float %m67 %127 %127
                OpStore %197 %float_1
-        %198 = OpAccessChain %_ptr_Workgroup_float %m73 %122 %122
+        %198 = OpAccessChain %_ptr_Workgroup_float %m68 %127 %127
                OpStore %198 %float_1
-        %199 = OpAccessChain %_ptr_Workgroup_float %m74 %122 %122
+        %199 = OpAccessChain %_ptr_Workgroup_float %m69 %127 %127
                OpStore %199 %float_1
-        %200 = OpAccessChain %_ptr_Workgroup_float %m75 %122 %122
+        %200 = OpAccessChain %_ptr_Workgroup_float %m70 %127 %127
                OpStore %200 %float_1
-        %201 = OpAccessChain %_ptr_Workgroup_float %m76 %122 %122
+        %201 = OpAccessChain %_ptr_Workgroup_float %m71 %127 %127
                OpStore %201 %float_1
-        %202 = OpAccessChain %_ptr_Workgroup_float %m77 %122 %122
+        %202 = OpAccessChain %_ptr_Workgroup_float %m72 %127 %127
                OpStore %202 %float_1
-        %203 = OpAccessChain %_ptr_Workgroup_float %m78 %122 %122
+        %203 = OpAccessChain %_ptr_Workgroup_float %m73 %127 %127
                OpStore %203 %float_1
-        %204 = OpAccessChain %_ptr_Workgroup_float %m79 %122 %122
+        %204 = OpAccessChain %_ptr_Workgroup_float %m74 %127 %127
                OpStore %204 %float_1
-        %205 = OpAccessChain %_ptr_Workgroup_float %m80 %122 %122
+        %205 = OpAccessChain %_ptr_Workgroup_float %m75 %127 %127
                OpStore %205 %float_1
-        %206 = OpAccessChain %_ptr_Workgroup_float %m81 %122 %122
+        %206 = OpAccessChain %_ptr_Workgroup_float %m76 %127 %127
                OpStore %206 %float_1
-        %207 = OpAccessChain %_ptr_Workgroup_float %m82 %122 %122
+        %207 = OpAccessChain %_ptr_Workgroup_float %m77 %127 %127
                OpStore %207 %float_1
-        %208 = OpAccessChain %_ptr_Workgroup_float %m83 %122 %122
+        %208 = OpAccessChain %_ptr_Workgroup_float %m78 %127 %127
                OpStore %208 %float_1
-        %209 = OpAccessChain %_ptr_Workgroup_float %m84 %122 %122
+        %209 = OpAccessChain %_ptr_Workgroup_float %m79 %127 %127
                OpStore %209 %float_1
-        %210 = OpAccessChain %_ptr_Workgroup_float %m85 %122 %122
+        %210 = OpAccessChain %_ptr_Workgroup_float %m80 %127 %127
                OpStore %210 %float_1
-        %211 = OpAccessChain %_ptr_Workgroup_float %m86 %122 %122
+        %211 = OpAccessChain %_ptr_Workgroup_float %m81 %127 %127
                OpStore %211 %float_1
-        %212 = OpAccessChain %_ptr_Workgroup_float %m87 %122 %122
+        %212 = OpAccessChain %_ptr_Workgroup_float %m82 %127 %127
                OpStore %212 %float_1
-        %213 = OpAccessChain %_ptr_Workgroup_float %m88 %122 %122
+        %213 = OpAccessChain %_ptr_Workgroup_float %m83 %127 %127
                OpStore %213 %float_1
-        %214 = OpAccessChain %_ptr_Workgroup_float %m89 %122 %122
+        %214 = OpAccessChain %_ptr_Workgroup_float %m84 %127 %127
                OpStore %214 %float_1
-        %215 = OpAccessChain %_ptr_Workgroup_float %m90 %122 %122
+        %215 = OpAccessChain %_ptr_Workgroup_float %m85 %127 %127
                OpStore %215 %float_1
-        %216 = OpAccessChain %_ptr_Workgroup_float %m91 %122 %122
+        %216 = OpAccessChain %_ptr_Workgroup_float %m86 %127 %127
                OpStore %216 %float_1
-        %217 = OpAccessChain %_ptr_Workgroup_float %m92 %122 %122
+        %217 = OpAccessChain %_ptr_Workgroup_float %m87 %127 %127
                OpStore %217 %float_1
-        %218 = OpAccessChain %_ptr_Workgroup_float %m93 %122 %122
+        %218 = OpAccessChain %_ptr_Workgroup_float %m88 %127 %127
                OpStore %218 %float_1
-        %219 = OpAccessChain %_ptr_Workgroup_float %m94 %122 %122
+        %219 = OpAccessChain %_ptr_Workgroup_float %m89 %127 %127
                OpStore %219 %float_1
-        %220 = OpAccessChain %_ptr_Workgroup_float %m95 %122 %122
+        %220 = OpAccessChain %_ptr_Workgroup_float %m90 %127 %127
                OpStore %220 %float_1
-        %221 = OpAccessChain %_ptr_Workgroup_float %m96 %122 %122
+        %221 = OpAccessChain %_ptr_Workgroup_float %m91 %127 %127
                OpStore %221 %float_1
-        %222 = OpAccessChain %_ptr_Workgroup_float %m97 %122 %122
+        %222 = OpAccessChain %_ptr_Workgroup_float %m92 %127 %127
                OpStore %222 %float_1
-        %223 = OpAccessChain %_ptr_Workgroup_float %m98 %122 %122
+        %223 = OpAccessChain %_ptr_Workgroup_float %m93 %127 %127
                OpStore %223 %float_1
-        %224 = OpAccessChain %_ptr_Workgroup_float %m99 %122 %122
+        %224 = OpAccessChain %_ptr_Workgroup_float %m94 %127 %127
                OpStore %224 %float_1
+        %225 = OpAccessChain %_ptr_Workgroup_float %m95 %127 %127
+               OpStore %225 %float_1
+        %226 = OpAccessChain %_ptr_Workgroup_float %m96 %127 %127
+               OpStore %226 %float_1
+        %227 = OpAccessChain %_ptr_Workgroup_float %m97 %127 %127
+               OpStore %227 %float_1
+        %228 = OpAccessChain %_ptr_Workgroup_float %m98 %127 %127
+               OpStore %228 %float_1
+        %229 = OpAccessChain %_ptr_Workgroup_float %m99 %127 %127
+               OpStore %229 %float_1
                OpReturn
                OpFunctionEnd
-%tint_symbol = OpFunction %void None %225
-        %227 = OpLabel
-        %229 = OpLoad %uint %idx_1
-        %228 = OpFunctionCall %void %tint_symbol_inner %229
+%tint_symbol = OpFunction %void None %230
+        %232 = OpLabel
+        %234 = OpLoad %uint %idx_1
+        %233 = OpFunctionCall %void %tint_symbol_inner %234
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/var/uses/workgroup.wgsl.expected.dxc.hlsl b/test/tint/var/uses/workgroup.wgsl.expected.dxc.hlsl
index 6e5982e..527de93 100644
--- a/test/tint/var/uses/workgroup.wgsl.expected.dxc.hlsl
+++ b/test/tint/var/uses/workgroup.wgsl.expected.dxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int a;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     a = 0;
   }
   GroupMemoryBarrierWithGroupSync();
@@ -10,14 +10,14 @@
 groupshared int b;
 
 void tint_zero_workgroup_memory_1(uint local_idx_1) {
-  {
+  if ((local_idx_1 < 1u)) {
     b = 0;
   }
   GroupMemoryBarrierWithGroupSync();
 }
 
 void tint_zero_workgroup_memory_2(uint local_idx_2) {
-  {
+  if ((local_idx_2 < 1u)) {
     a = 0;
     b = 0;
   }
diff --git a/test/tint/var/uses/workgroup.wgsl.expected.fxc.hlsl b/test/tint/var/uses/workgroup.wgsl.expected.fxc.hlsl
index 6e5982e..527de93 100644
--- a/test/tint/var/uses/workgroup.wgsl.expected.fxc.hlsl
+++ b/test/tint/var/uses/workgroup.wgsl.expected.fxc.hlsl
@@ -1,7 +1,7 @@
 groupshared int a;
 
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     a = 0;
   }
   GroupMemoryBarrierWithGroupSync();
@@ -10,14 +10,14 @@
 groupshared int b;
 
 void tint_zero_workgroup_memory_1(uint local_idx_1) {
-  {
+  if ((local_idx_1 < 1u)) {
     b = 0;
   }
   GroupMemoryBarrierWithGroupSync();
 }
 
 void tint_zero_workgroup_memory_2(uint local_idx_2) {
-  {
+  if ((local_idx_2 < 1u)) {
     a = 0;
     b = 0;
   }
diff --git a/test/tint/var/uses/workgroup.wgsl.expected.glsl b/test/tint/var/uses/workgroup.wgsl.expected.glsl
index 47fd28b..7dddf40 100644
--- a/test/tint/var/uses/workgroup.wgsl.expected.glsl
+++ b/test/tint/var/uses/workgroup.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 
 shared int a;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     a = 0;
   }
   barrier();
@@ -27,7 +27,7 @@
 
 shared int b;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     b = 0;
   }
   barrier();
@@ -53,7 +53,7 @@
 shared int a;
 shared int b;
 void tint_zero_workgroup_memory(uint local_idx) {
-  {
+  if ((local_idx < 1u)) {
     a = 0;
     b = 0;
   }
diff --git a/test/tint/var/uses/workgroup.wgsl.expected.msl b/test/tint/var/uses/workgroup.wgsl.expected.msl
index f2abad3..c1f1eb1 100644
--- a/test/tint/var/uses/workgroup.wgsl.expected.msl
+++ b/test/tint/var/uses/workgroup.wgsl.expected.msl
@@ -2,21 +2,21 @@
 
 using namespace metal;
 void tint_zero_workgroup_memory(uint local_idx, threadgroup int* const tint_symbol) {
-  {
+  if ((local_idx < 1u)) {
     *(tint_symbol) = 0;
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
 }
 
 void tint_zero_workgroup_memory_1(uint local_idx_1, threadgroup int* const tint_symbol_1) {
-  {
+  if ((local_idx_1 < 1u)) {
     *(tint_symbol_1) = 0;
   }
   threadgroup_barrier(mem_flags::mem_threadgroup);
 }
 
 void tint_zero_workgroup_memory_2(uint local_idx_2, threadgroup int* const tint_symbol_2, threadgroup int* const tint_symbol_3) {
-  {
+  if ((local_idx_2 < 1u)) {
     *(tint_symbol_2) = 0;
     *(tint_symbol_3) = 0;
   }
diff --git a/test/tint/var/uses/workgroup.wgsl.expected.spvasm b/test/tint/var/uses/workgroup.wgsl.expected.spvasm
index 77824a8..5f4d102 100644
--- a/test/tint/var/uses/workgroup.wgsl.expected.spvasm
+++ b/test/tint/var/uses/workgroup.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 83
+; Bound: 94
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -55,10 +55,12 @@
           %c = OpVariable %_ptr_Workgroup_int Workgroup
        %void = OpTypeVoid
          %11 = OpTypeFunction %void %uint
-         %16 = OpConstantNull %int
+     %uint_1 = OpConstant %uint 1
+       %bool = OpTypeBool
+         %21 = OpConstantNull %int
      %uint_2 = OpConstant %uint 2
    %uint_264 = OpConstant %uint 264
-         %28 = OpTypeFunction %void
+         %39 = OpTypeFunction %void
       %int_1 = OpConstant %int 1
       %int_2 = OpConstant %int 2
      %int_42 = OpConstant %int 42
@@ -66,102 +68,120 @@
 %tint_zero_workgroup_memory = OpFunction %void None %11
   %local_idx = OpFunctionParameter %uint
          %15 = OpLabel
-               OpStore %a %16
+         %17 = OpULessThan %bool %local_idx %uint_1
+               OpSelectionMerge %19 None
+               OpBranchConditional %17 %20 %19
+         %20 = OpLabel
+               OpStore %a %21
+               OpBranch %19
+         %19 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
 %tint_zero_workgroup_memory_1 = OpFunction %void None %11
 %local_idx_1 = OpFunctionParameter %uint
-         %22 = OpLabel
-               OpStore %b %16
+         %27 = OpLabel
+         %28 = OpULessThan %bool %local_idx_1 %uint_1
+               OpSelectionMerge %29 None
+               OpBranchConditional %28 %30 %29
+         %30 = OpLabel
+               OpStore %b %21
+               OpBranch %29
+         %29 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
 %tint_zero_workgroup_memory_2 = OpFunction %void None %11
 %local_idx_2 = OpFunctionParameter %uint
-         %26 = OpLabel
-               OpStore %a %16
-               OpStore %b %16
+         %34 = OpLabel
+         %35 = OpULessThan %bool %local_idx_2 %uint_1
+               OpSelectionMerge %36 None
+               OpBranchConditional %35 %37 %36
+         %37 = OpLabel
+               OpStore %a %21
+               OpStore %b %21
+               OpBranch %36
+         %36 = OpLabel
                OpControlBarrier %uint_2 %uint_2 %uint_264
                OpReturn
                OpFunctionEnd
-     %uses_a = OpFunction %void None %28
-         %30 = OpLabel
-         %31 = OpLoad %int %a
-         %33 = OpIAdd %int %31 %int_1
-               OpStore %a %33
+     %uses_a = OpFunction %void None %39
+         %41 = OpLabel
+         %42 = OpLoad %int %a
+         %44 = OpIAdd %int %42 %int_1
+               OpStore %a %44
                OpReturn
                OpFunctionEnd
-     %uses_b = OpFunction %void None %28
-         %35 = OpLabel
-         %36 = OpLoad %int %b
-         %38 = OpIMul %int %36 %int_2
-               OpStore %b %38
+     %uses_b = OpFunction %void None %39
+         %46 = OpLabel
+         %47 = OpLoad %int %b
+         %49 = OpIMul %int %47 %int_2
+               OpStore %b %49
                OpReturn
                OpFunctionEnd
-%uses_a_and_b = OpFunction %void None %28
-         %40 = OpLabel
-         %41 = OpLoad %int %a
-               OpStore %b %41
+%uses_a_and_b = OpFunction %void None %39
+         %51 = OpLabel
+         %52 = OpLoad %int %a
+               OpStore %b %52
                OpReturn
                OpFunctionEnd
-    %no_uses = OpFunction %void None %28
-         %43 = OpLabel
+    %no_uses = OpFunction %void None %39
+         %54 = OpLabel
                OpReturn
                OpFunctionEnd
-      %outer = OpFunction %void None %28
-         %45 = OpLabel
-               OpStore %a %16
-         %46 = OpFunctionCall %void %uses_a
-         %47 = OpFunctionCall %void %uses_a_and_b
-         %48 = OpFunctionCall %void %uses_b
-         %49 = OpFunctionCall %void %no_uses
+      %outer = OpFunction %void None %39
+         %56 = OpLabel
+               OpStore %a %21
+         %57 = OpFunctionCall %void %uses_a
+         %58 = OpFunctionCall %void %uses_a_and_b
+         %59 = OpFunctionCall %void %uses_b
+         %60 = OpFunctionCall %void %no_uses
                OpReturn
                OpFunctionEnd
 %main1_inner = OpFunction %void None %11
 %local_invocation_index = OpFunctionParameter %uint
-         %52 = OpLabel
-         %53 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
+         %63 = OpLabel
+         %64 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index
                OpStore %a %int_42
-         %55 = OpFunctionCall %void %uses_a
+         %66 = OpFunctionCall %void %uses_a
                OpReturn
                OpFunctionEnd
-      %main1 = OpFunction %void None %28
-         %57 = OpLabel
-         %59 = OpLoad %uint %local_invocation_index_3
-         %58 = OpFunctionCall %void %main1_inner %59
+      %main1 = OpFunction %void None %39
+         %68 = OpLabel
+         %70 = OpLoad %uint %local_invocation_index_3
+         %69 = OpFunctionCall %void %main1_inner %70
                OpReturn
                OpFunctionEnd
 %main2_inner = OpFunction %void None %11
 %local_invocation_index_1 = OpFunctionParameter %uint
-         %62 = OpLabel
-         %63 = OpFunctionCall %void %tint_zero_workgroup_memory_1 %local_invocation_index_1
+         %73 = OpLabel
+         %74 = OpFunctionCall %void %tint_zero_workgroup_memory_1 %local_invocation_index_1
                OpStore %b %int_7
-         %65 = OpFunctionCall %void %uses_b
+         %76 = OpFunctionCall %void %uses_b
                OpReturn
                OpFunctionEnd
-      %main2 = OpFunction %void None %28
-         %67 = OpLabel
-         %69 = OpLoad %uint %local_invocation_index_1_1
-         %68 = OpFunctionCall %void %main2_inner %69
+      %main2 = OpFunction %void None %39
+         %78 = OpLabel
+         %80 = OpLoad %uint %local_invocation_index_1_1
+         %79 = OpFunctionCall %void %main2_inner %80
                OpReturn
                OpFunctionEnd
 %main3_inner = OpFunction %void None %11
 %local_invocation_index_2 = OpFunctionParameter %uint
-         %72 = OpLabel
-         %73 = OpFunctionCall %void %tint_zero_workgroup_memory_2 %local_invocation_index_2
-         %74 = OpFunctionCall %void %outer
-         %75 = OpFunctionCall %void %no_uses
+         %83 = OpLabel
+         %84 = OpFunctionCall %void %tint_zero_workgroup_memory_2 %local_invocation_index_2
+         %85 = OpFunctionCall %void %outer
+         %86 = OpFunctionCall %void %no_uses
                OpReturn
                OpFunctionEnd
-      %main3 = OpFunction %void None %28
-         %77 = OpLabel
-         %79 = OpLoad %uint %local_invocation_index_2_1
-         %78 = OpFunctionCall %void %main3_inner %79
+      %main3 = OpFunction %void None %39
+         %88 = OpLabel
+         %90 = OpLoad %uint %local_invocation_index_2_1
+         %89 = OpFunctionCall %void %main3_inner %90
                OpReturn
                OpFunctionEnd
-      %main4 = OpFunction %void None %28
-         %81 = OpLabel
-         %82 = OpFunctionCall %void %no_uses
+      %main4 = OpFunction %void None %39
+         %92 = OpLabel
+         %93 = OpFunctionCall %void %no_uses
                OpReturn
                OpFunctionEnd