Instrument: Change output buffer offset definitions (#4961)

Add a flags field at the first offset within this buffer.
Define flags to allow buffer OOB checking to be enabled or
disabled at run time. This is to support VK_EXT_pipeline_robustnes.
diff --git a/include/spirv-tools/instrument.hpp b/include/spirv-tools/instrument.hpp
index a19491f..a75561b 100644
--- a/include/spirv-tools/instrument.hpp
+++ b/include/spirv-tools/instrument.hpp
@@ -36,16 +36,25 @@
 // generated by InstrumentPass::GenDebugStreamWrite. This method is utilized
 // by InstBindlessCheckPass, InstBuffAddrCheckPass, and InstDebugPrintfPass.
 //
-// The first member of the debug output buffer contains the next available word
+// The 1st member of the debug output buffer contains a set of flags
+// controlling the behavior of instrumentation code.
+static const int kDebugOutputFlagsOffset = 0;
+
+// Values stored at kDebugOutputFlagsOffset
+enum kInstFlags : unsigned int {
+  kInstBufferOOBEnable = 0x1,
+};
+
+// The 2nd member of the debug output buffer contains the next available word
 // in the data stream to be written. Shaders will atomically read and update
 // this value so as not to overwrite each others records. This value must be
 // initialized to zero
-static const int kDebugOutputSizeOffset = 0;
+static const int kDebugOutputSizeOffset = 1;
 
-// The second member of the output buffer is the start of the stream of records
+// The 3rd member of the output buffer is the start of the stream of records
 // written by the instrumented shaders. Each record represents a validation
 // error. The format of the records is documented below.
-static const int kDebugOutputDataOffset = 1;
+static const int kDebugOutputDataOffset = 2;
 
 // Common Stream Record Offsets
 //
diff --git a/source/opt/instrument_pass.cpp b/source/opt/instrument_pass.cpp
index cf3f629..88fa5e1 100644
--- a/source/opt/instrument_pass.cpp
+++ b/source/opt/instrument_pass.cpp
@@ -554,7 +554,7 @@
     analysis::Type* reg_uint_rarr_ty = GetUintRuntimeArrayType(32);
     analysis::Integer uint_ty(32, false);
     analysis::Type* reg_uint_ty = type_mgr->GetRegisteredType(&uint_ty);
-    analysis::Struct buf_ty({reg_uint_ty, reg_uint_rarr_ty});
+    analysis::Struct buf_ty({reg_uint_ty, reg_uint_ty, reg_uint_rarr_ty});
     analysis::Type* reg_buf_ty = type_mgr->GetRegisteredType(&buf_ty);
     uint32_t obufTyId = type_mgr->GetTypeInstruction(reg_buf_ty);
     // By the Vulkan spec, a pre-existing struct containing a RuntimeArray
@@ -566,10 +566,12 @@
     assert(context()->get_def_use_mgr()->NumUses(obufTyId) == 0 &&
            "used struct type returned");
     deco_mgr->AddDecoration(obufTyId, uint32_t(spv::Decoration::Block));
-    deco_mgr->AddMemberDecoration(obufTyId, kDebugOutputSizeOffset,
+    deco_mgr->AddMemberDecoration(obufTyId, kDebugOutputFlagsOffset,
                                   uint32_t(spv::Decoration::Offset), 0);
-    deco_mgr->AddMemberDecoration(obufTyId, kDebugOutputDataOffset,
+    deco_mgr->AddMemberDecoration(obufTyId, kDebugOutputSizeOffset,
                                   uint32_t(spv::Decoration::Offset), 4);
+    deco_mgr->AddMemberDecoration(obufTyId, kDebugOutputDataOffset,
+                                  uint32_t(spv::Decoration::Offset), 8);
     uint32_t obufTyPtrId_ =
         type_mgr->FindPointerToType(obufTyId, spv::StorageClass::StorageBuffer);
     output_buffer_id_ = TakeNextId();
@@ -579,8 +581,9 @@
           {uint32_t(spv::StorageClass::StorageBuffer)}}}));
     context()->AddGlobalValue(std::move(newVarOp));
     context()->AddDebug2Inst(NewGlobalName(obufTyId, "OutputBuffer"));
-    context()->AddDebug2Inst(NewMemberName(obufTyId, 0, "written_count"));
-    context()->AddDebug2Inst(NewMemberName(obufTyId, 1, "data"));
+    context()->AddDebug2Inst(NewMemberName(obufTyId, 0, "flags"));
+    context()->AddDebug2Inst(NewMemberName(obufTyId, 1, "written_count"));
+    context()->AddDebug2Inst(NewMemberName(obufTyId, 2, "data"));
     context()->AddDebug2Inst(NewGlobalName(output_buffer_id_, "output_buffer"));
     deco_mgr->AddDecorationVal(
         output_buffer_id_, uint32_t(spv::Decoration::DescriptorSet), desc_set_);
diff --git a/test/opt/inst_bindless_check_test.cpp b/test/opt/inst_bindless_check_test.cpp
index 90f40bc..4f4b668 100644
--- a/test/opt/inst_bindless_check_test.cpp
+++ b/test/opt/inst_bindless_check_test.cpp
@@ -37,7 +37,7 @@
 )";
 
 static const std::string kOutputGlobals = R"(
-; CHECK: [[output_buffer_type]] = OpTypeStruct %uint %_runtimearr_uint
+; CHECK: [[output_buffer_type]] = OpTypeStruct %uint %uint %_runtimearr_uint
 ; CHECK: [[output_ptr_type:%\w+]] = OpTypePointer StorageBuffer [[output_buffer_type]]
 ; CHECK: [[output_buffer_var]] = OpVariable [[output_ptr_type]] StorageBuffer
 )";
@@ -49,34 +49,34 @@
 ; CHECK: [[param_3:%\w+]] = OpFunctionParameter %uint
 ; CHECK: [[param_4:%\w+]] = OpFunctionParameter %uint
 ; CHECK: {{%\w+}} = OpLabel
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_0
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1
 ; CHECK: {{%\w+}} = OpAtomicIAdd %uint {{%\w+}} %uint_4 %uint_0 %uint_10
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_10
-; CHECK: {{%\w+}} = OpArrayLength %uint [[output_buffer_var]] 1
+; CHECK: {{%\w+}} = OpArrayLength %uint [[output_buffer_var]] 2
 ; CHECK: {{%\w+}} = OpULessThanEqual %bool {{%\w+}} {{%\w+}}
 ; CHECK: OpSelectionMerge {{%\w+}} None
 ; CHECK: OpBranchConditional {{%\w+}} {{%\w+}} {{%\w+}}
 ; CHECK: {{%\w+}} = OpLabel
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_0
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} %uint_10
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_1
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} %uint_23
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_2
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} [[param_1]]
 )";
 
 static const std::string kStreamWrite4End = R"(
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_7
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} [[param_2]]
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_8
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} [[param_3]]
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_9
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} [[param_4]]
 ; CHECK: OpBranch {{%\w+}}
 ; CHECK: {{%\w+}} = OpLabel
@@ -87,89 +87,89 @@
 // clang-format off
 static const std::string kStreamWrite4Frag = kStreamWrite4Begin + R"(
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_3
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} %uint_4
 ; CHECK: {{%\w+}} = OpLoad %v4float %gl_FragCoord
 ; CHECK: {{%\w+}} = OpBitcast %v4uint {{%\w+}}
 ; CHECK: {{%\w+}} = OpCompositeExtract %uint {{%\w+}} 0
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_4
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 ; CHECK: {{%\w+}} = OpCompositeExtract %uint {{%\w+}} 1
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_5
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 )" + kStreamWrite4End;
 
 static const std::string kStreamWrite4Tese = kStreamWrite4Begin + R"(
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_3
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} %uint_2
 ; CHECK: {{%\w+}} = OpLoad %uint %gl_PrimitiveID
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_4
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 ; CHECK: {{%\w+}} = OpLoad %v3float %gl_TessCoord
 ; CHECK: {{%\w+}} = OpBitcast %v3uint {{%\w+}}
 ; CHECK: {{%\w+}} = OpCompositeExtract %uint {{%\w+}} 0
 ; CHECK: {{%\w+}} = OpCompositeExtract %uint {{%\w+}} 1
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_5
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_6
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 )" + kStreamWrite4End;
 
 static const std::string kStreamWrite4Vert = kStreamWrite4Begin + R"(
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_3
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} %uint_0
 ; CHECK: {{%\w+}} = OpLoad %uint %gl_VertexIndex
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_4
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 ; CHECK: {{%\w+}} = OpLoad %uint %gl_InstanceIndex
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_5
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 )" + kStreamWrite4End;
 
 static const std::string kStreamWrite4Compute = kStreamWrite4Begin + R"(
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_3
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} %uint_5
 ; CHECK: {{%\w+}} = OpLoad %v3uint %gl_GlobalInvocationID
 ; CHECK: {{%\w+}} = OpCompositeExtract %uint {{%\w+}} 0
 ; CHECK: {{%\w+}} = OpCompositeExtract %uint {{%\w+}} 1
 ; CHECK: {{%\w+}} = OpCompositeExtract %uint {{%\w+}} 2
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_4
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_5
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_6
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 )" + kStreamWrite4End;
 
 static const std::string kStreamWrite4Ray = kStreamWrite4Begin + R"(
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_3
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 ; CHECK: {{%\w+}} = OpLoad %v3uint {{%\w+}}
 ; CHECK: {{%\w+}} = OpCompositeExtract %uint %90 0
 ; CHECK: {{%\w+}} = OpCompositeExtract %uint %90 1
 ; CHECK: {{%\w+}} = OpCompositeExtract %uint %90 2
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_4
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_5
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_6
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 )" + kStreamWrite4End;
 // clang-format on
@@ -182,37 +182,37 @@
 ; CHECK: [[param_4:%\w+]] = OpFunctionParameter %uint
 ; CHECK: [[param_5:%\w+]] = OpFunctionParameter %uint
 ; CHECK: {{%\w+}} = OpLabel
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_0
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1
 ; CHECK: {{%\w+}} = OpAtomicIAdd %uint {{%\w+}} %uint_4 %uint_0 %uint_11
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_11
-; CHECK: {{%\w+}} = OpArrayLength %uint [[output_buffer_var]] 1
+; CHECK: {{%\w+}} = OpArrayLength %uint [[output_buffer_var]] 2
 ; CHECK: {{%\w+}} = OpULessThanEqual %bool {{%\w+}} {{%\w+}}
 ; CHECK: OpSelectionMerge {{%\w+}} None
 ; CHECK: OpBranchConditional {{%\w+}} {{%\w+}} {{%\w+}}
 ; CHECK: {{%\w+}} = OpLabel
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_0
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} %uint_11
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_1
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} %uint_23
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_2
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} [[param_1]]
 )";
 
 static const std::string kStreamWrite5End = R"(
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_7
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} [[param_2]]
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_8
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} [[param_3]]
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_9
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} [[param_4]]
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_10
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} [[param_5]]
 ; CHECK: OpBranch {{%\w+}}
 ; CHECK: {{%\w+}} = OpLabel
@@ -223,31 +223,31 @@
 // clang-format off
 static const std::string kStreamWrite5Frag = kStreamWrite5Begin + R"(
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_3
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} %uint_4
 ; CHECK: {{%\w+}} = OpLoad %v4float %gl_FragCoord
 ; CHECK: {{%\w+}} = OpBitcast %v4uint {{%\w+}}
 ; CHECK: {{%\w+}} = OpCompositeExtract %uint {{%\w+}} 0
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_4
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 ; CHECK: {{%\w+}} = OpCompositeExtract %uint {{%\w+}} 1
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_5
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 )" + kStreamWrite4End;
 
 static const std::string kStreamWrite5Vert = kStreamWrite5Begin + R"(
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_3
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} %uint_0
 ; CHECK: {{%\w+}} = OpLoad %uint %gl_VertexIndex
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_4
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 ; CHECK: {{%\w+}} = OpLoad %uint %gl_InstanceIndex
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_5
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 )" + kStreamWrite5End;
 // clang-format on
@@ -566,26 +566,14 @@
 %i_vTextureCoords = OpVariable %_ptr_Input_v2float Input
 %_ptr_Output_v4float = OpTypePointer Output %v4float
 %_entryPointOutput_vColor = OpVariable %_ptr_Output_v4float Output
-; CHECK: %uint_0 = OpConstant %uint 0
 ; CHECK: %bool = OpTypeBool
 ; CHECK: %48 = OpTypeFunction %void %uint %uint %uint %uint
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kOutputGlobals + R"(
 ; CHECK: %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_1 = OpConstant %uint 1
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %_ptr_Input_v4float = OpTypePointer Input %v4float
 ; CHECK: %gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ; CHECK: %v4uint = OpTypeVector %uint 4
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_56 = OpConstant %uint 56
 ; CHECK: %103 = OpConstantNull %v4float
 )";
   // clang-format on
@@ -717,28 +705,15 @@
 %i_vTextureCoords = OpVariable %_ptr_Input_v2float Input
 %_ptr_Output_v4float = OpTypePointer Output %v4float
 %_entryPointOutput_vColor = OpVariable %_ptr_Output_v4float Output
-; CHECK: %uint_0 = OpConstant %uint 0
 ; CHECK: %bool = OpTypeBool
 ; CHECK: %56 = OpTypeFunction %void %uint %uint %uint %uint
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kOutputGlobals + R"(
 ; CHECK: %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_1 = OpConstant %uint 1
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %_ptr_Input_v4float = OpTypePointer Input %v4float
 ; CHECK: %gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ; CHECK: %v4uint = OpTypeVector %uint 4
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_58 = OpConstant %uint 58
 ; CHECK: %111 = OpConstantNull %v4float
-; CHECK: %uint_64 = OpConstant %uint 64
 )";
   // clang-format on
 
@@ -864,20 +839,9 @@
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kOutputGlobals + R"(
 ; CHECK: %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_1 = OpConstant %uint 1
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %_ptr_Input_v4float = OpTypePointer Input %v4float
 ; CHECK: %gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ; CHECK: %v4uint = OpTypeVector %uint 4
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_51 = OpConstant %uint 51
 ; CHECK: %141 = OpConstantNull %v4float
 )";
   // clang-format on
@@ -980,20 +944,9 @@
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kOutputGlobals + R"(
 ; CHECK: %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_1 = OpConstant %uint 1
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %_ptr_Input_v4float = OpTypePointer Input %v4float
 ; CHECK: %gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ; CHECK: %v4uint = OpTypeVector %uint 4
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_49 = OpConstant %uint 49
 ; CHECK: %136 = OpConstantNull %v4float
 )";
   // clang-format on
@@ -1097,20 +1050,9 @@
 ; CHECK: _runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kOutputGlobals + R"(
 ; CHECK: %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_1 = OpConstant %uint 1
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %_ptr_Input_v4float = OpTypePointer Input %v4float
 ; CHECK: %gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ; CHECK: %v4uint = OpTypeVector %uint 4
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_51 = OpConstant %uint 51
 )";
   // clang-format on
 
@@ -1224,25 +1166,14 @@
 %v2float = OpTypeVector %float 2
 %_ptr_Input_v2float = OpTypePointer Input %v2float
 %coords2D = OpVariable %_ptr_Input_v2float Input
-; CHECK: %uint_0 = OpConstant %uint 0
 ; CHECK: %bool = OpTypeBool
 ; CHECK: %54 = OpTypeFunction %void %uint %uint %uint %uint
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kOutputGlobals + R"(
 ; CHECK: %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %_ptr_Input_uint = OpTypePointer Input %uint
 ; CHECK: %gl_VertexIndex = OpVariable %_ptr_Input_uint Input
 ; CHECK: %gl_InstanceIndex = OpVariable %_ptr_Input_uint Input
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_74 = OpConstant %uint 74
 ; CHECK: %106 = OpConstantNull %v4float
 )";
   // clang-format on
@@ -1377,29 +1308,17 @@
 %_ptr_Uniform_uint = OpTypePointer Uniform %uint
 %_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
 %_ptr_Output_v4float = OpTypePointer Output %v4float
-; CHECK: %uint_0 = OpConstant %uint 0
 ; CHECK: %bool = OpTypeBool
 ; CHECK: %40 = OpTypeFunction %void %uint %uint %uint %uint
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kOutputGlobals + R"(
 ; CHECK: %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %_ptr_Input_uint = OpTypePointer Input %uint
 ; CHECK: %gl_PrimitiveID = OpVariable %_ptr_Input_uint Input
 ; CHECK: %v3float = OpTypeVector %float 3
 ; CHECK: %_ptr_Input_v3float = OpTypePointer Input %v3float
 ; CHECK: %gl_TessCoord = OpVariable %_ptr_Input_v3float Input
 ; CHECK: %v3uint = OpTypeVector %uint 3
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_6 = OpConstant %uint 6
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_63 = OpConstant %uint 63
 ; CHECK: %101 = OpConstantNull %v4float
 )";
   // clang-format on
@@ -1515,26 +1434,14 @@
 %i_vTextureCoords = OpVariable %_ptr_Input_v2float Input
 %_ptr_Output_v4float = OpTypePointer Output %v4float
 %_entryPointOutput_vColor = OpVariable %_ptr_Output_v4float Output
-; CHECK: %uint_0 = OpConstant %uint 0
 ; CHECK: %bool = OpTypeBool
 ; CHECK: %70 = OpTypeFunction %void %uint %uint %uint %uint
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kOutputGlobals + R"(
 ; CHECK: %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_1 = OpConstant %uint 1
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %_ptr_Input_v4float = OpTypePointer Input %v4float
 ; CHECK: %gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ; CHECK: %v4uint = OpTypeVector %uint 4
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_109 = OpConstant %uint 109
 ; CHECK: %125 = OpConstantNull %v4float
 )";
   // clang-format on
@@ -1668,8 +1575,6 @@
 %i_vTextureCoords = OpVariable %_ptr_Input_v2float Input
 %_ptr_Output_v4float = OpTypePointer Output %v4float
 %_entryPointOutput_vColor = OpVariable %_ptr_Output_v4float Output
-; CHECK: %uint_0 = OpConstant %uint 0
-; CHECK: %uint_2 = OpConstant %uint 2
 ; CHECK: %41 = OpTypeFunction %uint %uint %uint
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kInputGlobals + R"(
@@ -1677,18 +1582,9 @@
 ; CHECK: %bool = OpTypeBool
 ; CHECK: %65 = OpTypeFunction %void %uint %uint %uint %uint
 )" + kOutputGlobals + R"(
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %_ptr_Input_v4float = OpTypePointer Input %v4float
 ; CHECK: %gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ; CHECK: %v4uint = OpTypeVector %uint 4
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_59 = OpConstant %uint 59
 ; CHECK: %116 = OpConstantNull %v4float
 ; CHECK: %119 = OpTypeFunction %uint %uint %uint %uint %uint
 )";
@@ -1797,28 +1693,16 @@
 %_ptr_Output_v4float = OpTypePointer Output %v4float
 %_entryPointOutput_vColor = OpVariable %_ptr_Output_v4float Output
 ; CHECK: %uint = OpTypeInt 32 0
-; CHECK: %uint_0 = OpConstant %uint 0
 ; CHECK: %28 = OpTypeFunction %uint %uint %uint %uint %uint
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kInputGlobals + R"(
 ; CHECK: %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 ; CHECK: %bool = OpTypeBool
-; CHECK: %uint_1 = OpConstant %uint 1
 ; CHECK: %61 = OpTypeFunction %void %uint %uint %uint %uint
 )" + kOutputGlobals + R"(
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %_ptr_Input_v4float = OpTypePointer Input %v4float
 ; CHECK: %gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ; CHECK: %v4uint = OpTypeVector %uint 4
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_39 = OpConstant %uint 39
 ; CHECK: %113 = OpConstantNull %v4float
 )";
   // clang-format on
@@ -2043,9 +1927,6 @@
 %int_0 = OpConstant %int 0
 %_ptr_Uniform_float = OpTypePointer Uniform %float
 ; CHECK: %uint = OpTypeInt 32 0
-; CHECK: %uint_0 = OpConstant %uint 0
-; CHECK: %uint_1 = OpConstant %uint 1
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %26 = OpTypeFunction %uint %uint %uint
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kInputGlobals + R"(
@@ -2053,19 +1934,10 @@
 ; CHECK: %bool = OpTypeBool
 ; CHECK: %49 = OpTypeFunction %void %uint %uint %uint %uint
 )" + kOutputGlobals + R"(
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
 ; CHECK: %v4float = OpTypeVector %float 4
 ; CHECK: %_ptr_Input_v4float = OpTypePointer Input %v4float
 ; CHECK: %gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ; CHECK: %v4uint = OpTypeVector %uint 4
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_45 = OpConstant %uint 45
 ; CHECK: %101 = OpConstantNull %float
 ; CHECK: %105 = OpTypeFunction %uint %uint %uint %uint %uint
 )";
@@ -2185,9 +2057,6 @@
 %int_0 = OpConstant %int 0
 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
 ; CHECK: %uint = OpTypeInt 32 0
-; CHECK: %uint_0 = OpConstant %uint 0
-; CHECK: %uint_1 = OpConstant %uint 1
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %26 = OpTypeFunction %uint %uint %uint
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kInputGlobals + R"(
@@ -2195,19 +2064,10 @@
 ; CHECK: %bool = OpTypeBool
 ; CHECK: %49 = OpTypeFunction %void %uint %uint %uint %uint
 )" + kOutputGlobals + R"(
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
 ; CHECK: %v4float = OpTypeVector %float 4
 ; CHECK: %_ptr_Input_v4float = OpTypePointer Input %v4float
 ; CHECK: %gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ; CHECK: %v4uint = OpTypeVector %uint 4
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_45 = OpConstant %uint 45
 ; CHECK: %101 = OpConstantNull %float
 ; CHECK: %105 = OpTypeFunction %uint %uint %uint %uint %uint
 )";
@@ -2316,9 +2176,6 @@
 %int_0 = OpConstant %int 0
 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
 ; CHECK: %uint = OpTypeInt 32 0
-; CHECK: %uint_0 = OpConstant %uint 0
-; CHECK: %uint_1 = OpConstant %uint 1
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %26 = OpTypeFunction %uint %uint %uint
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kInputGlobals + R"(
@@ -2326,19 +2183,10 @@
 ; CHECK: %bool = OpTypeBool
 ; CHECK: %49 = OpTypeFunction %void %uint %uint %uint %uint
 )" + kOutputGlobals + R"(
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
 ; CHECK: %v4float = OpTypeVector %float 4
 ; CHECK: %_ptr_Input_v4float = OpTypePointer Input %v4float
 ; CHECK: %gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ; CHECK: %v4uint = OpTypeVector %uint 4
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_45 = OpConstant %uint 45
 ; CHECK: %101 = OpConstantNull %float
 ; CHECK: %105 = OpTypeFunction %uint %uint %uint %uint %uint
 )";
@@ -2441,32 +2289,19 @@
 %int_0 = OpConstant %int 0
 %_ptr_Uniform_float = OpTypePointer Uniform %float
 ; CHECK: %int = OpTypeInt 32 1
-; CHECK: %int_0 = OpConstant %int 0
 ; CHECK: %_ptr_Uniform_float = OpTypePointer Uniform %float
 ; CHECK: %uint = OpTypeInt 32 0
-; CHECK: %uint_0 = OpConstant %uint 0
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %21 = OpTypeFunction %uint %uint %uint %uint %uint
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kInputGlobals + R"(
 ; CHECK: %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 ; CHECK: %bool = OpTypeBool
-; CHECK: %uint_1 = OpConstant %uint 1
 ; CHECK: %52 = OpTypeFunction %void %uint %uint %uint %uint
 )" + kOutputGlobals + R"(
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
 ; CHECK: %v4float = OpTypeVector %float 4
 ; CHECK: %_ptr_Input_v4float = OpTypePointer Input %v4float
 ; CHECK: %gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ; CHECK: %v4uint = OpTypeVector %uint 4
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_32 = OpConstant %uint 32
 ; CHECK: %104 = OpConstantNull %float
 )";
   // clang-format on
@@ -2565,9 +2400,6 @@
 %b = OpVariable %_ptr_Input_float Input
 %_ptr_Uniform_float = OpTypePointer Uniform %float
 ; CHECK: %uint = OpTypeInt 32 0
-; CHECK: %uint_0 = OpConstant %uint 0
-; CHECK: %uint_1 = OpConstant %uint 1
-; CHECK: %uint_4 = OpConstant %uint 4
 ; CHECK: %26 = OpTypeFunction %uint %uint %uint
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kInputGlobals + R"(
@@ -2575,19 +2407,8 @@
 ; CHECK: %bool = OpTypeBool
 ; CHECK: %48 = OpTypeFunction %void %uint %uint %uint %uint
 )" + kOutputGlobals + R"(
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
-; CHECK: %uint_3 = OpConstant %uint 3
-; CHECK: %v4float = OpTypeVector %float 4
-; CHECK: %_ptr_Input_v4float = OpTypePointer Input %v4float
 ; CHECK: %gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ; CHECK: %v4uint = OpTypeVector %uint 4
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_45 = OpConstant %uint 45
 ; CHECK: %102 = OpTypeFunction %uint %uint %uint %uint %uint
 )";
   // clang-format on
@@ -2701,27 +2522,15 @@
 %nu_ii = OpVariable %_ptr_Input_int Input
 %int_0 = OpConstant %int 0
 %_ptr_Uniform_float = OpTypePointer Uniform %float
-; CHECK: %uint_0 = OpConstant %uint 0
 ; CHECK: %bool = OpTypeBool
 ; CHECK: %32 = OpTypeFunction %void %uint %uint %uint %uint
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kOutputGlobals + R"(
 ; CHECK: %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_1 = OpConstant %uint 1
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %v4float = OpTypeVector %float 4
 ; CHECK: %_ptr_Input_v4float = OpTypePointer Input %v4float
 ; CHECK: %gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ; CHECK: %v4uint = OpTypeVector %uint 4
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_46 = OpConstant %uint 46
 ; CHECK: %88 = OpConstantNull %float
 ; CHECK: %92 = OpTypeFunction %uint %uint %uint %uint %uint
 )" + kInputGlobals;
@@ -2844,7 +2653,6 @@
 %v4float = OpTypeVector %float 4
 %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_float = OpTypePointer Uniform %float
-; CHECK: %uint_1 = OpConstant %uint 1
 ; CHECK: %34 = OpTypeFunction %uint %uint %uint
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kInputGlobals + R"(
@@ -2852,25 +2660,12 @@
 ; CHECK: %bool = OpTypeBool
 ; CHECK: %57 = OpTypeFunction %void %uint %uint %uint %uint
 )" + kOutputGlobals + R"(
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %v3uint = OpTypeVector %uint 3
 ; CHECK: %_ptr_Input_v3uint = OpTypePointer Input %v3uint
 ; CHECK: %gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
-; CHECK: %uint_6 = OpConstant %uint 6
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_50 = OpConstant %uint 50
 ; CHECK: %112 = OpConstantNull %v4float
 ; CHECK: %115 = OpTypeFunction %uint %uint %uint %uint %uint
-; CHECK: %uint_47 = OpConstant %uint 47
 ; CHECK: %140 = OpConstantNull %uint
-; CHECK: %uint_53 = OpConstant %uint 53
 )";
   // clang-format on
 
@@ -3021,7 +2816,6 @@
 %v4float = OpTypeVector %float 4
 %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_float = OpTypePointer Uniform %float
-; CHECK: %uint_1 = OpConstant %uint 1
 ; CHECK: %34 = OpTypeFunction %uint %uint %uint
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kInputGlobals + R"(
@@ -3029,26 +2823,12 @@
 ; CHECK: %bool = OpTypeBool
 ; CHECK: %57 = OpTypeFunction %void %uint %uint %uint %uint
 )" + kOutputGlobals + R"(
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
-; CHECK: %uint_5313 = OpConstant %uint 5313
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %v3uint = OpTypeVector %uint 3
 ; CHECK: %_ptr_Input_v3uint = OpTypePointer Input %v3uint
 ; CHECK: %89 = OpVariable %_ptr_Input_v3uint Input
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_6 = OpConstant %uint 6
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_51 = OpConstant %uint 51
 ; CHECK: %113 = OpConstantNull %v4float
 ; CHECK: %116 = OpTypeFunction %uint %uint %uint %uint %uint
-; CHECK: %uint_48 = OpConstant %uint 48
 ; CHECK: %141 = OpConstantNull %uint
-; CHECK: %uint_54 = OpConstant %uint 54
 )";
   // clang-format on
 
@@ -3198,33 +2978,18 @@
 %v4float = OpTypeVector %float 4
 %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_float = OpTypePointer Uniform %float
-; CHECK: %uint_1 = OpConstant %uint 1
 ; CHECK: %34 = OpTypeFunction %uint %uint %uint
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kInputGlobals + R"(
 ; CHECK: %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 ; CHECK: %bool = OpTypeBool
 )" + kOutputGlobals + R"(
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
-; CHECK: %uint_5314 = OpConstant %uint 5314
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %v3uint = OpTypeVector %uint 3
 ; CHECK: %_ptr_Input_v3uint = OpTypePointer Input %v3uint
 ; CHECK: %89 = OpVariable %_ptr_Input_v3uint Input
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_6 = OpConstant %uint 6
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_51 = OpConstant %uint 51
 ; CHECK: %113 = OpConstantNull %v4float
 ; CHECK: %116 = OpTypeFunction %uint %uint %uint %uint %uint
-; CHECK: %uint_48 = OpConstant %uint 48
 ; CHECK: %141 = OpConstantNull %uint
-; CHECK: %uint_54 = OpConstant %uint 54
 )";
   // clang-format on
 
@@ -3374,7 +3139,6 @@
 %v4float = OpTypeVector %float 4
 %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_float = OpTypePointer Uniform %float
-; CHECK: %uint_1 = OpConstant %uint 1
 ; CHECK: %34 = OpTypeFunction %uint %uint %uint
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kInputGlobals + R"(
@@ -3382,26 +3146,12 @@
 ; CHECK: %bool = OpTypeBool
 ; CHECK: %57 = OpTypeFunction %void %uint %uint %uint %uint
 )" + kOutputGlobals + R"(
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
-; CHECK: %uint_5315 = OpConstant %uint 5315
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %v3uint = OpTypeVector %uint 3
 ; CHECK: %_ptr_Input_v3uint = OpTypePointer Input %v3uint
 ; CHECK: %89 = OpVariable %_ptr_Input_v3uint Input
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_6 = OpConstant %uint 6
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_51 = OpConstant %uint 51
 ; CHECK: %113 = OpConstantNull %v4float
 ; CHECK: %116 = OpTypeFunction %uint %uint %uint %uint %uint
-; CHECK: %uint_48 = OpConstant %uint 48
 ; CHECK: %141 = OpConstantNull %uint
-; CHECK: %uint_54 = OpConstant %uint 54
 )";
   // clang-format on
 
@@ -3551,7 +3301,6 @@
 %v4float = OpTypeVector %float 4
 %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_float = OpTypePointer Uniform %float
-; CHECK: %uint_1 = OpConstant %uint 1
 ; CHECK: %34 = OpTypeFunction %uint %uint %uint
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kInputGlobals + R"(
@@ -3559,26 +3308,12 @@
 ; CHECK: %bool = OpTypeBool
 ; CHECK: %57 = OpTypeFunction %void %uint %uint %uint %uint
 )" + kOutputGlobals + R"(
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
-; CHECK: %uint_5316 = OpConstant %uint 5316
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %v3uint = OpTypeVector %uint 3
 ; CHECK: %_ptr_Input_v3uint = OpTypePointer Input %v3uint
 ; CHECK: %89 = OpVariable %_ptr_Input_v3uint Input
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_6 = OpConstant %uint 6
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_51 = OpConstant %uint 51
 ; CHECK: %113 = OpConstantNull %v4float
 ; CHECK: %116 = OpTypeFunction %uint %uint %uint %uint %uint
-; CHECK: %uint_48 = OpConstant %uint 48
 ; CHECK: %141 = OpConstantNull %uint
-; CHECK: %uint_54 = OpConstant %uint 54
 )";
   // clang-format on
 
@@ -3728,7 +3463,6 @@
 %v4float = OpTypeVector %float 4
 %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_float = OpTypePointer Uniform %float
-; CHECK: %uint_1 = OpConstant %uint 1
 ; CHECK: %34 = OpTypeFunction %uint %uint %uint
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kInputGlobals + R"(
@@ -3736,26 +3470,12 @@
 ; CHECK: %bool = OpTypeBool
 ; CHECK: %57 = OpTypeFunction %void %uint %uint %uint %uint
 )" + kOutputGlobals + R"(
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
-; CHECK: %uint_5317 = OpConstant %uint 5317
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %v3uint = OpTypeVector %uint 3
 ; CHECK: %_ptr_Input_v3uint = OpTypePointer Input %v3uint
 ; CHECK: %89 = OpVariable %_ptr_Input_v3uint Input
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_6 = OpConstant %uint 6
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_51 = OpConstant %uint 51
 ; CHECK: %113 = OpConstantNull %v4float
 ; CHECK: %116 = OpTypeFunction %uint %uint %uint %uint %uint
-; CHECK: %uint_48 = OpConstant %uint 48
 ; CHECK: %141 = OpConstantNull %uint
-; CHECK: %uint_54 = OpConstant %uint 54
 )";
   // clang-format on
 
@@ -3905,7 +3625,6 @@
 %v4float = OpTypeVector %float 4
 %uint_0 = OpConstant %uint 0
 %_ptr_Uniform_float = OpTypePointer Uniform %float
-; CHECK: %uint_1 = OpConstant %uint 1
 ; CHECK: %34 = OpTypeFunction %uint %uint %uint
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kInputGlobals + R"(
@@ -3913,26 +3632,12 @@
 ; CHECK: %bool = OpTypeBool
 ; CHECK: %57 = OpTypeFunction %void %uint %uint %uint %uint
 )" + kOutputGlobals + R"(
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
-; CHECK: %uint_5318 = OpConstant %uint 5318
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %v3uint = OpTypeVector %uint 3
 ; CHECK: %_ptr_Input_v3uint = OpTypePointer Input %v3uint
 ; CHECK: %89 = OpVariable %_ptr_Input_v3uint Input
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_6 = OpConstant %uint 6
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_51 = OpConstant %uint 51
 ; CHECK: %113 = OpConstantNull %v4float
 ; CHECK: %116 = OpTypeFunction %uint %uint %uint %uint %uint
-; CHECK: %uint_48 = OpConstant %uint 48
 ; CHECK: %141 = OpConstantNull %uint
-; CHECK: %uint_54 = OpConstant %uint 54
 )";
   // clang-format on
 
@@ -4121,25 +3826,13 @@
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kOutputGlobals + R"(
 ; CHECK: %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_4 = OpConstant %uint 4
-; CHECK: %uint_1 = OpConstant %uint 1
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_2 = OpConstant %uint 2
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %_ptr_Input_v4float = OpTypePointer Input %v4float
 ; CHECK: %gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ; CHECK: %v4uint = OpTypeVector %uint 4
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_79 = OpConstant %uint 79
 ; CHECK: %122 = OpConstantNull %v4float
 ; CHECK: %126 = OpTypeFunction %uint %uint %uint %uint %uint
 )" + kInputGlobals + R"(
-; CHECK: %uint_87 = OpConstant %uint 87
 ; CHECK: %165 = OpConstantNull %v2float
-; CHECK: %uint_89 = OpConstant %uint 89
 )";
   // clang-format on
 
@@ -4320,29 +4013,16 @@
 %i_vTextureCoords = OpVariable %_ptr_Input_v2float Input
 %_ptr_Output_v4float = OpTypePointer Output %v4float
 %_entryPointOutput_vColor = OpVariable %_ptr_Output_v4float Output
- ;CHECK:      %uint_7 = OpConstant %uint 7
- ;CHECK:      %uint_1 = OpConstant %uint 1
  ;CHECK:         %122 = OpTypeFunction %uint %uint %uint %uint
  ;CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
  )" + kInputGlobals + R"(
  ;CHECK: %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
- ;CHECK:     %uint_4 = OpConstant %uint 4
  ;CHECK:         %148 = OpTypeFunction %void %uint %uint %uint %uint %uint
  )" + kOutputGlobals + R"(
- ;CHECK:    %uint_11 = OpConstant %uint 11
- ;CHECK:    %uint_23 = OpConstant %uint 23
- ;CHECK:     %uint_2 = OpConstant %uint 2
- ;CHECK:      %uint_3 = OpConstant %uint 3
  ;CHECK:%_ptr_Input_v4float = OpTypePointer Input %v4float
  ;CHECK:%gl_FragCoord = OpVariable %_ptr_Input_v4float Input
  ;CHECK:     %v4uint = OpTypeVector %uint 4
- ;CHECK:     %uint_5 = OpConstant %uint 5
- ;CHECK:     %uint_8 = OpConstant %uint 8
- ;CHECK:     %uint_9 = OpConstant %uint 9
- ;CHECK:    %uint_10 = OpConstant %uint 10
- ;CHECK:    %uint_71 = OpConstant %uint 71
  ;CHECK:        %202 = OpConstantNull %v2float
- ;CHECK:    %uint_75 = OpConstant %uint 75
      %MainPs = OpFunction %void None %3
           %5 = OpLabel
  ;CHECK: %140 = OpFunctionCall %uint %inst_bindless_direct_read_3 %uint_1 %uint_1 %uint_0
@@ -4525,31 +4205,16 @@
 %i_vTextureCoords = OpVariable %_ptr_Input_v2float Input
 %_ptr_Output_v4float = OpTypePointer Output %v4float
 %_entryPointOutput_vColor = OpVariable %_ptr_Output_v4float Output
-;CHECK:     %uint_0 = OpConstant %uint 0
-;CHECK:    %uint_80 = OpConstant %uint 80
-;CHECK:    %uint_64 = OpConstant %uint 64
-;CHECK:     %uint_7 = OpConstant %uint 7
-;CHECK:     %uint_2 = OpConstant %uint 2
-;CHECK:     %uint_1 = OpConstant %uint 1
 ;CHECK:        %105 = OpTypeFunction %uint %uint %uint %uint
 ;CHECK:%_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kInputGlobals + R"(
 ;CHECK:%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 ;CHECK:       %bool = OpTypeBool
-;CHECK:     %uint_4 = OpConstant %uint 4
 ;CHECK:        %132 = OpTypeFunction %void %uint %uint %uint %uint %uint
 )" + kOutputGlobals + R"(
-;CHECK:    %uint_11 = OpConstant %uint 11
-;CHECK:    %uint_23 = OpConstant %uint 23
-;CHECK:     %uint_3 = OpConstant %uint 3
 ;CHECK:%_ptr_Input_v4float = OpTypePointer Input %v4float
 ;CHECK:%gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ;CHECK:     %v4uint = OpTypeVector %uint 4
-;CHECK:     %uint_5 = OpConstant %uint 5
-;CHECK:     %uint_8 = OpConstant %uint 8
-;CHECK:     %uint_9 = OpConstant %uint 9
-;CHECK:    %uint_10 = OpConstant %uint 10
-;CHECK:    %uint_78 = OpConstant %uint 78
 ;CHECK:        %185 = OpConstantNull %v2float
      %MainPs = OpFunction %void None %3
           %5 = OpLabel
@@ -4683,33 +4348,17 @@
 %i_vTextureCoords = OpVariable %_ptr_Input_v2float Input
 %_ptr_Output_v4float = OpTypePointer Output %v4float
 %_entryPointOutput_vColor = OpVariable %_ptr_Output_v4float Output
-;CHECK:     %uint_0 = OpConstant %uint 0
-;CHECK:    %uint_80 = OpConstant %uint 80
-;CHECK:    %uint_64 = OpConstant %uint 64
-;CHECK:     %uint_7 = OpConstant %uint 7
-;CHECK:     %uint_2 = OpConstant %uint 2
 ;CHECK:        %104 = OpTypeFunction %uint %uint %uint %uint %uint
 ;CHECK:%_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kInputGlobals + R"(
 ;CHECK:%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 ;CHECK:       %bool = OpTypeBool
-;CHECK:     %uint_4 = OpConstant %uint 4
 ;CHECK:        %135 = OpTypeFunction %void %uint %uint %uint %uint %uint
 )" + kOutputGlobals + R"(
-;CHECK:    %uint_11 = OpConstant %uint 11
-;CHECK:     %uint_1 = OpConstant %uint 1
-;CHECK:    %uint_23 = OpConstant %uint 23
-;CHECK:     %uint_3 = OpConstant %uint 3
 ;CHECK:%_ptr_Input_v4float = OpTypePointer Input %v4float
 ;CHECK:%gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ;CHECK:     %v4uint = OpTypeVector %uint 4
-;CHECK:     %uint_5 = OpConstant %uint 5
-;CHECK:     %uint_8 = OpConstant %uint 8
-;CHECK:     %uint_9 = OpConstant %uint 9
-;CHECK:    %uint_10 = OpConstant %uint 10
-;CHECK:    %uint_78 = OpConstant %uint 78
 ;CHECK:        %189 = OpConstantNull %v2float
-;CHECK:    %uint_83 = OpConstant %uint 83
 ;CHECK:        %201 = OpConstantNull %v4float
      %MainPs = OpFunction %void None %3
           %5 = OpLabel
@@ -4840,26 +4489,14 @@
 %i_vTextureCoords = OpVariable %_ptr_Input_v2float Input
 %_ptr_Output_v4float = OpTypePointer Output %v4float
 %_entryPointOutput_vColor = OpVariable %_ptr_Output_v4float Output
-;CHECK:     %uint_0 = OpConstant %uint 0
 ;CHECK:       %bool = OpTypeBool
 ;CHECK:         %51 = OpTypeFunction %void %uint %uint %uint %uint
 ;CHECK:%_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kOutputGlobals + R"(
 ;CHECK:%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
-;CHECK:    %uint_10 = OpConstant %uint 10
-;CHECK:     %uint_4 = OpConstant %uint 4
-;CHECK:     %uint_1 = OpConstant %uint 1
-;CHECK:    %uint_23 = OpConstant %uint 23
-;CHECK:     %uint_2 = OpConstant %uint 2
-;CHECK:     %uint_3 = OpConstant %uint 3
 ;CHECK:%_ptr_Input_v4float = OpTypePointer Input %v4float
 ;CHECK:%gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ;CHECK:     %v4uint = OpTypeVector %uint 4
-;CHECK:     %uint_5 = OpConstant %uint 5
-;CHECK:     %uint_7 = OpConstant %uint 7
-;CHECK:     %uint_8 = OpConstant %uint 8
-;CHECK:     %uint_9 = OpConstant %uint 9
-;CHECK:    %uint_60 = OpConstant %uint 60
 ;CHECK:        %106 = OpConstantNull %v4float
 ;CHECK:        %111 = OpTypeFunction %uint %uint %uint %uint %uint
 )" + kInputGlobals + R"(
@@ -5039,31 +4676,16 @@
 %i_vTextureCoords = OpVariable %_ptr_Input_v2float Input
 %_ptr_Output_v4float = OpTypePointer Output %v4float
 %_entryPointOutput_vColor = OpVariable %_ptr_Output_v4float Output
-;CHECK:     %uint_0 = OpConstant %uint 0
-;CHECK:    %uint_80 = OpConstant %uint 80
-;CHECK:    %uint_64 = OpConstant %uint 64
-;CHECK:     %uint_7 = OpConstant %uint 7
-;CHECK:     %uint_1 = OpConstant %uint 1
 ;CHECK:         %61 = OpTypeFunction %uint %uint %uint %uint
 ;CHECK:%_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kInputGlobals + R"(
 ;CHECK:%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
 ;CHECK:       %bool = OpTypeBool
-;CHECK:     %uint_4 = OpConstant %uint 4
 ;CHECK:         %88 = OpTypeFunction %void %uint %uint %uint %uint %uint
 )" + kOutputGlobals + R"(
-;CHECK:    %uint_11 = OpConstant %uint 11
-;CHECK:    %uint_23 = OpConstant %uint 23
-;CHECK:     %uint_2 = OpConstant %uint 2
-;CHECK:     %uint_3 = OpConstant %uint 3
 ;CHECK:%_ptr_Input_v4float = OpTypePointer Input %v4float
 ;CHECK:%gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ;CHECK:     %v4uint = OpTypeVector %uint 4
-;CHECK:     %uint_5 = OpConstant %uint 5
-;CHECK:     %uint_8 = OpConstant %uint 8
-;CHECK:     %uint_9 = OpConstant %uint 9
-;CHECK:    %uint_10 = OpConstant %uint 10
-;CHECK:    %uint_81 = OpConstant %uint 81
 ;CHECK:        %142 = OpConstantNull %v2float
      %MainPs = OpFunction %void None %14
          %37 = OpLabel
@@ -5186,10 +4808,6 @@
     %v4float = OpTypeVector %float 4
 %_ptr_Input_v4float = OpTypePointer Input %v4float
  %a_position = OpVariable %_ptr_Input_v4float Input
-;CHECK;     %uint_0 = OpConstant %uint 0
-;CHECK;     %uint_16 = OpConstant %uint 16
-;CHECK;     %uint_4 = OpConstant %uint 4
-;CHECK;     %uint_3 = OpConstant %uint 3
 ;CHECK;         %37 = OpTypeFunction %uint %uint %uint %uint
 ;CHECK;%_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kInputGlobals + R"(
@@ -5197,9 +4815,6 @@
 ;CHECK;       %bool = OpTypeBool
 ;CHECK;         %63 = OpTypeFunction %void %uint %uint %uint %uint %uint
 )" + kOutputGlobals + R"(
-;CHECK;    %uint_11 = OpConstant %uint 11
-;CHECK;    %uint_23 = OpConstant %uint 23
-;CHECK;     %uint_2 = OpConstant %uint 2
 ;CHECK;%_ptr_Input_uint = OpTypePointer Input %uint
 ;CHECK;%gl_VertexIndex = OpVariable %_ptr_Input_uint Input
 ;CHECK;%gl_InstanceIndex = OpVariable %_ptr_Input_uint Input
@@ -5323,10 +4938,6 @@
     %v4float = OpTypeVector %float 4
 %_ptr_Input_v4float = OpTypePointer Input %v4float
  %a_position = OpVariable %_ptr_Input_v4float Input
-;CHECK:     %uint_0 = OpConstant %uint 0
-;CHECK:     %uint_8 = OpConstant %uint 8
-;CHECK:     %uint_4 = OpConstant %uint 4
-;CHECK:     %uint_3 = OpConstant %uint 3
 ;CHECK:         %37 = OpTypeFunction %uint %uint %uint %uint
 ;CHECK:%_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kInputGlobals + R"(
@@ -5334,17 +4945,9 @@
 ;CHECK:       %bool = OpTypeBool
 ;CHECK:         %63 = OpTypeFunction %void %uint %uint %uint %uint %uint
 )" + kOutputGlobals + R"(
-;CHECK:    %uint_11 = OpConstant %uint 11
-;CHECK:    %uint_23 = OpConstant %uint 23
-;CHECK:     %uint_2 = OpConstant %uint 2
 ;CHECK:%_ptr_Input_uint = OpTypePointer Input %uint
 ;CHECK:%gl_VertexIndex = OpVariable %_ptr_Input_uint Input
 ;CHECK:%gl_InstanceIndex = OpVariable %_ptr_Input_uint Input
-;CHECK:     %uint_5 = OpConstant %uint 5
-;CHECK:     %uint_7 = OpConstant %uint 7
-;CHECK:     %uint_9 = OpConstant %uint 9
-;CHECK:    %uint_10 = OpConstant %uint 10
-;CHECK:    %uint_45 = OpConstant %uint 45
 ;CHECK:        %114 = OpConstantNull %float
 %main = OpFunction %void None %3
           %5 = OpLabel
@@ -5466,12 +5069,6 @@
     %v4float = OpTypeVector %float 4
 %_ptr_Input_v4float = OpTypePointer Input %v4float
  %a_position = OpVariable %_ptr_Input_v4float Input
-;CHECK:     %uint_0 = OpConstant %uint 0
-;CHECK:   %uint_128 = OpConstant %uint 128
-;CHECK:    %uint_32 = OpConstant %uint 32
-;CHECK:    %uint_16 = OpConstant %uint 16
-;CHECK:    %uint_19 = OpConstant %uint 19
-;CHECK:     %uint_1 = OpConstant %uint 1
 ;CHECK:         %46 = OpTypeFunction %uint %uint %uint %uint
 ;CHECK:%_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kInputGlobals + R"(
@@ -5479,18 +5076,9 @@
 ;CHECK:       %bool = OpTypeBool
 ;CHECK:         %72 = OpTypeFunction %void %uint %uint %uint %uint %uint
 )" + kOutputGlobals + R"(
-;CHECK:    %uint_11 = OpConstant %uint 11
-;CHECK:    %uint_23 = OpConstant %uint 23
-;CHECK:     %uint_2 = OpConstant %uint 2
 ;CHECK:%_ptr_Input_uint = OpTypePointer Input %uint
 ;CHECK:%gl_VertexIndex = OpVariable %_ptr_Input_uint Input
 ;CHECK:%gl_InstanceIndex = OpVariable %_ptr_Input_uint Input
-;CHECK:     %uint_5 = OpConstant %uint 5
-;CHECK:     %uint_7 = OpConstant %uint 7
-;CHECK:     %uint_8 = OpConstant %uint 8
-;CHECK:     %uint_9 = OpConstant %uint 9
-;CHECK:    %uint_10 = OpConstant %uint 10
-;CHECK:    %uint_51 = OpConstant %uint 51
 ;CHECK:        %124 = OpConstantNull %v2float
        %main = OpFunction %void None %3
           %5 = OpLabel
@@ -5583,27 +5171,14 @@
            %_ptr_Input_int = OpTypePointer Input %int
                     %ii = OpVariable %_ptr_Input_int Input
 ;CHECK:           %uint = OpTypeInt 32 0
-;CHECK:         %uint_0 = OpConstant %uint 0
 ;CHECK:           %bool = OpTypeBool
-;CHECK:         %uint_7 = OpConstant %uint 7
 ;CHECK:             %35 = OpTypeFunction %void %uint %uint %uint %uint %uint
 ;CHECK:    %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kOutputGlobals + R"(
 ;CHECK:    %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
-;CHECK:        %uint_11 = OpConstant %uint 11
-;CHECK:         %uint_4 = OpConstant %uint 4
-;CHECK:         %uint_1 = OpConstant %uint 1
-;CHECK:        %uint_23 = OpConstant %uint 23
-;CHECK:         %uint_2 = OpConstant %uint 2
-;CHECK:         %uint_3 = OpConstant %uint 3
 ;CHECK:    %_ptr_Input_v4float = OpTypePointer Input %v4float
 ;CHECK:    %gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ;CHECK:         %v4uint = OpTypeVector %uint 4
-;CHECK:         %uint_5 = OpConstant %uint 5
-;CHECK:         %uint_8 = OpConstant %uint 8
-;CHECK:         %uint_9 = OpConstant %uint 9
-;CHECK:        %uint_10 = OpConstant %uint 10
-;CHECK:        %uint_33 = OpConstant %uint 33
 ;CHECK:             %93 = OpConstantNull %v4float
                   %main = OpFunction %void None %3
                      %5 = OpLabel
@@ -5695,27 +5270,14 @@
            %_ptr_Output_v4float = OpTypePointer Output %v4float
                      %x = OpVariable %_ptr_Output_v4float Output
 ;CHECK:           %uint = OpTypeInt 32 0
-;CHECK:         %uint_0 = OpConstant %uint 0
 ;CHECK:           %bool = OpTypeBool
-;CHECK:         %uint_7 = OpConstant %uint 7
 ;CHECK:             %34 = OpTypeFunction %void %uint %uint %uint %uint %uint
 ;CHECK:    %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kOutputGlobals + R"(
 ;CHECK:    %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
-;CHECK:        %uint_11 = OpConstant %uint 11
-;CHECK:         %uint_4 = OpConstant %uint 4
-;CHECK:         %uint_1 = OpConstant %uint 1
-;CHECK:        %uint_23 = OpConstant %uint 23
-;CHECK:         %uint_2 = OpConstant %uint 2
-;CHECK:         %uint_3 = OpConstant %uint 3
 ;CHECK:    %_ptr_Input_v4float = OpTypePointer Input %v4float
 ;CHECK:    %gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ;CHECK:         %v4uint = OpTypeVector %uint 4
-;CHECK:         %uint_5 = OpConstant %uint 5
-;CHECK:         %uint_8 = OpConstant %uint 8
-;CHECK:         %uint_9 = OpConstant %uint 9
-;CHECK:        %uint_10 = OpConstant %uint 10
-;CHECK:        %uint_34 = OpConstant %uint 34
                   %main = OpFunction %void None %3
                      %5 = OpLabel
 ;CHECK:                   OpBranch %21
@@ -5802,28 +5364,14 @@
            %_ptr_Input_int = OpTypePointer Input %int
                     %ii = OpVariable %_ptr_Input_int Input
 ;CHECK:           %uint = OpTypeInt 32 0
-;CHECK:         %uint_0 = OpConstant %uint 0
 ;CHECK:           %bool = OpTypeBool
-;CHECK:         %uint_6 = OpConstant %uint 6
 ;CHECK:             %35 = OpTypeFunction %void %uint %uint %uint %uint %uint
 ;CHECK:    %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kOutputGlobals + R"(
 ;CHECK:    %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
-;CHECK:        %uint_11 = OpConstant %uint 11
-;CHECK:         %uint_4 = OpConstant %uint 4
-;CHECK:         %uint_1 = OpConstant %uint 1
-;CHECK:        %uint_23 = OpConstant %uint 23
-;CHECK:         %uint_2 = OpConstant %uint 2
-;CHECK:         %uint_3 = OpConstant %uint 3
 ;CHECK:    %_ptr_Input_v4float = OpTypePointer Input %v4float
 ;CHECK:    %gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ;CHECK:         %v4uint = OpTypeVector %uint 4
-;CHECK:         %uint_5 = OpConstant %uint 5
-;CHECK:         %uint_7 = OpConstant %uint 7
-;CHECK:         %uint_8 = OpConstant %uint 8
-;CHECK:         %uint_9 = OpConstant %uint 9
-;CHECK:        %uint_10 = OpConstant %uint 10
-;CHECK:        %uint_32 = OpConstant %uint 32
 ;CHECK:             %94 = OpConstantNull %v4float
                   %main = OpFunction %void None %3
                      %5 = OpLabel
@@ -5915,28 +5463,14 @@
            %_ptr_Input_int = OpTypePointer Input %int
                     %ii = OpVariable %_ptr_Input_int Input
 ;CHECK:           %uint = OpTypeInt 32 0
-;CHECK:         %uint_0 = OpConstant %uint 0
 ;CHECK:           %bool = OpTypeBool
-;CHECK:         %uint_6 = OpConstant %uint 6
 ;CHECK:             %38 = OpTypeFunction %void %uint %uint %uint %uint %uint
 ;CHECK:    %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kOutputGlobals + R"(
 ;CHECK:    %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
-;CHECK:        %uint_11 = OpConstant %uint 11
-;CHECK:         %uint_4 = OpConstant %uint 4
-;CHECK:         %uint_1 = OpConstant %uint 1
-;CHECK:        %uint_23 = OpConstant %uint 23
-;CHECK:         %uint_2 = OpConstant %uint 2
-;CHECK:         %uint_3 = OpConstant %uint 3
 ;CHECK:    %_ptr_Input_v4float = OpTypePointer Input %v4float
 ;CHECK:    %gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ;CHECK:         %v4uint = OpTypeVector %uint 4
-;CHECK:         %uint_5 = OpConstant %uint 5
-;CHECK:         %uint_7 = OpConstant %uint 7
-;CHECK:         %uint_8 = OpConstant %uint 8
-;CHECK:         %uint_9 = OpConstant %uint 9
-;CHECK:        %uint_10 = OpConstant %uint 10
-;CHECK:        %uint_34 = OpConstant %uint 34
 ;CHECK:             %97 = OpConstantNull %v4float
                   %main = OpFunction %void None %3
                      %5 = OpLabel
@@ -6037,28 +5571,14 @@
            %_ptr_Input_int = OpTypePointer Input %int
                     %ii = OpVariable %_ptr_Input_int Input
 ;CHECK:           %uint = OpTypeInt 32 0
-;CHECK:         %uint_0 = OpConstant %uint 0
 ;CHECK:           %bool = OpTypeBool
-;CHECK:         %uint_6 = OpConstant %uint 6
 ;CHECK:             %44 = OpTypeFunction %void %uint %uint %uint %uint %uint
 ;CHECK:    %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kOutputGlobals + R"(
 ;CHECK:    %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
-;CHECK:        %uint_11 = OpConstant %uint 11
-;CHECK:         %uint_4 = OpConstant %uint 4
-;CHECK:         %uint_1 = OpConstant %uint 1
-;CHECK:        %uint_23 = OpConstant %uint 23
-;CHECK:         %uint_2 = OpConstant %uint 2
-;CHECK:         %uint_3 = OpConstant %uint 3
 ;CHECK:    %_ptr_Input_v4float = OpTypePointer Input %v4float
 ;CHECK:    %gl_FragCoord = OpVariable %_ptr_Input_v4float Input
 ;CHECK:         %v4uint = OpTypeVector %uint 4
-;CHECK:         %uint_5 = OpConstant %uint 5
-;CHECK:         %uint_7 = OpConstant %uint 7
-;CHECK:         %uint_8 = OpConstant %uint 8
-;CHECK:         %uint_9 = OpConstant %uint 9
-;CHECK:        %uint_10 = OpConstant %uint 10
-;CHECK:        %uint_42 = OpConstant %uint 42
 ;CHECK:            %103 = OpConstantNull %v4float
                   %main = OpFunction %void None %3
                      %5 = OpLabel
diff --git a/test/opt/inst_buff_addr_check_test.cpp b/test/opt/inst_buff_addr_check_test.cpp
index e095eb7..7886ba7 100644
--- a/test/opt/inst_buff_addr_check_test.cpp
+++ b/test/opt/inst_buff_addr_check_test.cpp
@@ -36,7 +36,7 @@
 )";
 
 static const std::string kOutputGlobals = R"(
-; CHECK: [[output_buffer_type]] = OpTypeStruct %uint %_runtimearr_uint
+; CHECK: [[output_buffer_type]] = OpTypeStruct %uint %uint %_runtimearr_uint
 ; CHECK: [[output_ptr_type:%\w+]] = OpTypePointer StorageBuffer [[output_buffer_type]]
 ; CHECK: [[output_buffer_var]] = OpVariable [[output_ptr_type]] StorageBuffer
 )";
@@ -48,34 +48,34 @@
 ; CHECK: [[param_3:%\w+]] = OpFunctionParameter %uint
 ; CHECK: [[param_4:%\w+]] = OpFunctionParameter %uint
 ; CHECK: {{%\w+}} = OpLabel
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_0
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1
 ; CHECK: {{%\w+}} = OpAtomicIAdd %uint {{%\w+}} %uint_4 %uint_0 %uint_10
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_10
-; CHECK: {{%\w+}} = OpArrayLength %uint [[output_buffer_var]] 1
+; CHECK: {{%\w+}} = OpArrayLength %uint [[output_buffer_var]] 2
 ; CHECK: {{%\w+}} = OpULessThanEqual %bool {{%\w+}} {{%\w+}}
 ; CHECK: OpSelectionMerge {{%\w+}} None
 ; CHECK: OpBranchConditional {{%\w+}} {{%\w+}} {{%\w+}}
 ; CHECK: {{%\w+}} = OpLabel
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_0
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} %uint_10
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_1
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} %uint_23
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_2
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} [[param_1]]
 )";
 
 static const std::string kStreamWrite4End = R"(
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_7
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} [[param_2]]
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_8
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} [[param_3]]
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_9
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} [[param_4]]
 ; CHECK: OpBranch {{%\w+}}
 ; CHECK: {{%\w+}} = OpLabel
@@ -86,36 +86,36 @@
 // clang-format off
 static const std::string kStreamWrite4Frag = kStreamWrite4Begin + R"(
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_3
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} %uint_4
 ; CHECK: {{%\w+}} = OpLoad %v4float %gl_FragCoord
 ; CHECK: {{%\w+}} = OpBitcast %v4uint {{%\w+}}
 ; CHECK: {{%\w+}} = OpCompositeExtract %uint {{%\w+}} 0
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_4
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 ; CHECK: {{%\w+}} = OpCompositeExtract %uint {{%\w+}} 1
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_5
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 )" + kStreamWrite4End;
 
 static const std::string kStreamWrite4Compute = kStreamWrite4Begin + R"(
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_3
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} %uint_5
 ; CHECK: {{%\w+}} = OpLoad %v3uint %gl_GlobalInvocationID
 ; CHECK: {{%\w+}} = OpCompositeExtract %uint {{%\w+}} 0
 ; CHECK: {{%\w+}} = OpCompositeExtract %uint {{%\w+}} 1
 ; CHECK: {{%\w+}} = OpCompositeExtract %uint {{%\w+}} 2
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_4
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_5
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 ; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_6
-; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_1 {{%\w+}}
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint [[output_buffer_var]] %uint_2 {{%\w+}}
 ; CHECK: OpStore {{%\w+}} {{%\w+}}
 )" + kStreamWrite4End;
 // clang-format on
@@ -251,31 +251,18 @@
 %int_3239 = OpConstant %int 3239
 %_ptr_PhysicalStorageBuffer_int = OpTypePointer PhysicalStorageBuffer %int
 ; CHECK: %ulong = OpTypeInt 64 0
-; CHECK: %uint_4 = OpConstant %uint 4
 ; CHECK: %bool = OpTypeBool
 ; CHECK: %28 = OpTypeFunction %bool %ulong %uint
-; CHECK: %uint_1 = OpConstant %uint 1
 ; CHECK: %_runtimearr_ulong = OpTypeRuntimeArray %ulong
 )" + kInputGlobals + R"(
 ; CHECK: %_ptr_StorageBuffer_ulong = OpTypePointer StorageBuffer %ulong
-; CHECK: %uint_0 = OpConstant %uint 0
-; CHECK: %uint_32 = OpConstant %uint 32
 ; CHECK: %70 = OpTypeFunction %void %uint %uint %uint %uint
 ; CHECK: %_runtimearr_uint = OpTypeRuntimeArray %uint
 )" + kOutputGlobals + R"(
 ; CHECK: %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
-; CHECK: %uint_10 = OpConstant %uint 10
-; CHECK: %uint_23 = OpConstant %uint 23
-; CHECK: %uint_5 = OpConstant %uint 5
-; CHECK: %uint_3 = OpConstant %uint 3
 ; CHECK: %v3uint = OpTypeVector %uint 3
 ; CHECK: %_ptr_Input_v3uint = OpTypePointer Input %v3uint
 ; CHECK: %gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
-; CHECK: %uint_6 = OpConstant %uint 6
-; CHECK: %uint_7 = OpConstant %uint 7
-; CHECK: %uint_8 = OpConstant %uint 8
-; CHECK: %uint_9 = OpConstant %uint 9
-; CHECK: %uint_48 = OpConstant %uint 48
 )";
 // clang-format off
 
diff --git a/test/opt/inst_debug_printf_test.cpp b/test/opt/inst_debug_printf_test.cpp
index 57e5044..6a4cbdd 100644
--- a/test/opt/inst_debug_printf_test.cpp
+++ b/test/opt/inst_debug_printf_test.cpp
@@ -30,12 +30,13 @@
 ; CHECK: OpDecorate [[output_buffer_type:%inst_printf_OutputBuffer]] Block
 ; CHECK: OpMemberDecorate [[output_buffer_type]] 0 Offset 0
 ; CHECK: OpMemberDecorate [[output_buffer_type]] 1 Offset 4
+; CHECK: OpMemberDecorate [[output_buffer_type]] 2 Offset 8
 ; CHECK: OpDecorate [[output_buffer_var:%\w+]] DescriptorSet 7
 ; CHECK: OpDecorate [[output_buffer_var]] Binding 3
 )";
 
 static const std::string kOutputGlobals = R"(
-; CHECK: [[output_buffer_type]] = OpTypeStruct %uint %_runtimearr_uint
+; CHECK: [[output_buffer_type]] = OpTypeStruct %uint %uint %_runtimearr_uint
 ; CHECK: [[output_ptr_type:%\w+]] = OpTypePointer StorageBuffer [[output_buffer_type]]
 ; CHECK: [[output_buffer_var]] = OpVariable [[output_ptr_type]] StorageBuffer
 )";
@@ -149,60 +150,60 @@
 
   const std::string output_func = R"(
 ; CHECK: %inst_printf_stream_write_6 = OpFunction %void None %38
-; CHECK: %39 = OpFunctionParameter %uint
-; CHECK: %40 = OpFunctionParameter %uint
-; CHECK: %41 = OpFunctionParameter %uint
-; CHECK: %42 = OpFunctionParameter %uint
-; CHECK: %43 = OpFunctionParameter %uint
-; CHECK: %44 = OpFunctionParameter %uint
-; CHECK: %45 = OpLabel
-; CHECK: %52 = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_0
-; CHECK: %55 = OpAtomicIAdd %uint %52 %uint_4 %uint_0 %uint_12
-; CHECK: %56 = OpIAdd %uint %55 %uint_12
-; CHECK: %57 = OpArrayLength %uint %inst_printf_output_buffer 1
-; CHECK: %59 = OpULessThanEqual %bool %56 %57
-; CHECK: OpSelectionMerge %60 None
-; CHECK: OpBranchConditional %59 %61 %60
-; CHECK: %61 = OpLabel
-; CHECK: %62 = OpIAdd %uint %55 %uint_0
-; CHECK: %64 = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_1 %62
-; CHECK: OpStore %64 %uint_12
-; CHECK: %66 = OpIAdd %uint %55 %uint_1
-; CHECK: %67 = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_1 %66
-; CHECK: OpStore %67 %uint_23
-; CHECK: %69 = OpIAdd %uint %55 %uint_2
-; CHECK: %70 = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_1 %69
-; CHECK: OpStore %70 %39
-; CHECK: %72 = OpIAdd %uint %55 %uint_3
-; CHECK: %73 = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_1 %72
-; CHECK: OpStore %73 %uint_4
-; CHECK: %76 = OpLoad %v4float %gl_FragCoord
-; CHECK: %78 = OpBitcast %v4uint %76
-; CHECK: %79 = OpCompositeExtract %uint %78 0
-; CHECK: %80 = OpIAdd %uint %55 %uint_4
-; CHECK: %81 = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_1 %80
-; CHECK: OpStore %81 %79
-; CHECK: %82 = OpCompositeExtract %uint %78 1
-; CHECK: %83 = OpIAdd %uint %55 %uint_5
-; CHECK: %84 = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_1 %83
-; CHECK: OpStore %84 %82
-; CHECK: %86 = OpIAdd %uint %55 %uint_7
-; CHECK: %87 = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_1 %86
-; CHECK: OpStore %87 %40
-; CHECK: %89 = OpIAdd %uint %55 %uint_8
-; CHECK: %90 = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_1 %89
-; CHECK: OpStore %90 %41
-; CHECK: %92 = OpIAdd %uint %55 %uint_9
-; CHECK: %93 = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_1 %92
-; CHECK: OpStore %93 %42
-; CHECK: %95 = OpIAdd %uint %55 %uint_10
-; CHECK: %96 = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_1 %95
-; CHECK: OpStore %96 %43
-; CHECK: %98 = OpIAdd %uint %55 %uint_11
-; CHECK: %99 = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_1 %98
-; CHECK: OpStore %99 %44
-; CHECK: OpBranch %60
-; CHECK: %60 = OpLabel
+; CHECK: [[param_1:%\w+]] = OpFunctionParameter %uint
+; CHECK: [[param_2:%\w+]] = OpFunctionParameter %uint
+; CHECK: [[param_3:%\w+]] = OpFunctionParameter %uint
+; CHECK: [[param_4:%\w+]] = OpFunctionParameter %uint
+; CHECK: [[param_5:%\w+]] = OpFunctionParameter %uint
+; CHECK: [[param_6:%\w+]] = OpFunctionParameter %uint
+; CHECK: {{%\w+}} = OpLabel
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_1
+; CHECK: {{%\w+}} = OpAtomicIAdd %uint {{%\w+}} %uint_4 %uint_0 %uint_12
+; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_12
+; CHECK: {{%\w+}} = OpArrayLength %uint %inst_printf_output_buffer 2
+; CHECK: {{%\w+}} = OpULessThanEqual %bool {{%\w+}} {{%\w+}}
+; CHECK: OpSelectionMerge {{%\w+}} None
+; CHECK: OpBranchConditional {{%\w+}} {{%\w+}} {{%\w+}}
+; CHECK: {{%\w+}} = OpLabel
+; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_0
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_2 {{%\w+}}
+; CHECK: OpStore {{%\w+}} %uint_12
+; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_1
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_2 {{%\w+}}
+; CHECK: OpStore {{%\w+}} %uint_23
+; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_2
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_2 {{%\w+}}
+; CHECK: OpStore {{%\w+}} [[param_1]]
+; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_3
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_2 {{%\w+}}
+; CHECK: OpStore {{%\w+}} %uint_4
+; CHECK: {{%\w+}} = OpLoad %v4float %gl_FragCoord
+; CHECK: {{%\w+}} = OpBitcast %v4uint {{%\w+}}
+; CHECK: {{%\w+}} = OpCompositeExtract %uint {{%\w+}} 0
+; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_4
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_2 {{%\w+}}
+; CHECK: OpStore {{%\w+}} {{%\w+}}
+; CHECK: {{%\w+}} = OpCompositeExtract %uint {{%\w+}} 1
+; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_5
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_2 {{%\w+}}
+; CHECK: OpStore {{%\w+}} {{%\w+}}
+; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_7
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_2 {{%\w+}}
+; CHECK: OpStore {{%\w+}} [[param_2]]
+; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_8
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_2 {{%\w+}}
+; CHECK: OpStore {{%\w+}} [[param_3]]
+; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_9
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_2 {{%\w+}}
+; CHECK: OpStore {{%\w+}} [[param_4]]
+; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_10
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_2 {{%\w+}}
+; CHECK: OpStore {{%\w+}} [[param_5]]
+; CHECK: {{%\w+}} = OpIAdd %uint {{%\w+}} %uint_11
+; CHECK: {{%\w+}} = OpAccessChain %_ptr_StorageBuffer_uint %inst_printf_output_buffer %uint_2 {{%\w+}}
+; CHECK: OpStore {{%\w+}} [[param_6]]
+; CHECK: OpBranch {{%\w+}}
+; CHECK: {{%\w+}} = OpLabel
 ; CHECK: OpReturn
 ; CHECK: OpFunctionEnd
 )";