In the following code, GCM hoists x / y out of the loop.
This causes division by zero even if value of n is zero.
val test = {i32 n, i32 x, i32 y ->
i32 z = 0;
i32 i = 0;
while (i < n) {
z = x / y;
i = i + 1;
}
return z;
};
Probably, nodes with possible side effect should be linked into the control chain.
It seems C2 does this, but this is too pessimistic decision that limits possible optimizations.
May be you though about some better solution?
(I have exactly the same problem in my project).
In the following code, GCM hoists
x / yout of the loop.This causes division by zero even if value of
nis zero.Probably, nodes with possible side effect should be linked into the control chain.
It seems C2 does this, but this is too pessimistic decision that limits possible optimizations.
May be you though about some better solution?
(I have exactly the same problem in my project).