summaryrefslogtreecommitdiff
path: root/tests/experimental
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-02-07 18:36:35 -0800
committerGitHub <noreply@github.com>2023-02-07 18:36:35 -0800
commit4be623c52a6518eb86756a0369706c1d6670f6bb (patch)
treec24f54e34db9f1f02c2d51808b15121eba9195a9 /tests/experimental
parent101f164b036d0c1c012243df69179559b6f40fb8 (diff)
Arithmetic simplifications and more IR clean up logic. (#2632)
Diffstat (limited to 'tests/experimental')
-rw-r--r--tests/experimental/liveness/liveness-3.slang.expected98
-rw-r--r--tests/experimental/liveness/liveness-4.slang.expected16
-rw-r--r--tests/experimental/liveness/liveness-5.slang.expected23
-rw-r--r--tests/experimental/liveness/liveness-6.slang.expected33
-rw-r--r--tests/experimental/liveness/liveness.slang.expected25
5 files changed, 98 insertions, 97 deletions
diff --git a/tests/experimental/liveness/liveness-3.slang.expected b/tests/experimental/liveness/liveness-3.slang.expected
index dac9ff1bd..4dff6b37a 100644
--- a/tests/experimental/liveness/liveness-3.slang.expected
+++ b/tests/experimental/liveness/liveness-3.slang.expected
@@ -28,15 +28,15 @@ int calcThing_0(int offset_0)
{
int another_0[2];
livenessStart_0(another_0, 0);
- const int _S1[2] = { 1, 2 };
- another_0 = _S1;
+ another_0[0] = 1;
+ another_0[1] = 2;
int k_0;
- int _S2;
- int total_0;
livenessStart_1(k_0, 0);
k_0 = 0;
- livenessStart_1(_S2, 0);
- _S2 = offset_0;
+ int _S1;
+ livenessStart_1(_S1, 0);
+ _S1 = offset_0;
+ int total_0;
livenessStart_1(total_0, 0);
total_0 = 0;
for(;;)
@@ -50,15 +50,15 @@ int calcThing_0(int offset_0)
}
int idx_0[3];
livenessStart_2(idx_0, 0);
- const int _S3[3] = { 0, 0, 0 };
- idx_0 = _S3;
+ idx_0[0] = 0;
+ idx_0[1] = 0;
+ idx_0[2] = 0;
int i_0;
- int _S4;
- int _S5 = _S2;
livenessStart_1(i_0, 0);
i_0 = 0;
- livenessStart_1(_S4, 0);
- _S4 = _S5;
+ int _S2;
+ livenessStart_1(_S2, 0);
+ _S2 = _S1;
for(;;)
{
if(i_0 < 17)
@@ -70,74 +70,74 @@ int calcThing_0(int offset_0)
}
int modRange_0 = i_0 % 3;
another_0[i_0 & 1] = another_0[i_0 & 1] + modRange_0;
- int _S6 = i_0 % 3;
- int _S7;
- if(_S6 != 0)
+ int _S3 = i_0 % 3;
+ int _S4;
+ if(_S3 != 0)
{
- int _S8 = _S4;
- livenessEnd_0(_S4, 0);
- int _S9 = _S8 + 1;
- livenessStart_1(_S7, 0);
- _S7 = _S9;
+ int _S5 = _S2;
+ livenessEnd_0(_S2, 0);
+ int _S6 = _S5 + 1;
+ livenessStart_1(_S4, 0);
+ _S4 = _S6;
}
else
{
- int _S10 = _S4;
- livenessEnd_0(_S4, 0);
- livenessStart_1(_S7, 0);
- _S7 = _S10;
+ int _S7 = _S2;
+ livenessEnd_0(_S2, 0);
+ livenessStart_1(_S4, 0);
+ _S4 = _S7;
}
- idx_0[modRange_0] = idx_0[modRange_0] + (_S7 + i_0);
+ idx_0[modRange_0] = idx_0[modRange_0] + (_S4 + i_0);
i_0 = i_0 + 1;
- livenessStart_1(_S4, 0);
- int _S11 = _S7;
- livenessEnd_0(_S7, 0);
- _S4 = _S11;
+ livenessStart_1(_S2, 0);
+ int _S8 = _S4;
+ livenessEnd_0(_S4, 0);
+ _S2 = _S8;
}
livenessEnd_0(i_0, 0);
- livenessEnd_0(_S2, 0);
- int _S12 = (k_0 + 7) % 5;
- if(_S12 == 4)
+ livenessEnd_0(_S1, 0);
+ int _S9 = (k_0 + 7) % 5;
+ if(_S9 == 4)
{
- livenessEnd_0(_S4, 0);
+ livenessEnd_0(_S2, 0);
livenessEnd_1(idx_0, 0);
livenessEnd_0(k_0, 0);
livenessEnd_2(another_0, 0);
return total_0;
}
- int _S13 = idx_0[0] + idx_0[1];
- int _S14 = idx_0[2];
+ int _S10 = idx_0[0] + idx_0[1];
+ int _S11 = idx_0[2];
livenessEnd_1(idx_0, 0);
- int _S15 = _S13 + _S14;
- int _S16 = total_0;
+ int _S12 = _S10 + _S11;
+ int _S13 = total_0;
livenessEnd_0(total_0, 0);
- int total_1 = _S16 + _S15;
+ int total_1 = _S13 + _S12;
k_0 = k_0 + 1;
- livenessStart_1(_S2, 0);
- int _S17 = _S4;
- livenessEnd_0(_S4, 0);
- _S2 = _S17;
+ livenessStart_1(_S1, 0);
+ int _S14 = _S2;
+ livenessEnd_0(_S2, 0);
+ _S1 = _S14;
livenessStart_1(total_0, 0);
total_0 = total_1;
}
- livenessEnd_0(_S2, 0);
+ livenessEnd_0(_S1, 0);
livenessEnd_0(k_0, 0);
livenessEnd_2(another_0, 0);
- int _S18 = total_0;
+ int _S15 = total_0;
livenessEnd_0(total_0, 0);
- return - _S18;
+ return - _S15;
}
-layout(std430, binding = 0) buffer _S19 {
+layout(std430, binding = 0) buffer _S16 {
int _data[];
} outputBuffer_0;
layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in;
void main()
{
int index_0 = int(gl_GlobalInvocationID.x);
- uint _S20 = uint(index_0);
- int _S21 = calcThing_0(index_0);
- ((outputBuffer_0)._data[(_S20)]) = _S21;
+ uint _S17 = uint(index_0);
+ int _S18 = calcThing_0(index_0);
+ ((outputBuffer_0)._data[(_S17)]) = _S18;
return;
}
diff --git a/tests/experimental/liveness/liveness-4.slang.expected b/tests/experimental/liveness/liveness-4.slang.expected
index 52c6ebb32..cd97f8057 100644
--- a/tests/experimental/liveness/liveness-4.slang.expected
+++ b/tests/experimental/liveness/liveness-4.slang.expected
@@ -22,8 +22,8 @@ int calcThing_0(int offset_0)
{
int another_0[2];
livenessStart_0(another_0, 0);
- const int _S1[2] = { 1, 2 };
- another_0 = _S1;
+ another_0[0] = 1;
+ another_0[1] = 2;
int k_0;
livenessStart_1(k_0, 0);
k_0 = 0;
@@ -52,8 +52,8 @@ int calcThing_0(int offset_0)
i_0 = i_0 + 1;
}
livenessEnd_0(i_0, 0);
- int _S2 = (k_0 + 7) % 5;
- if(_S2 == 4)
+ int _S1 = (k_0 + 7) % 5;
+ if(_S1 == 4)
{
livenessEnd_0(k_0, 0);
livenessEnd_1(another_0, 0);
@@ -66,16 +66,16 @@ int calcThing_0(int offset_0)
return -2;
}
-layout(std430, binding = 0) buffer _S3 {
+layout(std430, binding = 0) buffer _S2 {
int _data[];
} outputBuffer_0;
layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in;
void main()
{
int index_0 = int(gl_GlobalInvocationID.x);
- uint _S4 = uint(index_0);
- int _S5 = calcThing_0(index_0);
- ((outputBuffer_0)._data[(_S4)]) = _S5;
+ uint _S3 = uint(index_0);
+ int _S4 = calcThing_0(index_0);
+ ((outputBuffer_0)._data[(_S3)]) = _S4;
return;
}
diff --git a/tests/experimental/liveness/liveness-5.slang.expected b/tests/experimental/liveness/liveness-5.slang.expected
index a8a9707d7..3693d3fde 100644
--- a/tests/experimental/liveness/liveness-5.slang.expected
+++ b/tests/experimental/liveness/liveness-5.slang.expected
@@ -22,12 +22,12 @@ int calcThing_0(int offset_0)
{
int another_0[2];
livenessStart_0(another_0, 0);
- const int _S1[2] = { 1, 2 };
- another_0 = _S1;
+ another_0[0] = 1;
+ another_0[1] = 2;
int k_0;
- int total_0;
livenessStart_1(k_0, 0);
k_0 = 0;
+ int total_0;
livenessStart_1(total_0, 0);
total_0 = 0;
for(;;)
@@ -55,12 +55,11 @@ int calcThing_0(int offset_0)
i_0 = i_0 + 1;
}
livenessEnd_0(i_0, 0);
- int _S2 = another_0[k_0 & 1];
- int _S3 = total_0;
+ int _S1 = total_0;
livenessEnd_0(total_0, 0);
- int total_1 = _S3 + _S2;
- int _S4 = (k_0 + 7) % 5;
- if(_S4 == 4)
+ int total_1 = _S1 + another_0[k_0 & 1];
+ int _S2 = (k_0 + 7) % 5;
+ if(_S2 == 4)
{
livenessEnd_0(k_0, 0);
livenessEnd_1(another_0, 0);
@@ -82,16 +81,16 @@ int calcThing_0(int offset_0)
return total_0;
}
-layout(std430, binding = 0) buffer _S5 {
+layout(std430, binding = 0) buffer _S3 {
int _data[];
} outputBuffer_0;
layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in;
void main()
{
int index_0 = int(gl_GlobalInvocationID.x);
- uint _S6 = uint(index_0);
- int _S7 = calcThing_0(index_0);
- ((outputBuffer_0)._data[(_S6)]) = _S7;
+ uint _S4 = uint(index_0);
+ int _S5 = calcThing_0(index_0);
+ ((outputBuffer_0)._data[(_S4)]) = _S5;
return;
}
diff --git a/tests/experimental/liveness/liveness-6.slang.expected b/tests/experimental/liveness/liveness-6.slang.expected
index 402e19886..9c3bae815 100644
--- a/tests/experimental/liveness/liveness-6.slang.expected
+++ b/tests/experimental/liveness/liveness-6.slang.expected
@@ -22,12 +22,12 @@ int calcThing_0(int offset_0)
{
int another_0[2];
livenessStart_0(another_0, 0);
- const int _S1[2] = { 1, 2 };
- another_0 = _S1;
+ another_0[0] = 1;
+ another_0[1] = 2;
int k_0;
- int total_0;
livenessStart_1(k_0, 0);
k_0 = 0;
+ int total_0;
livenessStart_1(total_0, 0);
total_0 = 0;
for(;;)
@@ -41,8 +41,8 @@ int calcThing_0(int offset_0)
}
int arr_0[2];
livenessStart_0(arr_0, 0);
- const int _S2[2] = { 2, 3 };
- arr_0 = _S2;
+ arr_0[0] = 2;
+ arr_0[1] = 3;
int i_0;
livenessStart_1(i_0, 0);
i_0 = 0;
@@ -60,16 +60,15 @@ int calcThing_0(int offset_0)
i_0 = i_0 + 1;
}
livenessEnd_0(i_0, 0);
- int _S3 = k_0 & 1;
- int _S4 = another_0[_S3];
- int _S5 = total_0;
+ int _S1 = k_0 & 1;
+ int _S2 = total_0;
livenessEnd_0(total_0, 0);
- int total_1 = _S5 + _S4;
- int _S6 = arr_0[_S3];
+ int total_1 = _S2 + another_0[_S1];
+ int _S3 = arr_0[_S1];
livenessEnd_1(arr_0, 0);
- int total_2 = total_1 + _S6;
- int _S7 = (k_0 + 7) % 5;
- if(_S7 == 4)
+ int total_2 = total_1 + _S3;
+ int _S4 = (k_0 + 7) % 5;
+ if(_S4 == 4)
{
livenessEnd_0(k_0, 0);
livenessEnd_1(another_0, 0);
@@ -91,16 +90,16 @@ int calcThing_0(int offset_0)
return total_0;
}
-layout(std430, binding = 0) buffer _S8 {
+layout(std430, binding = 0) buffer _S5 {
int _data[];
} outputBuffer_0;
layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in;
void main()
{
int index_0 = int(gl_GlobalInvocationID.x);
- uint _S9 = uint(index_0);
- int _S10 = calcThing_0(index_0);
- ((outputBuffer_0)._data[(_S9)]) = _S10;
+ uint _S6 = uint(index_0);
+ int _S7 = calcThing_0(index_0);
+ ((outputBuffer_0)._data[(_S6)]) = _S7;
return;
}
diff --git a/tests/experimental/liveness/liveness.slang.expected b/tests/experimental/liveness/liveness.slang.expected
index e50ecac5a..4a81b8855 100644
--- a/tests/experimental/liveness/liveness.slang.expected
+++ b/tests/experimental/liveness/liveness.slang.expected
@@ -22,9 +22,9 @@ int someSlowFunc_0(int a_0)
{
uint _S1 = uint(a_0);
uint v_0;
- int i_0;
livenessStart_0(v_0, 0);
v_0 = _S1;
+ int i_0;
livenessStart_1(i_0, 0);
i_0 = 0;
for(;;)
@@ -91,9 +91,9 @@ void main()
{
int index_0 = int(gl_GlobalInvocationID.x);
int i_2;
- int res_0;
livenessStart_1(i_2, 0);
i_2 = 0;
+ int res_0;
livenessStart_1(res_0, 0);
res_0 = index_0;
for(;;)
@@ -113,30 +113,33 @@ void main()
SomeStruct_0 _S8 = makeSomeStruct_0();
t_0 = _S8;
const int _S9[100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- SomeStruct_0 u_0 = { 0, 0, _S9 };
- SomeStruct_0 u_1;
+ SomeStruct_0 u_0;
if((v_1 & 256) != 0)
{
s_3.x_0 = ((anotherBuffer_0)._data[(uint(v_1 & 3))]);
t_0.x_0 = ((anotherBuffer_0)._data[(uint(v_1 & 3))]);
- livenessStart_2(u_1, 0);
- u_1 = u_0;
+ livenessStart_2(u_0, 0);
+ u_0.a_1 = 0;
+ u_0.x_0 = 0;
+ u_0.c_0 = _S9;
}
else
{
SomeStruct_0 x_1;
livenessStart_2(x_1, 0);
- x_1 = u_0;
+ x_1.a_1 = 0;
+ x_1.x_0 = 0;
+ x_1.c_0 = _S9;
x_1.x_0 = ((anotherBuffer_0)._data[(uint(v_1 & 3))]) + 1;
SomeStruct_0 _S10 = x_1;
livenessEnd_2(x_1, 0);
- livenessStart_2(u_1, 0);
- u_1 = _S10;
+ livenessStart_2(u_0, 0);
+ u_0 = _S10;
}
s_3.c_0[index_0 & 7] = s_3.c_0[index_0 & 7] + 1;
int _S11 = s_3.x_0 + t_0.x_0;
- SomeStruct_0 _S12 = u_1;
- livenessEnd_2(u_1, 0);
+ SomeStruct_0 _S12 = u_0;
+ livenessEnd_2(u_0, 0);
int _S13 = _S11 + _S12.x_0;
int _S14 = doThing_0(t_0);
int _S15 = _S13 + _S14;