PromoteSideEffectsToDecl: add to 4 backends and regen tests
Added to hlsl, msl, glsl, and spirv backends.
Bug: tint:1300
Change-Id: I06062bd8e4b32acbc4a8670b060a7a22bc1ae034
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80600
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
diff --git a/test/tint/array/assign_to_function_var.wgsl.expected.glsl b/test/tint/array/assign_to_function_var.wgsl.expected.glsl
index 70cfb8d..1440eef 100644
--- a/test/tint/array/assign_to_function_var.wgsl.expected.glsl
+++ b/test/tint/array/assign_to_function_var.wgsl.expected.glsl
@@ -18,20 +18,20 @@
ivec4 arr[4];
} src_storage;
ivec4[4] ret_arr() {
- ivec4 tint_symbol[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
- return tint_symbol;
+ ivec4 tint_symbol_1[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
+ return tint_symbol_1;
}
S ret_struct_arr() {
- S tint_symbol_1 = S(ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)));
- return tint_symbol_1;
+ S tint_symbol_2 = S(ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)));
+ return tint_symbol_2;
}
void foo(ivec4 src_param[4]) {
ivec4 src_function[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
ivec4 dst[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
- ivec4 tint_symbol_2[4] = ivec4[4](ivec4(1), ivec4(2), ivec4(3), ivec4(3));
- dst = tint_symbol_2;
+ ivec4 tint_symbol_3[4] = ivec4[4](ivec4(1), ivec4(2), ivec4(3), ivec4(3));
+ dst = tint_symbol_3;
dst = src_param;
dst = ret_arr();
ivec4 src_let[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
@@ -39,7 +39,8 @@
dst = src_function;
dst = src_private;
dst = src_workgroup;
- dst = ret_struct_arr().arr;
+ S tint_symbol = ret_struct_arr();
+ dst = tint_symbol.arr;
dst = src_uniform.arr;
dst = src_storage.arr;
int dst_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
diff --git a/test/tint/array/assign_to_function_var.wgsl.expected.hlsl b/test/tint/array/assign_to_function_var.wgsl.expected.hlsl
index eda01ad..caa64fd 100644
--- a/test/tint/array/assign_to_function_var.wgsl.expected.hlsl
+++ b/test/tint/array/assign_to_function_var.wgsl.expected.hlsl
@@ -16,17 +16,17 @@
typedef int4 ret_arr_ret[4];
ret_arr_ret ret_arr() {
- const int4 tint_symbol_5[4] = (int4[4])0;
- return tint_symbol_5;
-}
-
-S ret_struct_arr() {
- const S tint_symbol_6 = (S)0;
+ const int4 tint_symbol_6[4] = (int4[4])0;
return tint_symbol_6;
}
-typedef int4 tint_symbol_1_ret[4];
-tint_symbol_1_ret tint_symbol_1(uint4 buffer[4], uint offset) {
+S ret_struct_arr() {
+ const S tint_symbol_7 = (S)0;
+ return tint_symbol_7;
+}
+
+typedef int4 tint_symbol_2_ret[4];
+tint_symbol_2_ret tint_symbol_2(uint4 buffer[4], uint offset) {
int4 arr_1[4] = (int4[4])0;
{
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
@@ -37,8 +37,8 @@
return arr_1;
}
-typedef int4 tint_symbol_3_ret[4];
-tint_symbol_3_ret tint_symbol_3(RWByteAddressBuffer buffer, uint offset) {
+typedef int4 tint_symbol_4_ret[4];
+tint_symbol_4_ret tint_symbol_4(RWByteAddressBuffer buffer, uint offset) {
int4 arr_2[4] = (int4[4])0;
{
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
@@ -51,8 +51,8 @@
void foo(int4 src_param[4]) {
int4 src_function[4] = (int4[4])0;
int4 tint_symbol[4] = (int4[4])0;
- const int4 tint_symbol_7[4] = {int4((1).xxxx), int4((2).xxxx), int4((3).xxxx), int4((3).xxxx)};
- tint_symbol = tint_symbol_7;
+ const int4 tint_symbol_8[4] = {int4((1).xxxx), int4((2).xxxx), int4((3).xxxx), int4((3).xxxx)};
+ tint_symbol = tint_symbol_8;
tint_symbol = src_param;
tint_symbol = ret_arr();
const int4 src_let[4] = (int4[4])0;
@@ -60,9 +60,10 @@
tint_symbol = src_function;
tint_symbol = src_private;
tint_symbol = src_workgroup;
- tint_symbol = ret_struct_arr().arr;
- tint_symbol = tint_symbol_1(src_uniform, 0u);
- tint_symbol = tint_symbol_3(src_storage, 0u);
+ const S tint_symbol_1 = ret_struct_arr();
+ tint_symbol = tint_symbol_1.arr;
+ tint_symbol = tint_symbol_2(src_uniform, 0u);
+ tint_symbol = tint_symbol_4(src_storage, 0u);
int dst_nested[4][3][2] = (int[4][3][2])0;
int src_nested[4][3][2] = (int[4][3][2])0;
dst_nested = src_nested;
diff --git a/test/tint/array/assign_to_function_var.wgsl.expected.msl b/test/tint/array/assign_to_function_var.wgsl.expected.msl
index 9d12733..39cf432 100644
--- a/test/tint/array/assign_to_function_var.wgsl.expected.msl
+++ b/test/tint/array/assign_to_function_var.wgsl.expected.msl
@@ -10,13 +10,13 @@
};
tint_array_wrapper ret_arr() {
- tint_array_wrapper const tint_symbol = {.arr={}};
- return tint_symbol;
+ tint_array_wrapper const tint_symbol_1 = {.arr={}};
+ return tint_symbol_1;
}
S ret_struct_arr() {
- S const tint_symbol_1 = {};
- return tint_symbol_1;
+ S const tint_symbol_2 = {};
+ return tint_symbol_2;
}
struct tint_array_wrapper_3 {
@@ -31,21 +31,22 @@
tint_array_wrapper_2 arr[4];
};
-void foo(tint_array_wrapper src_param, thread tint_array_wrapper* const tint_symbol_3, threadgroup tint_array_wrapper* const tint_symbol_4, const constant S* const tint_symbol_5, device S* const tint_symbol_6) {
+void foo(tint_array_wrapper src_param, thread tint_array_wrapper* const tint_symbol_4, threadgroup tint_array_wrapper* const tint_symbol_5, const constant S* const tint_symbol_6, device S* const tint_symbol_7) {
tint_array_wrapper src_function = {};
tint_array_wrapper dst = {};
- tint_array_wrapper const tint_symbol_2 = {.arr={int4(1), int4(2), int4(3), int4(3)}};
- dst = tint_symbol_2;
+ tint_array_wrapper const tint_symbol_3 = {.arr={int4(1), int4(2), int4(3), int4(3)}};
+ dst = tint_symbol_3;
dst = src_param;
dst = ret_arr();
tint_array_wrapper const src_let = {.arr={}};
dst = src_let;
dst = src_function;
- dst = *(tint_symbol_3);
dst = *(tint_symbol_4);
- dst = ret_struct_arr().arr;
- dst = (*(tint_symbol_5)).arr;
+ dst = *(tint_symbol_5);
+ S const tint_symbol = ret_struct_arr();
+ dst = tint_symbol.arr;
dst = (*(tint_symbol_6)).arr;
+ dst = (*(tint_symbol_7)).arr;
tint_array_wrapper_1 dst_nested = {};
tint_array_wrapper_1 src_nested = {};
dst_nested = src_nested;
diff --git a/test/tint/array/assign_to_private_var.wgsl.expected.glsl b/test/tint/array/assign_to_private_var.wgsl.expected.glsl
index 4911005..7c59609 100644
--- a/test/tint/array/assign_to_private_var.wgsl.expected.glsl
+++ b/test/tint/array/assign_to_private_var.wgsl.expected.glsl
@@ -20,19 +20,19 @@
ivec4 dst[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
int dst_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
ivec4[4] ret_arr() {
- ivec4 tint_symbol[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
- return tint_symbol;
+ ivec4 tint_symbol_1[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
+ return tint_symbol_1;
}
S ret_struct_arr() {
- S tint_symbol_1 = S(ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)));
- return tint_symbol_1;
+ S tint_symbol_2 = S(ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)));
+ return tint_symbol_2;
}
void foo(ivec4 src_param[4]) {
ivec4 src_function[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
- ivec4 tint_symbol_2[4] = ivec4[4](ivec4(1), ivec4(2), ivec4(3), ivec4(3));
- dst = tint_symbol_2;
+ ivec4 tint_symbol_3[4] = ivec4[4](ivec4(1), ivec4(2), ivec4(3), ivec4(3));
+ dst = tint_symbol_3;
dst = src_param;
dst = ret_arr();
ivec4 src_let[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
@@ -40,7 +40,8 @@
dst = src_function;
dst = src_private;
dst = src_workgroup;
- dst = ret_struct_arr().arr;
+ S tint_symbol = ret_struct_arr();
+ dst = tint_symbol.arr;
dst = src_uniform.arr;
dst = src_storage.arr;
int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
diff --git a/test/tint/array/assign_to_private_var.wgsl.expected.hlsl b/test/tint/array/assign_to_private_var.wgsl.expected.hlsl
index ddb084e..38b1759 100644
--- a/test/tint/array/assign_to_private_var.wgsl.expected.hlsl
+++ b/test/tint/array/assign_to_private_var.wgsl.expected.hlsl
@@ -18,17 +18,17 @@
typedef int4 ret_arr_ret[4];
ret_arr_ret ret_arr() {
- const int4 tint_symbol_5[4] = (int4[4])0;
- return tint_symbol_5;
-}
-
-S ret_struct_arr() {
- const S tint_symbol_6 = (S)0;
+ const int4 tint_symbol_6[4] = (int4[4])0;
return tint_symbol_6;
}
-typedef int4 tint_symbol_1_ret[4];
-tint_symbol_1_ret tint_symbol_1(uint4 buffer[4], uint offset) {
+S ret_struct_arr() {
+ const S tint_symbol_7 = (S)0;
+ return tint_symbol_7;
+}
+
+typedef int4 tint_symbol_2_ret[4];
+tint_symbol_2_ret tint_symbol_2(uint4 buffer[4], uint offset) {
int4 arr_1[4] = (int4[4])0;
{
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
@@ -39,8 +39,8 @@
return arr_1;
}
-typedef int4 tint_symbol_3_ret[4];
-tint_symbol_3_ret tint_symbol_3(RWByteAddressBuffer buffer, uint offset) {
+typedef int4 tint_symbol_4_ret[4];
+tint_symbol_4_ret tint_symbol_4(RWByteAddressBuffer buffer, uint offset) {
int4 arr_2[4] = (int4[4])0;
{
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
@@ -52,8 +52,8 @@
void foo(int4 src_param[4]) {
int4 src_function[4] = (int4[4])0;
- const int4 tint_symbol_7[4] = {int4((1).xxxx), int4((2).xxxx), int4((3).xxxx), int4((3).xxxx)};
- tint_symbol = tint_symbol_7;
+ const int4 tint_symbol_8[4] = {int4((1).xxxx), int4((2).xxxx), int4((3).xxxx), int4((3).xxxx)};
+ tint_symbol = tint_symbol_8;
tint_symbol = src_param;
tint_symbol = ret_arr();
const int4 src_let[4] = (int4[4])0;
@@ -61,9 +61,10 @@
tint_symbol = src_function;
tint_symbol = src_private;
tint_symbol = src_workgroup;
- tint_symbol = ret_struct_arr().arr;
- tint_symbol = tint_symbol_1(src_uniform, 0u);
- tint_symbol = tint_symbol_3(src_storage, 0u);
+ const S tint_symbol_1 = ret_struct_arr();
+ tint_symbol = tint_symbol_1.arr;
+ tint_symbol = tint_symbol_2(src_uniform, 0u);
+ tint_symbol = tint_symbol_4(src_storage, 0u);
int src_nested[4][3][2] = (int[4][3][2])0;
dst_nested = src_nested;
}
diff --git a/test/tint/array/assign_to_private_var.wgsl.expected.msl b/test/tint/array/assign_to_private_var.wgsl.expected.msl
index d5127b1..be8972f 100644
--- a/test/tint/array/assign_to_private_var.wgsl.expected.msl
+++ b/test/tint/array/assign_to_private_var.wgsl.expected.msl
@@ -22,30 +22,31 @@
};
tint_array_wrapper ret_arr() {
- tint_array_wrapper const tint_symbol = {.arr={}};
- return tint_symbol;
-}
-
-S ret_struct_arr() {
- S const tint_symbol_1 = {};
+ tint_array_wrapper const tint_symbol_1 = {.arr={}};
return tint_symbol_1;
}
-void foo(tint_array_wrapper src_param, thread tint_array_wrapper* const tint_symbol_3, thread tint_array_wrapper* const tint_symbol_4, threadgroup tint_array_wrapper* const tint_symbol_5, const constant S* const tint_symbol_6, device S* const tint_symbol_7, thread tint_array_wrapper_1* const tint_symbol_8) {
+S ret_struct_arr() {
+ S const tint_symbol_2 = {};
+ return tint_symbol_2;
+}
+
+void foo(tint_array_wrapper src_param, thread tint_array_wrapper* const tint_symbol_4, thread tint_array_wrapper* const tint_symbol_5, threadgroup tint_array_wrapper* const tint_symbol_6, const constant S* const tint_symbol_7, device S* const tint_symbol_8, thread tint_array_wrapper_1* const tint_symbol_9) {
tint_array_wrapper src_function = {};
- tint_array_wrapper const tint_symbol_2 = {.arr={int4(1), int4(2), int4(3), int4(3)}};
- *(tint_symbol_3) = tint_symbol_2;
- *(tint_symbol_3) = src_param;
- *(tint_symbol_3) = ret_arr();
+ tint_array_wrapper const tint_symbol_3 = {.arr={int4(1), int4(2), int4(3), int4(3)}};
+ *(tint_symbol_4) = tint_symbol_3;
+ *(tint_symbol_4) = src_param;
+ *(tint_symbol_4) = ret_arr();
tint_array_wrapper const src_let = {.arr={}};
- *(tint_symbol_3) = src_let;
- *(tint_symbol_3) = src_function;
- *(tint_symbol_3) = *(tint_symbol_4);
- *(tint_symbol_3) = *(tint_symbol_5);
- *(tint_symbol_3) = ret_struct_arr().arr;
- *(tint_symbol_3) = (*(tint_symbol_6)).arr;
- *(tint_symbol_3) = (*(tint_symbol_7)).arr;
+ *(tint_symbol_4) = src_let;
+ *(tint_symbol_4) = src_function;
+ *(tint_symbol_4) = *(tint_symbol_5);
+ *(tint_symbol_4) = *(tint_symbol_6);
+ S const tint_symbol = ret_struct_arr();
+ *(tint_symbol_4) = tint_symbol.arr;
+ *(tint_symbol_4) = (*(tint_symbol_7)).arr;
+ *(tint_symbol_4) = (*(tint_symbol_8)).arr;
tint_array_wrapper_1 src_nested = {};
- *(tint_symbol_8) = src_nested;
+ *(tint_symbol_9) = src_nested;
}
diff --git a/test/tint/array/assign_to_storage_var.wgsl.expected.glsl b/test/tint/array/assign_to_storage_var.wgsl.expected.glsl
index 60a16bb..33c0123 100644
--- a/test/tint/array/assign_to_storage_var.wgsl.expected.glsl
+++ b/test/tint/array/assign_to_storage_var.wgsl.expected.glsl
@@ -28,27 +28,29 @@
int arr[4][3][2];
} dst_nested;
ivec4[4] ret_arr() {
- ivec4 tint_symbol[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
- return tint_symbol;
+ ivec4 tint_symbol_2[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
+ return tint_symbol_2;
}
S ret_struct_arr() {
- S tint_symbol_1 = S(ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)));
- return tint_symbol_1;
+ S tint_symbol_3 = S(ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)));
+ return tint_symbol_3;
}
void foo(ivec4 src_param[4]) {
ivec4 src_function[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
- ivec4 tint_symbol_2[4] = ivec4[4](ivec4(1), ivec4(2), ivec4(3), ivec4(3));
- dst.arr = tint_symbol_2;
+ ivec4 tint_symbol_4[4] = ivec4[4](ivec4(1), ivec4(2), ivec4(3), ivec4(3));
+ dst.arr = tint_symbol_4;
dst.arr = src_param;
- dst.arr = ret_arr();
+ ivec4 tint_symbol[4] = ret_arr();
+ dst.arr = tint_symbol;
ivec4 src_let[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
dst.arr = src_let;
dst.arr = src_function;
dst.arr = src_private;
dst.arr = src_workgroup;
- dst.arr = ret_struct_arr().arr;
+ S tint_symbol_1 = ret_struct_arr();
+ dst.arr = tint_symbol_1.arr;
dst.arr = src_uniform.arr;
dst.arr = src_storage.arr;
int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
diff --git a/test/tint/array/assign_to_storage_var.wgsl.expected.hlsl b/test/tint/array/assign_to_storage_var.wgsl.expected.hlsl
index c940b98..fa5b2d8 100644
--- a/test/tint/array/assign_to_storage_var.wgsl.expected.hlsl
+++ b/test/tint/array/assign_to_storage_var.wgsl.expected.hlsl
@@ -18,16 +18,16 @@
typedef int4 ret_arr_ret[4];
ret_arr_ret ret_arr() {
- const int4 tint_symbol_11[4] = (int4[4])0;
- return tint_symbol_11;
+ const int4 tint_symbol_13[4] = (int4[4])0;
+ return tint_symbol_13;
}
S ret_struct_arr() {
- const S tint_symbol_12 = (S)0;
- return tint_symbol_12;
+ const S tint_symbol_14 = (S)0;
+ return tint_symbol_14;
}
-void tint_symbol_1(RWByteAddressBuffer buffer, uint offset, int4 value[4]) {
+void tint_symbol_3(RWByteAddressBuffer buffer, uint offset, int4 value[4]) {
int4 array[4] = value;
{
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
@@ -36,8 +36,8 @@
}
}
-typedef int4 tint_symbol_3_ret[4];
-tint_symbol_3_ret tint_symbol_3(uint4 buffer[4], uint offset) {
+typedef int4 tint_symbol_5_ret[4];
+tint_symbol_5_ret tint_symbol_5(uint4 buffer[4], uint offset) {
int4 arr_1[4] = (int4[4])0;
{
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
@@ -48,8 +48,8 @@
return arr_1;
}
-typedef int4 tint_symbol_5_ret[4];
-tint_symbol_5_ret tint_symbol_5(RWByteAddressBuffer buffer, uint offset) {
+typedef int4 tint_symbol_7_ret[4];
+tint_symbol_7_ret tint_symbol_7(RWByteAddressBuffer buffer, uint offset) {
int4 arr_2[4] = (int4[4])0;
{
[loop] for(uint i_2 = 0u; (i_2 < 4u); i_2 = (i_2 + 1u)) {
@@ -59,7 +59,7 @@
return arr_2;
}
-void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, int value[2]) {
+void tint_symbol_11(RWByteAddressBuffer buffer, uint offset, int value[2]) {
int array_3[2] = value;
{
[loop] for(uint i_3 = 0u; (i_3 < 2u); i_3 = (i_3 + 1u)) {
@@ -68,38 +68,40 @@
}
}
-void tint_symbol_8(RWByteAddressBuffer buffer, uint offset, int value[3][2]) {
+void tint_symbol_10(RWByteAddressBuffer buffer, uint offset, int value[3][2]) {
int array_2[3][2] = value;
{
[loop] for(uint i_4 = 0u; (i_4 < 3u); i_4 = (i_4 + 1u)) {
- tint_symbol_9(buffer, (offset + (i_4 * 8u)), array_2[i_4]);
+ tint_symbol_11(buffer, (offset + (i_4 * 8u)), array_2[i_4]);
}
}
}
-void tint_symbol_7(RWByteAddressBuffer buffer, uint offset, int value[4][3][2]) {
+void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, int value[4][3][2]) {
int array_1[4][3][2] = value;
{
[loop] for(uint i_5 = 0u; (i_5 < 4u); i_5 = (i_5 + 1u)) {
- tint_symbol_8(buffer, (offset + (i_5 * 24u)), array_1[i_5]);
+ tint_symbol_10(buffer, (offset + (i_5 * 24u)), array_1[i_5]);
}
}
}
void foo(int4 src_param[4]) {
int4 src_function[4] = (int4[4])0;
- const int4 tint_symbol_13[4] = {int4((1).xxxx), int4((2).xxxx), int4((3).xxxx), int4((3).xxxx)};
- tint_symbol_1(tint_symbol, 0u, tint_symbol_13);
- tint_symbol_1(tint_symbol, 0u, src_param);
- tint_symbol_1(tint_symbol, 0u, ret_arr());
+ const int4 tint_symbol_15[4] = {int4((1).xxxx), int4((2).xxxx), int4((3).xxxx), int4((3).xxxx)};
+ tint_symbol_3(tint_symbol, 0u, tint_symbol_15);
+ tint_symbol_3(tint_symbol, 0u, src_param);
+ const int4 tint_symbol_1[4] = ret_arr();
+ tint_symbol_3(tint_symbol, 0u, tint_symbol_1);
const int4 src_let[4] = (int4[4])0;
- tint_symbol_1(tint_symbol, 0u, src_let);
- tint_symbol_1(tint_symbol, 0u, src_function);
- tint_symbol_1(tint_symbol, 0u, src_private);
- tint_symbol_1(tint_symbol, 0u, src_workgroup);
- tint_symbol_1(tint_symbol, 0u, ret_struct_arr().arr);
- tint_symbol_1(tint_symbol, 0u, tint_symbol_3(src_uniform, 0u));
- tint_symbol_1(tint_symbol, 0u, tint_symbol_5(src_storage, 0u));
+ tint_symbol_3(tint_symbol, 0u, src_let);
+ tint_symbol_3(tint_symbol, 0u, src_function);
+ tint_symbol_3(tint_symbol, 0u, src_private);
+ tint_symbol_3(tint_symbol, 0u, src_workgroup);
+ const S tint_symbol_2 = ret_struct_arr();
+ tint_symbol_3(tint_symbol, 0u, tint_symbol_2.arr);
+ tint_symbol_3(tint_symbol, 0u, tint_symbol_5(src_uniform, 0u));
+ tint_symbol_3(tint_symbol, 0u, tint_symbol_7(src_storage, 0u));
int src_nested[4][3][2] = (int[4][3][2])0;
- tint_symbol_7(dst_nested, 0u, src_nested);
+ tint_symbol_9(dst_nested, 0u, src_nested);
}
diff --git a/test/tint/array/assign_to_storage_var.wgsl.expected.msl b/test/tint/array/assign_to_storage_var.wgsl.expected.msl
index b4ba58a..3bf3ccb 100644
--- a/test/tint/array/assign_to_storage_var.wgsl.expected.msl
+++ b/test/tint/array/assign_to_storage_var.wgsl.expected.msl
@@ -26,30 +26,32 @@
};
tint_array_wrapper ret_arr() {
- tint_array_wrapper const tint_symbol = {.arr={}};
- return tint_symbol;
+ tint_array_wrapper const tint_symbol_2 = {.arr={}};
+ return tint_symbol_2;
}
S ret_struct_arr() {
- S const tint_symbol_1 = {};
- return tint_symbol_1;
+ S const tint_symbol_3 = {};
+ return tint_symbol_3;
}
-void foo(tint_array_wrapper src_param, device S* const tint_symbol_3, thread tint_array_wrapper* const tint_symbol_4, threadgroup tint_array_wrapper* const tint_symbol_5, const constant S* const tint_symbol_6, device S* const tint_symbol_7, device S_nested* const tint_symbol_8) {
+void foo(tint_array_wrapper src_param, device S* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6, threadgroup tint_array_wrapper* const tint_symbol_7, const constant S* const tint_symbol_8, device S* const tint_symbol_9, device S_nested* const tint_symbol_10) {
tint_array_wrapper src_function = {};
- tint_array_wrapper const tint_symbol_2 = {.arr={int4(1), int4(2), int4(3), int4(3)}};
- (*(tint_symbol_3)).arr = tint_symbol_2;
- (*(tint_symbol_3)).arr = src_param;
- (*(tint_symbol_3)).arr = ret_arr();
+ tint_array_wrapper const tint_symbol_4 = {.arr={int4(1), int4(2), int4(3), int4(3)}};
+ (*(tint_symbol_5)).arr = tint_symbol_4;
+ (*(tint_symbol_5)).arr = src_param;
+ tint_array_wrapper const tint_symbol = ret_arr();
+ (*(tint_symbol_5)).arr = tint_symbol;
tint_array_wrapper const src_let = {.arr={}};
- (*(tint_symbol_3)).arr = src_let;
- (*(tint_symbol_3)).arr = src_function;
- (*(tint_symbol_3)).arr = *(tint_symbol_4);
- (*(tint_symbol_3)).arr = *(tint_symbol_5);
- (*(tint_symbol_3)).arr = ret_struct_arr().arr;
- (*(tint_symbol_3)).arr = (*(tint_symbol_6)).arr;
- (*(tint_symbol_3)).arr = (*(tint_symbol_7)).arr;
+ (*(tint_symbol_5)).arr = src_let;
+ (*(tint_symbol_5)).arr = src_function;
+ (*(tint_symbol_5)).arr = *(tint_symbol_6);
+ (*(tint_symbol_5)).arr = *(tint_symbol_7);
+ S const tint_symbol_1 = ret_struct_arr();
+ (*(tint_symbol_5)).arr = tint_symbol_1.arr;
+ (*(tint_symbol_5)).arr = (*(tint_symbol_8)).arr;
+ (*(tint_symbol_5)).arr = (*(tint_symbol_9)).arr;
tint_array_wrapper_1 src_nested = {};
- (*(tint_symbol_8)).arr = src_nested;
+ (*(tint_symbol_10)).arr = src_nested;
}
diff --git a/test/tint/array/assign_to_storage_var.wgsl.expected.spvasm b/test/tint/array/assign_to_storage_var.wgsl.expected.spvasm
index e4da62a..f33dfbe 100644
--- a/test/tint/array/assign_to_storage_var.wgsl.expected.spvasm
+++ b/test/tint/array/assign_to_storage_var.wgsl.expected.spvasm
@@ -106,9 +106,9 @@
OpStore %44 %51
%52 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
OpStore %52 %src_param
- %53 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
- %54 = OpFunctionCall %_arr_v4int_uint_4 %ret_arr
- OpStore %53 %54
+ %53 = OpFunctionCall %_arr_v4int_uint_4 %ret_arr
+ %54 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
+ OpStore %54 %53
%55 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
OpStore %55 %8
%56 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
@@ -120,10 +120,10 @@
%60 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
%61 = OpLoad %_arr_v4int_uint_4 %src_workgroup
OpStore %60 %61
- %62 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
- %63 = OpFunctionCall %S %ret_struct_arr
- %64 = OpCompositeExtract %_arr_v4int_uint_4 %63 0
- OpStore %62 %64
+ %62 = OpFunctionCall %S %ret_struct_arr
+ %63 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
+ %64 = OpCompositeExtract %_arr_v4int_uint_4 %62 0
+ OpStore %63 %64
%65 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
%67 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %src_uniform %uint_0
%68 = OpLoad %_arr_v4int_uint_4 %67
diff --git a/test/tint/array/assign_to_workgroup_var.wgsl.expected.glsl b/test/tint/array/assign_to_workgroup_var.wgsl.expected.glsl
index a4a0b8b..9c78086 100644
--- a/test/tint/array/assign_to_workgroup_var.wgsl.expected.glsl
+++ b/test/tint/array/assign_to_workgroup_var.wgsl.expected.glsl
@@ -20,19 +20,19 @@
shared ivec4 dst[4];
shared int dst_nested[4][3][2];
ivec4[4] ret_arr() {
- ivec4 tint_symbol[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
- return tint_symbol;
+ ivec4 tint_symbol_1[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
+ return tint_symbol_1;
}
S ret_struct_arr() {
- S tint_symbol_1 = S(ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)));
- return tint_symbol_1;
+ S tint_symbol_2 = S(ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)));
+ return tint_symbol_2;
}
void foo(ivec4 src_param[4]) {
ivec4 src_function[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
- ivec4 tint_symbol_2[4] = ivec4[4](ivec4(1), ivec4(2), ivec4(3), ivec4(3));
- dst = tint_symbol_2;
+ ivec4 tint_symbol_3[4] = ivec4[4](ivec4(1), ivec4(2), ivec4(3), ivec4(3));
+ dst = tint_symbol_3;
dst = src_param;
dst = ret_arr();
ivec4 src_let[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
@@ -40,7 +40,8 @@
dst = src_function;
dst = src_private;
dst = src_workgroup;
- dst = ret_struct_arr().arr;
+ S tint_symbol = ret_struct_arr();
+ dst = tint_symbol.arr;
dst = src_uniform.arr;
dst = src_storage.arr;
int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
diff --git a/test/tint/array/assign_to_workgroup_var.wgsl.expected.hlsl b/test/tint/array/assign_to_workgroup_var.wgsl.expected.hlsl
index 4243ec1..82bac27 100644
--- a/test/tint/array/assign_to_workgroup_var.wgsl.expected.hlsl
+++ b/test/tint/array/assign_to_workgroup_var.wgsl.expected.hlsl
@@ -18,17 +18,17 @@
typedef int4 ret_arr_ret[4];
ret_arr_ret ret_arr() {
- const int4 tint_symbol_5[4] = (int4[4])0;
- return tint_symbol_5;
-}
-
-S ret_struct_arr() {
- const S tint_symbol_6 = (S)0;
+ const int4 tint_symbol_6[4] = (int4[4])0;
return tint_symbol_6;
}
-typedef int4 tint_symbol_1_ret[4];
-tint_symbol_1_ret tint_symbol_1(uint4 buffer[4], uint offset) {
+S ret_struct_arr() {
+ const S tint_symbol_7 = (S)0;
+ return tint_symbol_7;
+}
+
+typedef int4 tint_symbol_2_ret[4];
+tint_symbol_2_ret tint_symbol_2(uint4 buffer[4], uint offset) {
int4 arr_1[4] = (int4[4])0;
{
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
@@ -39,8 +39,8 @@
return arr_1;
}
-typedef int4 tint_symbol_3_ret[4];
-tint_symbol_3_ret tint_symbol_3(RWByteAddressBuffer buffer, uint offset) {
+typedef int4 tint_symbol_4_ret[4];
+tint_symbol_4_ret tint_symbol_4(RWByteAddressBuffer buffer, uint offset) {
int4 arr_2[4] = (int4[4])0;
{
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
@@ -52,8 +52,8 @@
void foo(int4 src_param[4]) {
int4 src_function[4] = (int4[4])0;
- const int4 tint_symbol_7[4] = {int4((1).xxxx), int4((2).xxxx), int4((3).xxxx), int4((3).xxxx)};
- tint_symbol = tint_symbol_7;
+ const int4 tint_symbol_8[4] = {int4((1).xxxx), int4((2).xxxx), int4((3).xxxx), int4((3).xxxx)};
+ tint_symbol = tint_symbol_8;
tint_symbol = src_param;
tint_symbol = ret_arr();
const int4 src_let[4] = (int4[4])0;
@@ -61,9 +61,10 @@
tint_symbol = src_function;
tint_symbol = src_private;
tint_symbol = src_workgroup;
- tint_symbol = ret_struct_arr().arr;
- tint_symbol = tint_symbol_1(src_uniform, 0u);
- tint_symbol = tint_symbol_3(src_storage, 0u);
+ const S tint_symbol_1 = ret_struct_arr();
+ tint_symbol = tint_symbol_1.arr;
+ tint_symbol = tint_symbol_2(src_uniform, 0u);
+ tint_symbol = tint_symbol_4(src_storage, 0u);
int src_nested[4][3][2] = (int[4][3][2])0;
dst_nested = src_nested;
}
diff --git a/test/tint/array/assign_to_workgroup_var.wgsl.expected.msl b/test/tint/array/assign_to_workgroup_var.wgsl.expected.msl
index 32b8290..9fab331 100644
--- a/test/tint/array/assign_to_workgroup_var.wgsl.expected.msl
+++ b/test/tint/array/assign_to_workgroup_var.wgsl.expected.msl
@@ -22,30 +22,31 @@
};
tint_array_wrapper ret_arr() {
- tint_array_wrapper const tint_symbol = {.arr={}};
- return tint_symbol;
-}
-
-S ret_struct_arr() {
- S const tint_symbol_1 = {};
+ tint_array_wrapper const tint_symbol_1 = {.arr={}};
return tint_symbol_1;
}
-void foo(tint_array_wrapper src_param, threadgroup tint_array_wrapper* const tint_symbol_3, thread tint_array_wrapper* const tint_symbol_4, threadgroup tint_array_wrapper* const tint_symbol_5, const constant S* const tint_symbol_6, device S* const tint_symbol_7, threadgroup tint_array_wrapper_1* const tint_symbol_8) {
+S ret_struct_arr() {
+ S const tint_symbol_2 = {};
+ return tint_symbol_2;
+}
+
+void foo(tint_array_wrapper src_param, threadgroup tint_array_wrapper* const tint_symbol_4, thread tint_array_wrapper* const tint_symbol_5, threadgroup tint_array_wrapper* const tint_symbol_6, const constant S* const tint_symbol_7, device S* const tint_symbol_8, threadgroup tint_array_wrapper_1* const tint_symbol_9) {
tint_array_wrapper src_function = {};
- tint_array_wrapper const tint_symbol_2 = {.arr={int4(1), int4(2), int4(3), int4(3)}};
- *(tint_symbol_3) = tint_symbol_2;
- *(tint_symbol_3) = src_param;
- *(tint_symbol_3) = ret_arr();
+ tint_array_wrapper const tint_symbol_3 = {.arr={int4(1), int4(2), int4(3), int4(3)}};
+ *(tint_symbol_4) = tint_symbol_3;
+ *(tint_symbol_4) = src_param;
+ *(tint_symbol_4) = ret_arr();
tint_array_wrapper const src_let = {.arr={}};
- *(tint_symbol_3) = src_let;
- *(tint_symbol_3) = src_function;
- *(tint_symbol_3) = *(tint_symbol_4);
- *(tint_symbol_3) = *(tint_symbol_5);
- *(tint_symbol_3) = ret_struct_arr().arr;
- *(tint_symbol_3) = (*(tint_symbol_6)).arr;
- *(tint_symbol_3) = (*(tint_symbol_7)).arr;
+ *(tint_symbol_4) = src_let;
+ *(tint_symbol_4) = src_function;
+ *(tint_symbol_4) = *(tint_symbol_5);
+ *(tint_symbol_4) = *(tint_symbol_6);
+ S const tint_symbol = ret_struct_arr();
+ *(tint_symbol_4) = tint_symbol.arr;
+ *(tint_symbol_4) = (*(tint_symbol_7)).arr;
+ *(tint_symbol_4) = (*(tint_symbol_8)).arr;
tint_array_wrapper_1 src_nested = {};
- *(tint_symbol_8) = src_nested;
+ *(tint_symbol_9) = src_nested;
}
diff --git a/test/tint/array/function_return_type.wgsl.expected.glsl b/test/tint/array/function_return_type.wgsl.expected.glsl
index 465ae8f..497ca18 100644
--- a/test/tint/array/function_return_type.wgsl.expected.glsl
+++ b/test/tint/array/function_return_type.wgsl.expected.glsl
@@ -1,18 +1,23 @@
#version 310 es
float[4] f1() {
- float tint_symbol_1[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
- return tint_symbol_1;
+ float tint_symbol_6[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
+ return tint_symbol_6;
}
float[3][4] f2() {
- float tint_symbol_2[3][4] = float[3][4](f1(), f1(), f1());
- return tint_symbol_2;
+ float tint_symbol_1[4] = f1();
+ float tint_symbol_2[4] = f1();
+ float tint_symbol_3[4] = f1();
+ float tint_symbol_7[3][4] = float[3][4](tint_symbol_1, tint_symbol_2, tint_symbol_3);
+ return tint_symbol_7;
}
float[2][3][4] f3() {
- float tint_symbol_3[2][3][4] = float[2][3][4](f2(), f2());
- return tint_symbol_3;
+ float tint_symbol_4[3][4] = f2();
+ float tint_symbol_5[3][4] = f2();
+ float tint_symbol_8[2][3][4] = float[2][3][4](tint_symbol_4, tint_symbol_5);
+ return tint_symbol_8;
}
void tint_symbol() {
diff --git a/test/tint/array/function_return_type.wgsl.expected.hlsl b/test/tint/array/function_return_type.wgsl.expected.hlsl
index 8ec30b6..954b060 100644
--- a/test/tint/array/function_return_type.wgsl.expected.hlsl
+++ b/test/tint/array/function_return_type.wgsl.expected.hlsl
@@ -1,19 +1,24 @@
typedef float f1_ret[4];
f1_ret f1() {
- const float tint_symbol[4] = (float[4])0;
- return tint_symbol;
+ const float tint_symbol_5[4] = (float[4])0;
+ return tint_symbol_5;
}
typedef float f2_ret[3][4];
f2_ret f2() {
- const float tint_symbol_1[3][4] = {f1(), f1(), f1()};
- return tint_symbol_1;
+ const float tint_symbol[4] = f1();
+ const float tint_symbol_1[4] = f1();
+ const float tint_symbol_2[4] = f1();
+ const float tint_symbol_6[3][4] = {tint_symbol, tint_symbol_1, tint_symbol_2};
+ return tint_symbol_6;
}
typedef float f3_ret[2][3][4];
f3_ret f3() {
- const float tint_symbol_2[2][3][4] = {f2(), f2()};
- return tint_symbol_2;
+ const float tint_symbol_3[3][4] = f2();
+ const float tint_symbol_4[3][4] = f2();
+ const float tint_symbol_7[2][3][4] = {tint_symbol_3, tint_symbol_4};
+ return tint_symbol_7;
}
[numthreads(1, 1, 1)]
diff --git a/test/tint/array/function_return_type.wgsl.expected.msl b/test/tint/array/function_return_type.wgsl.expected.msl
index b56fe6c..8d7634a 100644
--- a/test/tint/array/function_return_type.wgsl.expected.msl
+++ b/test/tint/array/function_return_type.wgsl.expected.msl
@@ -6,8 +6,8 @@
};
tint_array_wrapper f1() {
- tint_array_wrapper const tint_symbol_1 = {.arr={}};
- return tint_symbol_1;
+ tint_array_wrapper const tint_symbol_6 = {.arr={}};
+ return tint_symbol_6;
}
struct tint_array_wrapper_1 {
@@ -15,8 +15,11 @@
};
tint_array_wrapper_1 f2() {
- tint_array_wrapper_1 const tint_symbol_2 = {.arr={f1(), f1(), f1()}};
- return tint_symbol_2;
+ tint_array_wrapper const tint_symbol_1 = f1();
+ tint_array_wrapper const tint_symbol_2 = f1();
+ tint_array_wrapper const tint_symbol_3 = f1();
+ tint_array_wrapper_1 const tint_symbol_7 = {.arr={tint_symbol_1, tint_symbol_2, tint_symbol_3}};
+ return tint_symbol_7;
}
struct tint_array_wrapper_2 {
@@ -24,8 +27,10 @@
};
tint_array_wrapper_2 f3() {
- tint_array_wrapper_2 const tint_symbol_3 = {.arr={f2(), f2()}};
- return tint_symbol_3;
+ tint_array_wrapper_1 const tint_symbol_4 = f2();
+ tint_array_wrapper_1 const tint_symbol_5 = f2();
+ tint_array_wrapper_2 const tint_symbol_8 = {.arr={tint_symbol_4, tint_symbol_5}};
+ return tint_symbol_8;
}
kernel void tint_symbol() {