-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JIT: SSA does not add proper phi args for second pass EH successors #94954
Comments
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsSSA only looks at the full set of EH successors as part of the "end-of-block" successor iteration. When it sees definitions inside the block, it only looks for enclosing handlers. For example: private static void Foo()
{
int x = 123;
try
{
try
{
throw new Exception();
}
finally
{
Console.WriteLine(x);
}
}
catch (Exception) when (Bar(x = 50, Throw(x), x = 123))
{
}
}
private static bool Bar(int x, int y, int z)
{
return true;
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static int Throw(int x)
{
throw new Exception();
} The
|
When we saw a def we were only adding phi args to enclosing handlers, but this misses the special case of throws inside filters, where control can flow to enclosed handlers. Fix dotnet#94954
When we saw a def we were only adding phi args to enclosing handlers, but this misses the special case of throws inside filters, where control can flow to enclosed handlers. Fix #94954
SSA only looks at the full set of EH successors as part of the "end-of-block" successor iteration. When it sees definitions inside the block, it only looks for enclosing handlers. For example:
The
x = 50
here needs to induce a phi arg in the enclosedfinally
handler, but it doesn't. We effectively get a PHI that indicates the only possible value forx
is123
inside the enclosed finally, but this program enters the finally block withx=50
.It does not cause silent bad codegen here because there is a cycle in the flow-graph between the enclosed finally and the filter, so VN isn't able to deduce
x = 123
from the phis.The text was updated successfully, but these errors were encountered: