summaryrefslogtreecommitdiffstats
path: root/tests/experimental
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-10-10 15:59:45 -0700
committerGitHub <noreply@github.com>2022-10-10 15:59:45 -0700
commit768e62f6c7541439e2edc18dad5fb3846d2e05f9 (patch)
tree8c68424ee65905b77d3ecb4c7659c5fdcc6ab948 /tests/experimental
parent8487678d6504459935fec07886d2e53ed688ac2f (diff)
Support multi-level break + single-return conversion + general inline. (#2436)
* Support multi-level break. * Single return. * Add test for inlining `void` return-type functions. Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/experimental')
-rw-r--r--tests/experimental/liveness/liveness-3.slang.expected37
-rw-r--r--tests/experimental/liveness/liveness-4.slang.expected15
-rw-r--r--tests/experimental/liveness/liveness-5.slang.expected31
-rw-r--r--tests/experimental/liveness/liveness-6.slang.expected35
4 files changed, 61 insertions, 57 deletions
diff --git a/tests/experimental/liveness/liveness-3.slang.expected b/tests/experimental/liveness/liveness-3.slang.expected
index 58f562d86..3c124ed92 100644
--- a/tests/experimental/liveness/liveness-3.slang.expected
+++ b/tests/experimental/liveness/liveness-3.slang.expected
@@ -87,17 +87,18 @@ int calcThing_0(int offset_0)
livenessStart_1(_S7, 0);
_S7 = _S10;
}
- idx_0[modRange_0] = idx_0[modRange_0] + (_S7 + i_0);
+ int _S11 = _S7 + i_0;
+ idx_0[modRange_0] = idx_0[modRange_0] + _S11;
i_0 = i_0 + 1;
livenessStart_1(_S5, 0);
- int _S11 = _S7;
+ int _S12 = _S7;
livenessEnd_0(_S7, 0);
- _S5 = _S11;
+ _S5 = _S12;
}
livenessEnd_0(i_0, 0);
livenessEnd_0(_S2, 0);
- int _S12 = (k_0 + 7) % 5;
- if(_S12 == 4)
+ int _S13 = (k_0 + 7) % 5;
+ if(_S13 == 4)
{
livenessEnd_0(_S5, 0);
livenessEnd_1(idx_0, 0);
@@ -105,39 +106,39 @@ int calcThing_0(int offset_0)
livenessEnd_2(another_0, 0);
return total_0;
}
- int _S13 = idx_0[0] + idx_0[1];
- int _S14 = idx_0[2];
+ int _S14 = idx_0[0] + idx_0[1];
+ int _S15 = idx_0[2];
livenessEnd_1(idx_0, 0);
- int _S15 = _S13 + _S14;
- int _S16 = total_0;
+ int _S16 = _S14 + _S15;
+ int _S17 = total_0;
livenessEnd_0(total_0, 0);
- int total_1 = _S16 + _S15;
+ int total_1 = _S17 + _S16;
k_0 = k_0 + 1;
livenessStart_1(_S2, 0);
- int _S17 = _S5;
+ int _S18 = _S5;
livenessEnd_0(_S5, 0);
- _S2 = _S17;
+ _S2 = _S18;
livenessStart_1(total_0, 0);
total_0 = total_1;
}
livenessEnd_0(_S2, 0);
livenessEnd_0(k_0, 0);
livenessEnd_2(another_0, 0);
- int _S18 = total_0;
+ int _S19 = total_0;
livenessEnd_0(total_0, 0);
- return - _S18;
+ return - _S19;
}
-layout(std430, binding = 0) buffer _S19 {
+layout(std430, binding = 0) buffer _S20 {
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 _S21 = uint(index_0);
+ int _S22 = calcThing_0(index_0);
+ ((outputBuffer_0)._data[(_S21)]) = _S22;
return;
}
diff --git a/tests/experimental/liveness/liveness-4.slang.expected b/tests/experimental/liveness/liveness-4.slang.expected
index 52c6ebb32..38f42c02a 100644
--- a/tests/experimental/liveness/liveness-4.slang.expected
+++ b/tests/experimental/liveness/liveness-4.slang.expected
@@ -48,12 +48,13 @@ int calcThing_0(int offset_0)
{
break;
}
- another_0[i_0 & 1] = another_0[i_0 & 1] + (k_0 + i_0);
+ int _S2 = k_0 + i_0;
+ another_0[i_0 & 1] = another_0[i_0 & 1] + _S2;
i_0 = i_0 + 1;
}
livenessEnd_0(i_0, 0);
- int _S2 = (k_0 + 7) % 5;
- if(_S2 == 4)
+ int _S3 = (k_0 + 7) % 5;
+ if(_S3 == 4)
{
livenessEnd_0(k_0, 0);
livenessEnd_1(another_0, 0);
@@ -66,16 +67,16 @@ int calcThing_0(int offset_0)
return -2;
}
-layout(std430, binding = 0) buffer _S3 {
+layout(std430, binding = 0) buffer _S4 {
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 _S5 = uint(index_0);
+ int _S6 = calcThing_0(index_0);
+ ((outputBuffer_0)._data[(_S5)]) = _S6;
return;
}
diff --git a/tests/experimental/liveness/liveness-5.slang.expected b/tests/experimental/liveness/liveness-5.slang.expected
index ea6e37036..920e05b59 100644
--- a/tests/experimental/liveness/liveness-5.slang.expected
+++ b/tests/experimental/liveness/liveness-5.slang.expected
@@ -51,16 +51,17 @@ int calcThing_0(int offset_0)
{
break;
}
- another_0[i_0 & 1] = another_0[i_0 & 1] + (k_0 + i_0);
+ int _S2 = k_0 + i_0;
+ another_0[i_0 & 1] = another_0[i_0 & 1] + _S2;
i_0 = i_0 + 1;
}
livenessEnd_0(i_0, 0);
- int _S2 = another_0[k_0 & 1];
- int _S3 = total_0;
+ int _S3 = another_0[k_0 & 1];
+ int _S4 = total_0;
livenessEnd_0(total_0, 0);
- int total_1 = _S3 + _S2;
- int _S4 = (k_0 + 7) % 5;
- if(_S4 == 4)
+ int total_1 = _S4 + _S3;
+ int _S5 = (k_0 + 7) % 5;
+ if(_S5 == 4)
{
livenessEnd_0(k_0, 0);
livenessEnd_1(another_0, 0);
@@ -75,32 +76,32 @@ int calcThing_0(int offset_0)
int total_2;
if(total_0 > 4)
{
- int _S5 = total_0;
+ int _S6 = total_0;
livenessEnd_0(total_0, 0);
- int _S6 = - _S5;
+ int _S7 = - _S6;
livenessStart_1(total_2, 0);
- total_2 = _S6;
+ total_2 = _S7;
}
else
{
- int _S7 = total_0;
+ int _S8 = total_0;
livenessEnd_0(total_0, 0);
livenessStart_1(total_2, 0);
- total_2 = _S7;
+ total_2 = _S8;
}
return total_2;
}
-layout(std430, binding = 0) buffer _S8 {
+layout(std430, binding = 0) buffer _S9 {
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 _S10 = uint(index_0);
+ int _S11 = calcThing_0(index_0);
+ ((outputBuffer_0)._data[(_S10)]) = _S11;
return;
}
diff --git a/tests/experimental/liveness/liveness-6.slang.expected b/tests/experimental/liveness/liveness-6.slang.expected
index ac1894f95..91ee98f8e 100644
--- a/tests/experimental/liveness/liveness-6.slang.expected
+++ b/tests/experimental/liveness/liveness-6.slang.expected
@@ -55,20 +55,21 @@ int calcThing_0(int offset_0)
{
break;
}
- another_0[i_0 & 1] = another_0[i_0 & 1] + (k_0 + i_0);
+ int _S3 = k_0 + i_0;
+ another_0[i_0 & 1] = another_0[i_0 & 1] + _S3;
arr_0[k_0 & 1] = arr_0[k_0 & 1] + i_0;
i_0 = i_0 + 1;
}
livenessEnd_0(i_0, 0);
- int _S3 = another_0[k_0 & 1];
- int _S4 = total_0;
+ int _S4 = another_0[k_0 & 1];
+ int _S5 = total_0;
livenessEnd_0(total_0, 0);
- int total_1 = _S4 + _S3;
- int _S5 = arr_0[k_0 & 1];
+ int total_1 = _S5 + _S4;
+ int _S6 = arr_0[k_0 & 1];
livenessEnd_1(arr_0, 0);
- int total_2 = total_1 + _S5;
- int _S6 = (k_0 + 7) % 5;
- if(_S6 == 4)
+ int total_2 = total_1 + _S6;
+ int _S7 = (k_0 + 7) % 5;
+ if(_S7 == 4)
{
livenessEnd_0(k_0, 0);
livenessEnd_1(another_0, 0);
@@ -83,32 +84,32 @@ int calcThing_0(int offset_0)
int total_3;
if(total_0 > 4)
{
- int _S7 = total_0;
+ int _S8 = total_0;
livenessEnd_0(total_0, 0);
- int _S8 = - _S7;
+ int _S9 = - _S8;
livenessStart_1(total_3, 0);
- total_3 = _S8;
+ total_3 = _S9;
}
else
{
- int _S9 = total_0;
+ int _S10 = total_0;
livenessEnd_0(total_0, 0);
livenessStart_1(total_3, 0);
- total_3 = _S9;
+ total_3 = _S10;
}
return total_3;
}
-layout(std430, binding = 0) buffer _S10 {
+layout(std430, binding = 0) buffer _S11 {
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 _S11 = uint(index_0);
- int _S12 = calcThing_0(index_0);
- ((outputBuffer_0)._data[(_S11)]) = _S12;
+ uint _S12 = uint(index_0);
+ int _S13 = calcThing_0(index_0);
+ ((outputBuffer_0)._data[(_S12)]) = _S13;
return;
}