[spirv] Avoid OpConstantNull for subgroup matrix composites

Mesa drivers do not yet handle these properly.

Fixed: 407532165
Change-Id: I4ecb00937e1499e3537f8656cffc7817e48f1e76
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/239516
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
diff --git a/src/tint/lang/spirv/writer/construct_test.cc b/src/tint/lang/spirv/writer/construct_test.cc
index 6814c69..c4995cb 100644
--- a/src/tint/lang/spirv/writer/construct_test.cc
+++ b/src/tint/lang/spirv/writer/construct_test.cc
@@ -188,12 +188,25 @@
         .use_vulkan_memory_model = true,
     };
     ASSERT_TRUE(Generate(options)) << Error() << output_;
-    EXPECT_INST("%7 = OpTypeCooperativeMatrixKHR %float %uint_3 %uint_4 %uint_8 %uint_0");
-    EXPECT_INST("%left = OpConstantNull %_arr_7_uint_4");
-    EXPECT_INST("%16 = OpTypeCooperativeMatrixKHR %int %uint_3 %uint_8 %uint_4 %uint_1");
-    EXPECT_INST("%right = OpConstantNull %_arr_16_uint_4");
-    EXPECT_INST("%21 = OpTypeCooperativeMatrixKHR %uint %uint_3 %uint_2 %uint_2 %uint_2");
-    EXPECT_INST("%result = OpConstantNull %_arr_21_uint_4");
+    EXPECT_INST(R"(
+          %7 = OpTypeCooperativeMatrixKHR %float %uint_3 %uint_4 %uint_8 %uint_0
+%_arr_7_uint_4 = OpTypeArray %7 %uint_4
+    %float_0 = OpConstant %float 0
+         %14 = OpConstantComposite %7 %float_0
+       %left = OpConstantComposite %_arr_7_uint_4 %14 %14 %14 %14
+        %int = OpTypeInt 32 1
+     %uint_1 = OpConstant %uint 1
+         %18 = OpTypeCooperativeMatrixKHR %int %uint_3 %uint_8 %uint_4 %uint_1
+%_arr_18_uint_4 = OpTypeArray %18 %uint_4
+      %int_0 = OpConstant %int 0
+         %21 = OpConstantComposite %18 %int_0
+      %right = OpConstantComposite %_arr_18_uint_4 %21 %21 %21 %21
+     %uint_2 = OpConstant %uint 2
+         %25 = OpTypeCooperativeMatrixKHR %uint %uint_3 %uint_2 %uint_2 %uint_2
+%_arr_25_uint_4 = OpTypeArray %25 %uint_4
+         %27 = OpConstantComposite %25 %uint_0
+     %result = OpConstantComposite %_arr_25_uint_4 %27 %27 %27 %27
+)");
 }
 
 TEST_F(SpirvWriterTest, Construct_StructOfSubgroupMatrix_ZeroValue) {
@@ -215,10 +228,27 @@
         .use_vulkan_memory_model = true,
     };
     ASSERT_TRUE(Generate(options)) << Error() << output_;
-    EXPECT_INST("%8 = OpTypeCooperativeMatrixKHR %float %uint_3 %uint_4 %uint_8 %uint_0");
-    EXPECT_INST("%16 = OpTypeCooperativeMatrixKHR %int %uint_3 %uint_8 %uint_4 %uint_1");
-    EXPECT_INST("%20 = OpTypeCooperativeMatrixKHR %uint %uint_3 %uint_2 %uint_2 %uint_2");
-    EXPECT_INST("%s = OpConstantNull %MyStruct");
+    EXPECT_INST(R"(
+          %8 = OpTypeCooperativeMatrixKHR %float %uint_3 %uint_4 %uint_8 %uint_0
+%_arr_8_uint_4 = OpTypeArray %8 %uint_4
+        %int = OpTypeInt 32 1
+     %uint_1 = OpConstant %uint 1
+         %16 = OpTypeCooperativeMatrixKHR %int %uint_3 %uint_8 %uint_4 %uint_1
+%_arr_16_uint_4 = OpTypeArray %16 %uint_4
+     %uint_2 = OpConstant %uint 2
+         %20 = OpTypeCooperativeMatrixKHR %uint %uint_3 %uint_2 %uint_2 %uint_2
+%_arr_20_uint_4 = OpTypeArray %20 %uint_4
+   %MyStruct = OpTypeStruct %_arr_8_uint_4 %_arr_16_uint_4 %_arr_20_uint_4
+    %float_0 = OpConstant %float 0
+         %23 = OpConstantComposite %8 %float_0
+         %22 = OpConstantComposite %_arr_8_uint_4 %23 %23 %23 %23
+      %int_0 = OpConstant %int 0
+         %26 = OpConstantComposite %16 %int_0
+         %25 = OpConstantComposite %_arr_16_uint_4 %26 %26 %26 %26
+         %29 = OpConstantComposite %20 %uint_0
+         %28 = OpConstantComposite %_arr_20_uint_4 %29 %29 %29 %29
+          %s = OpConstantComposite %MyStruct %22 %25 %28
+)");
 }
 
 }  // namespace
diff --git a/src/tint/lang/spirv/writer/printer/printer.cc b/src/tint/lang/spirv/writer/printer/printer.cc
index 3ed32b6..e8534b9 100644
--- a/src/tint/lang/spirv/writer/printer/printer.cc
+++ b/src/tint/lang/spirv/writer/printer/printer.cc
@@ -482,12 +482,35 @@
         return constant_nulls_.GetOrAdd(type, [&] {
             auto id = module_.NextId();
 
-            if (auto* sm = type->As<core::type::SubgroupMatrix>()) {
+            if (ContainsSubgroupMatrix(type)) {
                 // OpConstantNull is not supported for CooperativeMatrix types on some drivers, so
                 // use OpConstantComposite instead.
                 // See crbug.com/407532165.
-                module_.PushType(spv::Op::OpConstantComposite,
-                                 {Type(type), id, Constant(b_.Zero(sm->Type()))});
+                Switch(
+                    type,
+                    [&](const core::type::SubgroupMatrix* sm) {
+                        module_.PushType(spv::Op::OpConstantComposite,
+                                         {Type(type), id, Constant(b_.Zero(sm->Type()))});
+                    },
+                    [&](const core::type::Array* arr) {
+                        OperandList operands = {Type(arr), id};
+                        for (uint32_t i = 0; i < arr->ConstantCount(); i++) {
+                            operands.push_back(ConstantNull(arr->ElemType()));
+                        }
+                        module_.PushType(spv::Op::OpConstantComposite, operands);
+                    },
+                    [&](const core::type::Struct* str) {
+                        OperandList operands = {Type(str), id};
+                        for (auto* member : str->Members()) {
+                            if (ContainsSubgroupMatrix(member->Type())) {
+                                operands.push_back(ConstantNull(member->Type()));
+                            } else {
+                                operands.push_back(Constant(b_.Zero(member->Type())));
+                            }
+                        }
+                        module_.PushType(spv::Op::OpConstantComposite, operands);
+                    },
+                    TINT_ICE_ON_NO_MATCH);
             } else {
                 module_.PushType(spv::Op::OpConstantNull, {Type(type), id});
             }
@@ -524,9 +547,7 @@
                 [&](const core::type::U32*) {
                     module_.PushType(spv::Op::OpTypeInt, {id, 32u, 0u});
                 },
-                [&](const core::type::F32*) {
-                    module_.PushType(spv::Op::OpTypeFloat, {id, 32u});
-                },
+                [&](const core::type::F32*) { module_.PushType(spv::Op::OpTypeFloat, {id, 32u}); },
                 [&](const core::type::F16*) {
                     module_.PushCapability(SpvCapabilityFloat16);
                     module_.PushCapability(SpvCapabilityUniformAndStorageBuffer16BitAccess);
diff --git a/test/tint/extensions/subgroup_matrix/construct.wgsl.expected.spvasm b/test/tint/extensions/subgroup_matrix/construct.wgsl.expected.spvasm
index 71628c8..666d6f6 100644
--- a/test/tint/extensions/subgroup_matrix/construct.wgsl.expected.spvasm
+++ b/test/tint/extensions/subgroup_matrix/construct.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 1
-; Bound: 94
+; Bound: 95
 ; Schema: 0
                OpCapability Shader
                OpCapability VulkanMemoryModel
@@ -44,15 +44,16 @@
     %uint_64 = OpConstant %uint 64
      %uint_4 = OpConstant %uint 4
 %_arr_11_uint_4 = OpTypeArray %11 %uint_4
-         %23 = OpConstantNull %_arr_11_uint_4
+         %23 = OpConstantComposite %_arr_11_uint_4 %10 %10 %10 %10
 %_arr__arr_11_uint_4_uint_4 = OpTypeArray %_arr_11_uint_4 %uint_4
-         %30 = OpConstantNull %_arr__arr_11_uint_4_uint_4
+         %30 = OpConstantComposite %_arr__arr_11_uint_4_uint_4 %23 %23 %23 %23
      %uint_1 = OpConstant %uint 1
          %38 = OpTypeCooperativeMatrixKHR %float %uint_3 %uint_8 %uint_8 %uint_1
           %S = OpTypeStruct %11 %38
-         %36 = OpConstantNull %S
+         %40 = OpConstantComposite %38 %float_0
+         %36 = OpConstantComposite %S %10 %40
    %S_Nested = OpTypeStruct %S
-         %44 = OpConstantNull %S_Nested
+         %45 = OpConstantComposite %S_Nested %36
    %float_42 = OpConstant %float 42
   %float_100 = OpConstant %float 100
      %uint_2 = OpConstant %uint 2
@@ -73,50 +74,50 @@
          %33 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
          %34 = OpAccessChain %_ptr_StorageBuffer_float %33 %uint_0
                OpCooperativeMatrixStoreKHR %34 %32 %uint_0 %uint_64 NonPrivatePointer
-         %40 = OpCompositeExtract %11 %36 0
-         %41 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-         %42 = OpAccessChain %_ptr_StorageBuffer_float %41 %uint_0
-               OpCooperativeMatrixStoreKHR %42 %40 %uint_0 %uint_64 NonPrivatePointer
-         %46 = OpCompositeExtract %38 %44 0 1
-         %47 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-         %48 = OpAccessChain %_ptr_StorageBuffer_float %47 %uint_0
-               OpCooperativeMatrixStoreKHR %48 %46 %uint_0 %uint_64 NonPrivatePointer
-         %50 = OpCompositeConstruct %11 %float_42
-         %52 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-         %53 = OpAccessChain %_ptr_StorageBuffer_float %52 %uint_0
-               OpCooperativeMatrixStoreKHR %53 %50 %uint_0 %uint_64 NonPrivatePointer
-         %55 = OpCompositeConstruct %11 %float_42
-         %56 = OpCompositeConstruct %11 %float_100
-         %60 = OpCompositeConstruct %_arr_11_uint_2 %55 %56
-         %61 = OpCompositeExtract %11 %60 1
-         %62 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-         %63 = OpAccessChain %_ptr_StorageBuffer_float %62 %uint_0
-               OpCooperativeMatrixStoreKHR %63 %61 %uint_0 %uint_64 NonPrivatePointer
-         %65 = OpCompositeConstruct %11 %float_42
-         %66 = OpCompositeConstruct %11 %float_100
-         %67 = OpCompositeConstruct %_arr_11_uint_2 %65 %66
-         %68 = OpCompositeConstruct %11 %float_n7
-         %70 = OpCompositeConstruct %11 %float_n42
-         %72 = OpCompositeConstruct %_arr_11_uint_2 %68 %70
-         %74 = OpCompositeConstruct %_arr__arr_11_uint_2_uint_2 %67 %72
-         %75 = OpCompositeExtract %11 %74 1 0
-         %76 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-         %77 = OpAccessChain %_ptr_StorageBuffer_float %76 %uint_0
-               OpCooperativeMatrixStoreKHR %77 %75 %uint_0 %uint_64 NonPrivatePointer
-         %79 = OpCompositeConstruct %11 %float_42
-         %80 = OpCompositeConstruct %38 %float_100
-         %81 = OpCompositeConstruct %S %79 %80
-         %82 = OpCompositeExtract %11 %81 0
-         %83 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-         %84 = OpAccessChain %_ptr_StorageBuffer_float %83 %uint_0
-               OpCooperativeMatrixStoreKHR %84 %82 %uint_0 %uint_64 NonPrivatePointer
-         %86 = OpCompositeConstruct %11 %float_42
-         %87 = OpCompositeConstruct %38 %float_100
-         %88 = OpCompositeConstruct %S %86 %87
-         %89 = OpCompositeConstruct %S_Nested %88
-         %90 = OpCompositeExtract %38 %89 0 1
-         %91 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-         %92 = OpAccessChain %_ptr_StorageBuffer_float %91 %uint_0
-               OpCooperativeMatrixStoreKHR %92 %90 %uint_0 %uint_64 NonPrivatePointer
+         %41 = OpCompositeExtract %11 %36 0
+         %42 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+         %43 = OpAccessChain %_ptr_StorageBuffer_float %42 %uint_0
+               OpCooperativeMatrixStoreKHR %43 %41 %uint_0 %uint_64 NonPrivatePointer
+         %47 = OpCompositeExtract %38 %45 0 1
+         %48 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+         %49 = OpAccessChain %_ptr_StorageBuffer_float %48 %uint_0
+               OpCooperativeMatrixStoreKHR %49 %47 %uint_0 %uint_64 NonPrivatePointer
+         %51 = OpCompositeConstruct %11 %float_42
+         %53 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+         %54 = OpAccessChain %_ptr_StorageBuffer_float %53 %uint_0
+               OpCooperativeMatrixStoreKHR %54 %51 %uint_0 %uint_64 NonPrivatePointer
+         %56 = OpCompositeConstruct %11 %float_42
+         %57 = OpCompositeConstruct %11 %float_100
+         %61 = OpCompositeConstruct %_arr_11_uint_2 %56 %57
+         %62 = OpCompositeExtract %11 %61 1
+         %63 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+         %64 = OpAccessChain %_ptr_StorageBuffer_float %63 %uint_0
+               OpCooperativeMatrixStoreKHR %64 %62 %uint_0 %uint_64 NonPrivatePointer
+         %66 = OpCompositeConstruct %11 %float_42
+         %67 = OpCompositeConstruct %11 %float_100
+         %68 = OpCompositeConstruct %_arr_11_uint_2 %66 %67
+         %69 = OpCompositeConstruct %11 %float_n7
+         %71 = OpCompositeConstruct %11 %float_n42
+         %73 = OpCompositeConstruct %_arr_11_uint_2 %69 %71
+         %75 = OpCompositeConstruct %_arr__arr_11_uint_2_uint_2 %68 %73
+         %76 = OpCompositeExtract %11 %75 1 0
+         %77 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+         %78 = OpAccessChain %_ptr_StorageBuffer_float %77 %uint_0
+               OpCooperativeMatrixStoreKHR %78 %76 %uint_0 %uint_64 NonPrivatePointer
+         %80 = OpCompositeConstruct %11 %float_42
+         %81 = OpCompositeConstruct %38 %float_100
+         %82 = OpCompositeConstruct %S %80 %81
+         %83 = OpCompositeExtract %11 %82 0
+         %84 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+         %85 = OpAccessChain %_ptr_StorageBuffer_float %84 %uint_0
+               OpCooperativeMatrixStoreKHR %85 %83 %uint_0 %uint_64 NonPrivatePointer
+         %87 = OpCompositeConstruct %11 %float_42
+         %88 = OpCompositeConstruct %38 %float_100
+         %89 = OpCompositeConstruct %S %87 %88
+         %90 = OpCompositeConstruct %S_Nested %89
+         %91 = OpCompositeExtract %38 %90 0 1
+         %92 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+         %93 = OpAccessChain %_ptr_StorageBuffer_float %92 %uint_0
+               OpCooperativeMatrixStoreKHR %93 %91 %uint_0 %uint_64 NonPrivatePointer
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/extensions/subgroup_matrix/function_param.wgsl.expected.spvasm b/test/tint/extensions/subgroup_matrix/function_param.wgsl.expected.spvasm
index b6ed183..226b1ef 100644
--- a/test/tint/extensions/subgroup_matrix/function_param.wgsl.expected.spvasm
+++ b/test/tint/extensions/subgroup_matrix/function_param.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 1
-; Bound: 74
+; Bound: 75
 ; Schema: 0
                OpCapability Shader
                OpCapability VulkanMemoryModel
@@ -63,13 +63,14 @@
     %float_0 = OpConstant %float 0
          %54 = OpConstantComposite %8 %float_0
 %_ptr_Function__arr_8_uint_4 = OpTypePointer Function %_arr_8_uint_4
-         %58 = OpConstantNull %_arr_8_uint_4
+         %58 = OpConstantComposite %_arr_8_uint_4 %54 %54 %54 %54
 %_ptr_Function__arr__arr_8_uint_4_uint_4 = OpTypePointer Function %_arr__arr_8_uint_4_uint_4
-         %61 = OpConstantNull %_arr__arr_8_uint_4_uint_4
+         %61 = OpConstantComposite %_arr__arr_8_uint_4_uint_4 %58 %58 %58 %58
 %_ptr_Function_S = OpTypePointer Function %S
-         %64 = OpConstantNull %S
+         %65 = OpConstantComposite %20 %float_0
+         %64 = OpConstantComposite %S %54 %65
 %_ptr_Function_S_Nested = OpTypePointer Function %S_Nested
-         %67 = OpConstantNull %S_Nested
+         %68 = OpConstantComposite %S_Nested %64
         %foo = OpFunction %void None %25
           %m = OpFunctionParameter %8
     %m_array = OpFunctionParameter %_arr_8_uint_4
@@ -104,12 +105,12 @@
   %m_array_0 = OpVariable %_ptr_Function__arr_8_uint_4 Function %58
 %m_nested_array_0 = OpVariable %_ptr_Function__arr__arr_8_uint_4_uint_4 Function %61
  %m_struct_0 = OpVariable %_ptr_Function_S Function %64
-%m_nested_struct_0 = OpVariable %_ptr_Function_S_Nested Function %67
-         %68 = OpLoad %8 %m_0 None
-         %69 = OpLoad %_arr_8_uint_4 %m_array_0 None
-         %70 = OpLoad %_arr__arr_8_uint_4_uint_4 %m_nested_array_0 None
-         %71 = OpLoad %S %m_struct_0 None
-         %72 = OpLoad %S_Nested %m_nested_struct_0 None
-         %73 = OpFunctionCall %void %foo %68 %69 %70 %71 %72
+%m_nested_struct_0 = OpVariable %_ptr_Function_S_Nested Function %68
+         %69 = OpLoad %8 %m_0 None
+         %70 = OpLoad %_arr_8_uint_4 %m_array_0 None
+         %71 = OpLoad %_arr__arr_8_uint_4_uint_4 %m_nested_array_0 None
+         %72 = OpLoad %S %m_struct_0 None
+         %73 = OpLoad %S_Nested %m_nested_struct_0 None
+         %74 = OpFunctionCall %void %foo %69 %70 %71 %72 %73
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/extensions/subgroup_matrix/function_return_value.wgsl.expected.spvasm b/test/tint/extensions/subgroup_matrix/function_return_value.wgsl.expected.spvasm
index 7b20a5c..c667e55 100644
--- a/test/tint/extensions/subgroup_matrix/function_return_value.wgsl.expected.spvasm
+++ b/test/tint/extensions/subgroup_matrix/function_return_value.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 1
-; Bound: 85
+; Bound: 86
 ; Schema: 0
                OpCapability Shader
                OpCapability VulkanMemoryModel
@@ -53,23 +53,24 @@
 %_arr_7_uint_4 = OpTypeArray %7 %uint_4
          %22 = OpTypeFunction %_arr_7_uint_4
 %_ptr_Function__arr_7_uint_4 = OpTypePointer Function %_arr_7_uint_4
-         %26 = OpConstantNull %_arr_7_uint_4
+         %26 = OpConstantComposite %_arr_7_uint_4 %16 %16 %16 %16
 %_arr__arr_7_uint_4_uint_4 = OpTypeArray %_arr_7_uint_4 %uint_4
          %30 = OpTypeFunction %_arr__arr_7_uint_4_uint_4
 %_ptr_Function__arr__arr_7_uint_4_uint_4 = OpTypePointer Function %_arr__arr_7_uint_4_uint_4
-         %34 = OpConstantNull %_arr__arr_7_uint_4_uint_4
+         %34 = OpConstantComposite %_arr__arr_7_uint_4_uint_4 %26 %26 %26 %26
      %uint_1 = OpConstant %uint 1
          %38 = OpTypeCooperativeMatrixKHR %float %uint_3 %uint_8 %uint_8 %uint_1
           %S = OpTypeStruct %7 %38
          %40 = OpTypeFunction %S
 %_ptr_Function_S = OpTypePointer Function %S
-         %44 = OpConstantNull %S
+         %45 = OpConstantComposite %38 %float_0
+         %44 = OpConstantComposite %S %16 %45
    %S_Nested = OpTypeStruct %S
-         %48 = OpTypeFunction %S_Nested
+         %49 = OpTypeFunction %S_Nested
 %_ptr_Function_S_Nested = OpTypePointer Function %S_Nested
-         %52 = OpConstantNull %S_Nested
+         %53 = OpConstantComposite %S_Nested %44
        %void = OpTypeVoid
-         %56 = OpTypeFunction %void
+         %57 = OpTypeFunction %void
 %_ptr_StorageBuffer__runtimearr_float = OpTypePointer StorageBuffer %_runtimearr_float
 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
     %uint_64 = OpConstant %uint 64
@@ -94,40 +95,40 @@
 %make_struct = OpFunction %S None %40
          %41 = OpLabel
    %m_struct = OpVariable %_ptr_Function_S Function %44
-         %45 = OpLoad %S %m_struct None
-               OpReturnValue %45
+         %46 = OpLoad %S %m_struct None
+               OpReturnValue %46
                OpFunctionEnd
-%make_nested_struct = OpFunction %S_Nested None %48
-         %49 = OpLabel
-%m_nested_struct = OpVariable %_ptr_Function_S_Nested Function %52
-         %53 = OpLoad %S_Nested %m_nested_struct None
-               OpReturnValue %53
+%make_nested_struct = OpFunction %S_Nested None %49
+         %50 = OpLabel
+%m_nested_struct = OpVariable %_ptr_Function_S_Nested Function %53
+         %54 = OpLoad %S_Nested %m_nested_struct None
+               OpReturnValue %54
                OpFunctionEnd
-       %main = OpFunction %void None %56
-         %57 = OpLabel
-         %58 = OpFunctionCall %7 %make_matrix
-         %59 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-         %61 = OpAccessChain %_ptr_StorageBuffer_float %59 %uint_0
-               OpCooperativeMatrixStoreKHR %61 %58 %uint_0 %uint_64 NonPrivatePointer
-         %65 = OpFunctionCall %_arr_7_uint_4 %make_array
-         %66 = OpCompositeExtract %7 %65 0
-         %67 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-         %68 = OpAccessChain %_ptr_StorageBuffer_float %67 %uint_0
-               OpCooperativeMatrixStoreKHR %68 %66 %uint_0 %uint_64 NonPrivatePointer
-         %70 = OpFunctionCall %_arr__arr_7_uint_4_uint_4 %make_nested_array
-         %71 = OpCompositeExtract %7 %70 1 2
-         %72 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-         %73 = OpAccessChain %_ptr_StorageBuffer_float %72 %uint_0
-               OpCooperativeMatrixStoreKHR %73 %71 %uint_0 %uint_64 NonPrivatePointer
-         %75 = OpFunctionCall %S %make_struct
-         %76 = OpCompositeExtract %7 %75 0
-         %77 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-         %78 = OpAccessChain %_ptr_StorageBuffer_float %77 %uint_0
-               OpCooperativeMatrixStoreKHR %78 %76 %uint_0 %uint_64 NonPrivatePointer
-         %80 = OpFunctionCall %S_Nested %make_nested_struct
-         %81 = OpCompositeExtract %38 %80 0 1
-         %82 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-         %83 = OpAccessChain %_ptr_StorageBuffer_float %82 %uint_0
-               OpCooperativeMatrixStoreKHR %83 %81 %uint_0 %uint_64 NonPrivatePointer
+       %main = OpFunction %void None %57
+         %58 = OpLabel
+         %59 = OpFunctionCall %7 %make_matrix
+         %60 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+         %62 = OpAccessChain %_ptr_StorageBuffer_float %60 %uint_0
+               OpCooperativeMatrixStoreKHR %62 %59 %uint_0 %uint_64 NonPrivatePointer
+         %66 = OpFunctionCall %_arr_7_uint_4 %make_array
+         %67 = OpCompositeExtract %7 %66 0
+         %68 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+         %69 = OpAccessChain %_ptr_StorageBuffer_float %68 %uint_0
+               OpCooperativeMatrixStoreKHR %69 %67 %uint_0 %uint_64 NonPrivatePointer
+         %71 = OpFunctionCall %_arr__arr_7_uint_4_uint_4 %make_nested_array
+         %72 = OpCompositeExtract %7 %71 1 2
+         %73 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+         %74 = OpAccessChain %_ptr_StorageBuffer_float %73 %uint_0
+               OpCooperativeMatrixStoreKHR %74 %72 %uint_0 %uint_64 NonPrivatePointer
+         %76 = OpFunctionCall %S %make_struct
+         %77 = OpCompositeExtract %7 %76 0
+         %78 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+         %79 = OpAccessChain %_ptr_StorageBuffer_float %78 %uint_0
+               OpCooperativeMatrixStoreKHR %79 %77 %uint_0 %uint_64 NonPrivatePointer
+         %81 = OpFunctionCall %S_Nested %make_nested_struct
+         %82 = OpCompositeExtract %38 %81 0 1
+         %83 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+         %84 = OpAccessChain %_ptr_StorageBuffer_float %83 %uint_0
+               OpCooperativeMatrixStoreKHR %84 %82 %uint_0 %uint_64 NonPrivatePointer
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/extensions/subgroup_matrix/function_return_value_non_uniform.wgsl.expected.spvasm b/test/tint/extensions/subgroup_matrix/function_return_value_non_uniform.wgsl.expected.spvasm
index e8e6c88..e3a99b2 100644
--- a/test/tint/extensions/subgroup_matrix/function_return_value_non_uniform.wgsl.expected.spvasm
+++ b/test/tint/extensions/subgroup_matrix/function_return_value_non_uniform.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 1
-; Bound: 172
+; Bound: 173
 ; Schema: 0
                OpCapability Shader
                OpCapability VulkanMemoryModel
@@ -9,7 +9,7 @@
                OpCapability CooperativeMatrixKHR
                OpExtension "SPV_KHR_vulkan_memory_model"
                OpExtension "SPV_KHR_cooperative_matrix"
-        %137 = OpExtInstImport "GLSL.std.450"
+        %138 = OpExtInstImport "GLSL.std.450"
                OpMemoryModel Logical Vulkan
                OpEntryPoint GLCompute %main "main" %main_local_invocation_index_Input
                OpExecutionMode %main LocalSize 64 1 1
@@ -69,7 +69,7 @@
 %_arr_14_uint_2 = OpTypeArray %14 %uint_2
          %36 = OpTypeFunction %_arr_14_uint_2
 %_ptr_Function__arr_14_uint_2 = OpTypePointer Function %_arr_14_uint_2
-         %40 = OpConstantNull %_arr_14_uint_2
+         %40 = OpConstantComposite %_arr_14_uint_2 %22 %22
    %float_42 = OpConstant %float 42
   %float_100 = OpConstant %float 100
    %float_n7 = OpConstant %float -7
@@ -77,7 +77,7 @@
 %_arr__arr_14_uint_2_uint_2 = OpTypeArray %_arr_14_uint_2 %uint_2
          %58 = OpTypeFunction %_arr__arr_14_uint_2_uint_2
 %_ptr_Function__arr__arr_14_uint_2_uint_2 = OpTypePointer Function %_arr__arr_14_uint_2_uint_2
-         %62 = OpConstantNull %_arr__arr_14_uint_2_uint_2
+         %62 = OpConstantComposite %_arr__arr_14_uint_2_uint_2 %40 %40
     %float_7 = OpConstant %float 7
  %float_n100 = OpConstant %float -100
    %float_n1 = OpConstant %float -1
@@ -86,17 +86,18 @@
           %S = OpTypeStruct %14 %89
          %91 = OpTypeFunction %S
 %_ptr_Function_S = OpTypePointer Function %S
-         %95 = OpConstantNull %S
+         %96 = OpConstantComposite %89 %float_0
+         %95 = OpConstantComposite %S %22 %96
    %S_Nested = OpTypeStruct %S
-        %109 = OpTypeFunction %S_Nested
+        %110 = OpTypeFunction %S_Nested
 %_ptr_Function_S_Nested = OpTypePointer Function %S_Nested
-        %113 = OpConstantNull %S_Nested
+        %114 = OpConstantComposite %S_Nested %95
        %void = OpTypeVoid
-        %130 = OpTypeFunction %void %uint
+        %131 = OpTypeFunction %void %uint
 %_ptr_StorageBuffer__runtimearr_float = OpTypePointer StorageBuffer %_runtimearr_float
 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
     %uint_64 = OpConstant %uint 64
-        %168 = OpTypeFunction %void
+        %169 = OpTypeFunction %void
 %make_matrix = OpFunction %14 None %18
          %19 = OpLabel
 %return_value = OpVariable %_ptr_Function_14 Function %22
@@ -172,89 +173,89 @@
 %make_struct = OpFunction %S None %91
          %92 = OpLabel
 %return_value_2 = OpVariable %_ptr_Function_S Function %95
-         %96 = OpLoad %bool %non_uniform_condition None
-               OpSelectionMerge %97 None
-               OpBranchConditional %96 %98 %99
-         %98 = OpLabel
-        %101 = OpCompositeConstruct %14 %float_42
-        %102 = OpCompositeConstruct %89 %float_100
-        %103 = OpCompositeConstruct %S %101 %102
-               OpStore %return_value_2 %103 None
-               OpBranch %97
+         %97 = OpLoad %bool %non_uniform_condition None
+               OpSelectionMerge %98 None
+               OpBranchConditional %97 %99 %100
          %99 = OpLabel
-        %104 = OpCompositeConstruct %14 %float_n7
-        %105 = OpCompositeConstruct %89 %float_n42
-        %106 = OpCompositeConstruct %S %104 %105
-               OpStore %return_value_2 %106 None
-               OpBranch %97
-         %97 = OpLabel
-        %100 = OpLoad %S %return_value_2 None
-               OpReturnValue %100
+        %102 = OpCompositeConstruct %14 %float_42
+        %103 = OpCompositeConstruct %89 %float_100
+        %104 = OpCompositeConstruct %S %102 %103
+               OpStore %return_value_2 %104 None
+               OpBranch %98
+        %100 = OpLabel
+        %105 = OpCompositeConstruct %14 %float_n7
+        %106 = OpCompositeConstruct %89 %float_n42
+        %107 = OpCompositeConstruct %S %105 %106
+               OpStore %return_value_2 %107 None
+               OpBranch %98
+         %98 = OpLabel
+        %101 = OpLoad %S %return_value_2 None
+               OpReturnValue %101
                OpFunctionEnd
-%make_nested_struct = OpFunction %S_Nested None %109
-        %110 = OpLabel
-%return_value_3 = OpVariable %_ptr_Function_S_Nested Function %113
-        %114 = OpLoad %bool %non_uniform_condition None
-               OpSelectionMerge %115 None
-               OpBranchConditional %114 %116 %117
-        %116 = OpLabel
-        %119 = OpCompositeConstruct %14 %float_42
-        %120 = OpCompositeConstruct %89 %float_100
-        %121 = OpCompositeConstruct %S %119 %120
-        %122 = OpCompositeConstruct %S_Nested %121
-               OpStore %return_value_3 %122 None
-               OpBranch %115
+%make_nested_struct = OpFunction %S_Nested None %110
+        %111 = OpLabel
+%return_value_3 = OpVariable %_ptr_Function_S_Nested Function %114
+        %115 = OpLoad %bool %non_uniform_condition None
+               OpSelectionMerge %116 None
+               OpBranchConditional %115 %117 %118
         %117 = OpLabel
-        %123 = OpCompositeConstruct %14 %float_n7
-        %124 = OpCompositeConstruct %89 %float_n42
-        %125 = OpCompositeConstruct %S %123 %124
-        %126 = OpCompositeConstruct %S_Nested %125
-               OpStore %return_value_3 %126 None
-               OpBranch %115
-        %115 = OpLabel
-        %118 = OpLoad %S_Nested %return_value_3 None
-               OpReturnValue %118
+        %120 = OpCompositeConstruct %14 %float_42
+        %121 = OpCompositeConstruct %89 %float_100
+        %122 = OpCompositeConstruct %S %120 %121
+        %123 = OpCompositeConstruct %S_Nested %122
+               OpStore %return_value_3 %123 None
+               OpBranch %116
+        %118 = OpLabel
+        %124 = OpCompositeConstruct %14 %float_n7
+        %125 = OpCompositeConstruct %89 %float_n42
+        %126 = OpCompositeConstruct %S %124 %125
+        %127 = OpCompositeConstruct %S_Nested %126
+               OpStore %return_value_3 %127 None
+               OpBranch %116
+        %116 = OpLabel
+        %119 = OpLoad %S_Nested %return_value_3 None
+               OpReturnValue %119
                OpFunctionEnd
- %main_inner = OpFunction %void None %130
+ %main_inner = OpFunction %void None %131
         %idx = OpFunctionParameter %uint
-        %131 = OpLabel
-        %132 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-        %134 = OpArrayLength %uint %1 0
-        %135 = OpISub %uint %134 %uint_1
-        %136 = OpExtInst %uint %137 UMin %idx %135
-        %138 = OpAccessChain %_ptr_StorageBuffer_float %1 %uint_0 %136
-        %140 = OpLoad %float %138 NonPrivatePointer
-        %141 = OpFOrdEqual %bool %140 %float_0
-               OpStore %non_uniform_condition %141 None
-        %142 = OpFunctionCall %14 %make_matrix
-        %143 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-        %144 = OpAccessChain %_ptr_StorageBuffer_float %143 %uint_0
-               OpCooperativeMatrixStoreKHR %144 %142 %uint_0 %uint_64 NonPrivatePointer
-        %147 = OpFunctionCall %_arr_14_uint_2 %make_array
-        %148 = OpCompositeExtract %14 %147 0
-        %149 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-        %150 = OpAccessChain %_ptr_StorageBuffer_float %149 %uint_0
-               OpCooperativeMatrixStoreKHR %150 %148 %uint_0 %uint_64 NonPrivatePointer
-        %152 = OpFunctionCall %_arr__arr_14_uint_2_uint_2 %make_nested_array
-        %153 = OpCompositeExtract %14 %152 1 0
-        %154 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-        %155 = OpAccessChain %_ptr_StorageBuffer_float %154 %uint_0
-               OpCooperativeMatrixStoreKHR %155 %153 %uint_0 %uint_64 NonPrivatePointer
-        %157 = OpFunctionCall %S %make_struct
-        %158 = OpCompositeExtract %14 %157 0
-        %159 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-        %160 = OpAccessChain %_ptr_StorageBuffer_float %159 %uint_0
-               OpCooperativeMatrixStoreKHR %160 %158 %uint_0 %uint_64 NonPrivatePointer
-        %162 = OpFunctionCall %S_Nested %make_nested_struct
-        %163 = OpCompositeExtract %89 %162 0 1
-        %164 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-        %165 = OpAccessChain %_ptr_StorageBuffer_float %164 %uint_0
-               OpCooperativeMatrixStoreKHR %165 %163 %uint_0 %uint_64 NonPrivatePointer
+        %132 = OpLabel
+        %133 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+        %135 = OpArrayLength %uint %1 0
+        %136 = OpISub %uint %135 %uint_1
+        %137 = OpExtInst %uint %138 UMin %idx %136
+        %139 = OpAccessChain %_ptr_StorageBuffer_float %1 %uint_0 %137
+        %141 = OpLoad %float %139 NonPrivatePointer
+        %142 = OpFOrdEqual %bool %141 %float_0
+               OpStore %non_uniform_condition %142 None
+        %143 = OpFunctionCall %14 %make_matrix
+        %144 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+        %145 = OpAccessChain %_ptr_StorageBuffer_float %144 %uint_0
+               OpCooperativeMatrixStoreKHR %145 %143 %uint_0 %uint_64 NonPrivatePointer
+        %148 = OpFunctionCall %_arr_14_uint_2 %make_array
+        %149 = OpCompositeExtract %14 %148 0
+        %150 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+        %151 = OpAccessChain %_ptr_StorageBuffer_float %150 %uint_0
+               OpCooperativeMatrixStoreKHR %151 %149 %uint_0 %uint_64 NonPrivatePointer
+        %153 = OpFunctionCall %_arr__arr_14_uint_2_uint_2 %make_nested_array
+        %154 = OpCompositeExtract %14 %153 1 0
+        %155 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+        %156 = OpAccessChain %_ptr_StorageBuffer_float %155 %uint_0
+               OpCooperativeMatrixStoreKHR %156 %154 %uint_0 %uint_64 NonPrivatePointer
+        %158 = OpFunctionCall %S %make_struct
+        %159 = OpCompositeExtract %14 %158 0
+        %160 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+        %161 = OpAccessChain %_ptr_StorageBuffer_float %160 %uint_0
+               OpCooperativeMatrixStoreKHR %161 %159 %uint_0 %uint_64 NonPrivatePointer
+        %163 = OpFunctionCall %S_Nested %make_nested_struct
+        %164 = OpCompositeExtract %89 %163 0 1
+        %165 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+        %166 = OpAccessChain %_ptr_StorageBuffer_float %165 %uint_0
+               OpCooperativeMatrixStoreKHR %166 %164 %uint_0 %uint_64 NonPrivatePointer
                OpReturn
                OpFunctionEnd
-       %main = OpFunction %void None %168
-        %169 = OpLabel
-        %170 = OpLoad %uint %main_local_invocation_index_Input None
-        %171 = OpFunctionCall %void %main_inner %170
+       %main = OpFunction %void None %169
+        %170 = OpLabel
+        %171 = OpLoad %uint %main_local_invocation_index_Input None
+        %172 = OpFunctionCall %void %main_inner %171
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/extensions/subgroup_matrix/function_var.wgsl.expected.spvasm b/test/tint/extensions/subgroup_matrix/function_var.wgsl.expected.spvasm
index 291241c..787ba05 100644
--- a/test/tint/extensions/subgroup_matrix/function_var.wgsl.expected.spvasm
+++ b/test/tint/extensions/subgroup_matrix/function_var.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 1
-; Bound: 67
+; Bound: 68
 ; Schema: 0
                OpCapability Shader
                OpCapability VulkanMemoryModel
@@ -48,18 +48,19 @@
      %uint_4 = OpConstant %uint 4
 %_arr_12_uint_4 = OpTypeArray %12 %uint_4
 %_ptr_Function__arr_12_uint_4 = OpTypePointer Function %_arr_12_uint_4
-         %23 = OpConstantNull %_arr_12_uint_4
+         %23 = OpConstantComposite %_arr_12_uint_4 %17 %17 %17 %17
 %_arr__arr_12_uint_4_uint_4 = OpTypeArray %_arr_12_uint_4 %uint_4
 %_ptr_Function__arr__arr_12_uint_4_uint_4 = OpTypePointer Function %_arr__arr_12_uint_4_uint_4
-         %27 = OpConstantNull %_arr__arr_12_uint_4_uint_4
+         %27 = OpConstantComposite %_arr__arr_12_uint_4_uint_4 %23 %23 %23 %23
      %uint_1 = OpConstant %uint 1
          %31 = OpTypeCooperativeMatrixKHR %float %uint_3 %uint_8 %uint_8 %uint_1
           %S = OpTypeStruct %12 %31
 %_ptr_Function_S = OpTypePointer Function %S
-         %33 = OpConstantNull %S
+         %34 = OpConstantComposite %31 %float_0
+         %33 = OpConstantComposite %S %17 %34
    %S_Nested = OpTypeStruct %S
 %_ptr_Function_S_Nested = OpTypePointer Function %S_Nested
-         %37 = OpConstantNull %S_Nested
+         %38 = OpConstantComposite %S_Nested %33
 %_ptr_StorageBuffer__runtimearr_float = OpTypePointer StorageBuffer %_runtimearr_float
 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
     %uint_64 = OpConstant %uint 64
@@ -71,30 +72,30 @@
     %m_array = OpVariable %_ptr_Function__arr_12_uint_4 Function %23
 %m_nested_array = OpVariable %_ptr_Function__arr__arr_12_uint_4_uint_4 Function %27
    %m_struct = OpVariable %_ptr_Function_S Function %33
-%m_nested_struct = OpVariable %_ptr_Function_S_Nested Function %37
-         %38 = OpLoad %12 %m None
-         %39 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-         %41 = OpAccessChain %_ptr_StorageBuffer_float %39 %uint_0
-               OpCooperativeMatrixStoreKHR %41 %38 %uint_0 %uint_64 NonPrivatePointer
-         %45 = OpAccessChain %_ptr_Function_12 %m_array %uint_0
-         %46 = OpLoad %12 %45 None
-         %47 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-         %48 = OpAccessChain %_ptr_StorageBuffer_float %47 %uint_0
-               OpCooperativeMatrixStoreKHR %48 %46 %uint_0 %uint_64 NonPrivatePointer
-         %50 = OpAccessChain %_ptr_Function_12 %m_nested_array %uint_1 %uint_2
-         %52 = OpLoad %12 %50 None
-         %53 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-         %54 = OpAccessChain %_ptr_StorageBuffer_float %53 %uint_0
-               OpCooperativeMatrixStoreKHR %54 %52 %uint_0 %uint_64 NonPrivatePointer
-         %56 = OpAccessChain %_ptr_Function_12 %m_struct %uint_0
-         %57 = OpLoad %12 %56 None
-         %58 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-         %59 = OpAccessChain %_ptr_StorageBuffer_float %58 %uint_0
-               OpCooperativeMatrixStoreKHR %59 %57 %uint_0 %uint_64 NonPrivatePointer
-         %61 = OpAccessChain %_ptr_Function_31 %m_nested_struct %uint_0 %uint_1
-         %63 = OpLoad %31 %61 None
-         %64 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-         %65 = OpAccessChain %_ptr_StorageBuffer_float %64 %uint_0
-               OpCooperativeMatrixStoreKHR %65 %63 %uint_0 %uint_64 NonPrivatePointer
+%m_nested_struct = OpVariable %_ptr_Function_S_Nested Function %38
+         %39 = OpLoad %12 %m None
+         %40 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+         %42 = OpAccessChain %_ptr_StorageBuffer_float %40 %uint_0
+               OpCooperativeMatrixStoreKHR %42 %39 %uint_0 %uint_64 NonPrivatePointer
+         %46 = OpAccessChain %_ptr_Function_12 %m_array %uint_0
+         %47 = OpLoad %12 %46 None
+         %48 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+         %49 = OpAccessChain %_ptr_StorageBuffer_float %48 %uint_0
+               OpCooperativeMatrixStoreKHR %49 %47 %uint_0 %uint_64 NonPrivatePointer
+         %51 = OpAccessChain %_ptr_Function_12 %m_nested_array %uint_1 %uint_2
+         %53 = OpLoad %12 %51 None
+         %54 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+         %55 = OpAccessChain %_ptr_StorageBuffer_float %54 %uint_0
+               OpCooperativeMatrixStoreKHR %55 %53 %uint_0 %uint_64 NonPrivatePointer
+         %57 = OpAccessChain %_ptr_Function_12 %m_struct %uint_0
+         %58 = OpLoad %12 %57 None
+         %59 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+         %60 = OpAccessChain %_ptr_StorageBuffer_float %59 %uint_0
+               OpCooperativeMatrixStoreKHR %60 %58 %uint_0 %uint_64 NonPrivatePointer
+         %62 = OpAccessChain %_ptr_Function_31 %m_nested_struct %uint_0 %uint_1
+         %64 = OpLoad %31 %62 None
+         %65 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+         %66 = OpAccessChain %_ptr_StorageBuffer_float %65 %uint_0
+               OpCooperativeMatrixStoreKHR %66 %64 %uint_0 %uint_64 NonPrivatePointer
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/extensions/subgroup_matrix/let.wgsl.expected.spvasm b/test/tint/extensions/subgroup_matrix/let.wgsl.expected.spvasm
index a4b4c9d..9963b62 100644
--- a/test/tint/extensions/subgroup_matrix/let.wgsl.expected.spvasm
+++ b/test/tint/extensions/subgroup_matrix/let.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 1
-; Bound: 65
+; Bound: 66
 ; Schema: 0
                OpCapability Shader
                OpCapability VulkanMemoryModel
@@ -53,18 +53,19 @@
      %uint_4 = OpConstant %uint 4
 %_arr_12_uint_4 = OpTypeArray %12 %uint_4
 %_ptr_Function__arr_12_uint_4 = OpTypePointer Function %_arr_12_uint_4
-         %23 = OpConstantNull %_arr_12_uint_4
+         %23 = OpConstantComposite %_arr_12_uint_4 %17 %17 %17 %17
 %_arr__arr_12_uint_4_uint_4 = OpTypeArray %_arr_12_uint_4 %uint_4
 %_ptr_Function__arr__arr_12_uint_4_uint_4 = OpTypePointer Function %_arr__arr_12_uint_4_uint_4
-         %27 = OpConstantNull %_arr__arr_12_uint_4_uint_4
+         %27 = OpConstantComposite %_arr__arr_12_uint_4_uint_4 %23 %23 %23 %23
      %uint_1 = OpConstant %uint 1
          %31 = OpTypeCooperativeMatrixKHR %float %uint_3 %uint_8 %uint_8 %uint_1
           %S = OpTypeStruct %12 %31
 %_ptr_Function_S = OpTypePointer Function %S
-         %33 = OpConstantNull %S
+         %34 = OpConstantComposite %31 %float_0
+         %33 = OpConstantComposite %S %17 %34
    %S_Nested = OpTypeStruct %S
 %_ptr_Function_S_Nested = OpTypePointer Function %S_Nested
-         %37 = OpConstantNull %S_Nested
+         %38 = OpConstantComposite %S_Nested %33
 %_ptr_StorageBuffer__runtimearr_float = OpTypePointer StorageBuffer %_runtimearr_float
 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
     %uint_64 = OpConstant %uint 64
@@ -74,30 +75,30 @@
     %m_array = OpVariable %_ptr_Function__arr_12_uint_4 Function %23
 %m_nested_array = OpVariable %_ptr_Function__arr__arr_12_uint_4_uint_4 Function %27
    %m_struct = OpVariable %_ptr_Function_S Function %33
-%m_nested_struct = OpVariable %_ptr_Function_S_Nested Function %37
+%m_nested_struct = OpVariable %_ptr_Function_S_Nested Function %38
       %m_let = OpLoad %12 %m None
 %m_array_let = OpLoad %_arr_12_uint_4 %m_array None
 %m_nested_array_let = OpLoad %_arr__arr_12_uint_4_uint_4 %m_nested_array None
 %m_struct_let = OpLoad %S %m_struct None
 %m_nested_struct_let = OpLoad %S_Nested %m_nested_struct None
-         %43 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-         %45 = OpAccessChain %_ptr_StorageBuffer_float %43 %uint_0
-               OpCooperativeMatrixStoreKHR %45 %m_let %uint_0 %uint_64 NonPrivatePointer
-         %49 = OpCompositeExtract %12 %m_array_let 0
-         %50 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-         %51 = OpAccessChain %_ptr_StorageBuffer_float %50 %uint_0
-               OpCooperativeMatrixStoreKHR %51 %49 %uint_0 %uint_64 NonPrivatePointer
-         %53 = OpCompositeExtract %12 %m_nested_array_let 1 2
-         %54 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-         %55 = OpAccessChain %_ptr_StorageBuffer_float %54 %uint_0
-               OpCooperativeMatrixStoreKHR %55 %53 %uint_0 %uint_64 NonPrivatePointer
-         %57 = OpCompositeExtract %12 %m_struct_let 0
-         %58 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-         %59 = OpAccessChain %_ptr_StorageBuffer_float %58 %uint_0
-               OpCooperativeMatrixStoreKHR %59 %57 %uint_0 %uint_64 NonPrivatePointer
-         %61 = OpCompositeExtract %31 %m_nested_struct_let 0 1
-         %62 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
-         %63 = OpAccessChain %_ptr_StorageBuffer_float %62 %uint_0
-               OpCooperativeMatrixStoreKHR %63 %61 %uint_0 %uint_64 NonPrivatePointer
+         %44 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+         %46 = OpAccessChain %_ptr_StorageBuffer_float %44 %uint_0
+               OpCooperativeMatrixStoreKHR %46 %m_let %uint_0 %uint_64 NonPrivatePointer
+         %50 = OpCompositeExtract %12 %m_array_let 0
+         %51 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+         %52 = OpAccessChain %_ptr_StorageBuffer_float %51 %uint_0
+               OpCooperativeMatrixStoreKHR %52 %50 %uint_0 %uint_64 NonPrivatePointer
+         %54 = OpCompositeExtract %12 %m_nested_array_let 1 2
+         %55 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+         %56 = OpAccessChain %_ptr_StorageBuffer_float %55 %uint_0
+               OpCooperativeMatrixStoreKHR %56 %54 %uint_0 %uint_64 NonPrivatePointer
+         %58 = OpCompositeExtract %12 %m_struct_let 0
+         %59 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+         %60 = OpAccessChain %_ptr_StorageBuffer_float %59 %uint_0
+               OpCooperativeMatrixStoreKHR %60 %58 %uint_0 %uint_64 NonPrivatePointer
+         %62 = OpCompositeExtract %31 %m_nested_struct_let 0 1
+         %63 = OpAccessChain %_ptr_StorageBuffer__runtimearr_float %1 %uint_0
+         %64 = OpAccessChain %_ptr_StorageBuffer_float %63 %uint_0
+               OpCooperativeMatrixStoreKHR %64 %62 %uint_0 %uint_64 NonPrivatePointer
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/extensions/subgroup_matrix/pointers.wgsl.expected.spvasm b/test/tint/extensions/subgroup_matrix/pointers.wgsl.expected.spvasm
index 34408ff..36d1d2e 100644
--- a/test/tint/extensions/subgroup_matrix/pointers.wgsl.expected.spvasm
+++ b/test/tint/extensions/subgroup_matrix/pointers.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 1
-; Bound: 76
+; Bound: 77
 ; Schema: 0
                OpCapability Shader
                OpCapability VulkanMemoryModel
@@ -68,10 +68,11 @@
          %62 = OpTypeFunction %void
     %float_0 = OpConstant %float 0
          %65 = OpConstantComposite %9 %float_0
-         %68 = OpConstantNull %_arr_9_uint_4
-         %70 = OpConstantNull %_arr__arr_9_uint_4_uint_4
-         %72 = OpConstantNull %S
-         %74 = OpConstantNull %S_Nested
+         %68 = OpConstantComposite %_arr_9_uint_4 %65 %65 %65 %65
+         %70 = OpConstantComposite %_arr__arr_9_uint_4_uint_4 %68 %68 %68 %68
+         %73 = OpConstantComposite %24 %float_0
+         %72 = OpConstantComposite %S %65 %73
+         %75 = OpConstantComposite %S_Nested %72
         %foo = OpFunction %void None %30
      %m_root = OpFunctionParameter %_ptr_Function_9
 %m_array_root = OpFunctionParameter %_ptr_Function__arr_9_uint_4
@@ -111,7 +112,7 @@
     %m_array = OpVariable %_ptr_Function__arr_9_uint_4 Function %68
 %m_nested_array = OpVariable %_ptr_Function__arr__arr_9_uint_4_uint_4 Function %70
    %m_struct = OpVariable %_ptr_Function_S Function %72
-%m_nested_struct = OpVariable %_ptr_Function_S_Nested Function %74
-         %75 = OpFunctionCall %void %foo %m %m_array %m_nested_array %m_struct %m_nested_struct
+%m_nested_struct = OpVariable %_ptr_Function_S_Nested Function %75
+         %76 = OpFunctionCall %void %foo %m %m_array %m_nested_array %m_struct %m_nested_struct
                OpReturn
                OpFunctionEnd