461f1506e7
This is not necessary, as we must emit an invalidating store before we potentially consume an invalid expression. In fact, we're a bit conservative here in this case for example: int tmp = variable; if (...) { variable = 10; } else { // Consuming tmp here is fine, but it was // invalidated while emitting other branch. // Technically, we need to study if there is an invalidating store // in the CFG between the loading block and this block, and the other // branch will not be a part of that analysis. int tmp2 = tmp * tmp; } Fixing this case means complex CFG traversal *everywhere*, and it feels like overkill. Fixing this exposed a bug with access chains, so fix a bug where expression dependencies were not inherited properly in access chains. Access chains are now considered forwarded if there is at least one dependency which is also forwarded.
110 lines
1.8 KiB
Plaintext
110 lines
1.8 KiB
Plaintext
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
using namespace metal;
|
|
|
|
struct SSBO
|
|
{
|
|
float4x4 mvp;
|
|
float4 in_data[1];
|
|
};
|
|
|
|
struct SSBO2
|
|
{
|
|
float4 out_data[1];
|
|
};
|
|
|
|
kernel void main0(const device SSBO& _24 [[buffer(0)]], device SSBO2& _177 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
|
|
{
|
|
uint ident = gl_GlobalInvocationID.x;
|
|
float4 idat = _24.in_data[ident];
|
|
int k = 0;
|
|
uint i = 0u;
|
|
if (idat.y == 20.0)
|
|
{
|
|
do
|
|
{
|
|
k *= 2;
|
|
i++;
|
|
} while (i < ident);
|
|
}
|
|
switch (k)
|
|
{
|
|
case 10:
|
|
{
|
|
for (;;)
|
|
{
|
|
i++;
|
|
if (i > 10u)
|
|
{
|
|
break;
|
|
}
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
default:
|
|
{
|
|
for (;;)
|
|
{
|
|
i += 2u;
|
|
if (i > 20u)
|
|
{
|
|
break;
|
|
}
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
while (k < 10)
|
|
{
|
|
idat *= 2.0;
|
|
k++;
|
|
}
|
|
for (uint i_1 = 0u; i_1 < 16u; i_1++, k++)
|
|
{
|
|
for (uint j = 0u; j < 30u; j++)
|
|
{
|
|
idat = _24.mvp * idat;
|
|
}
|
|
}
|
|
k = 0;
|
|
for (;;)
|
|
{
|
|
k++;
|
|
if (k > 10)
|
|
{
|
|
k += 2;
|
|
}
|
|
else
|
|
{
|
|
k += 3;
|
|
continue;
|
|
}
|
|
k += 10;
|
|
continue;
|
|
}
|
|
k = 0;
|
|
do
|
|
{
|
|
k++;
|
|
} while (k > 10);
|
|
int l = 0;
|
|
for (;;)
|
|
{
|
|
if (l == 5)
|
|
{
|
|
int _172 = l;
|
|
l = _172 + 1;
|
|
continue;
|
|
}
|
|
idat += float4(1.0);
|
|
int _172 = l;
|
|
l = _172 + 1;
|
|
continue;
|
|
}
|
|
_177.out_data[ident] = idat;
|
|
}
|
|
|