reader/spirv: Decompose arrays with strides

Transform any SPIR-V that has an array with a custom stride:

  @stride(S) array<T, N>

into:

  struct strided_arr {
    @size(S) er : T;
  };
  array<strided_arr, N>

Also remove any @stride decorations that match the default array stride.

Bug: tint:1394
Bug: tint:1381
Change-Id: I8be8f3a76c5335fdb2bc5183388366091dbc7642
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/78781
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/test/array/strides.spvasm.expected.spvasm b/test/array/strides.spvasm.expected.spvasm
new file mode 100644
index 0000000..3108b19
--- /dev/null
+++ b/test/array/strides.spvasm.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 42
+; Schema: 0
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint GLCompute %f "f"
+               OpExecutionMode %f LocalSize 1 1 1
+               OpName %S "S"
+               OpMemberName %S 0 "a"
+               OpName %strided_arr_1 "strided_arr_1"
+               OpMemberName %strided_arr_1 0 "el"
+               OpName %strided_arr "strided_arr"
+               OpMemberName %strided_arr 0 "el"
+               OpName %s "s"
+               OpName %f_1 "f_1"
+               OpName %f "f"
+               OpDecorate %S Block
+               OpMemberDecorate %S 0 Offset 0
+               OpMemberDecorate %strided_arr_1 0 Offset 0
+               OpMemberDecorate %strided_arr 0 Offset 0
+               OpDecorate %_arr_strided_arr_uint_2 ArrayStride 8
+               OpDecorate %_arr__arr_strided_arr_uint_2_uint_3 ArrayStride 16
+               OpDecorate %_arr_strided_arr_1_uint_4 ArrayStride 128
+               OpDecorate %s DescriptorSet 0
+               OpDecorate %s Binding 0
+      %float = OpTypeFloat 32
+%strided_arr = OpTypeStruct %float
+       %uint = OpTypeInt 32 0
+     %uint_2 = OpConstant %uint 2
+%_arr_strided_arr_uint_2 = OpTypeArray %strided_arr %uint_2
+     %uint_3 = OpConstant %uint 3
+%_arr__arr_strided_arr_uint_2_uint_3 = OpTypeArray %_arr_strided_arr_uint_2 %uint_3
+%strided_arr_1 = OpTypeStruct %_arr__arr_strided_arr_uint_2_uint_3
+     %uint_4 = OpConstant %uint 4
+%_arr_strided_arr_1_uint_4 = OpTypeArray %strided_arr_1 %uint_4
+          %S = OpTypeStruct %_arr_strided_arr_1_uint_4
+%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
+          %s = OpVariable %_ptr_StorageBuffer_S StorageBuffer
+       %void = OpTypeVoid
+         %14 = OpTypeFunction %void
+     %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer__arr_strided_arr_1_uint_4 = OpTypePointer StorageBuffer %_arr_strided_arr_1_uint_4
+        %int = OpTypeInt 32 1
+      %int_3 = OpConstant %int 3
+%_ptr_StorageBuffer__arr__arr_strided_arr_uint_2_uint_3 = OpTypePointer StorageBuffer %_arr__arr_strided_arr_uint_2_uint_3
+      %int_2 = OpConstant %int 2
+%_ptr_StorageBuffer__arr_strided_arr_uint_2 = OpTypePointer StorageBuffer %_arr_strided_arr_uint_2
+      %int_1 = OpConstant %int 1
+%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
+         %36 = OpConstantNull %_arr_strided_arr_1_uint_4
+    %float_5 = OpConstant %float 5
+        %f_1 = OpFunction %void None %14
+         %17 = OpLabel
+         %20 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_1_uint_4 %s %uint_0
+         %21 = OpLoad %_arr_strided_arr_1_uint_4 %20
+         %25 = OpAccessChain %_ptr_StorageBuffer__arr__arr_strided_arr_uint_2_uint_3 %s %uint_0 %int_3 %uint_0
+         %26 = OpLoad %_arr__arr_strided_arr_uint_2_uint_3 %25
+         %29 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_uint_2 %s %uint_0 %int_3 %uint_0 %int_2
+         %30 = OpLoad %_arr_strided_arr_uint_2 %29
+         %33 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %int_3 %uint_0 %int_2 %int_1 %uint_0
+         %34 = OpLoad %float %33
+         %35 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_1_uint_4 %s %uint_0
+               OpStore %35 %36
+         %37 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %int_3 %uint_0 %int_2 %int_1 %uint_0
+               OpStore %37 %float_5
+               OpReturn
+               OpFunctionEnd
+          %f = OpFunction %void None %14
+         %40 = OpLabel
+         %41 = OpFunctionCall %void %f_1
+               OpReturn
+               OpFunctionEnd