-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Fix an SSA bug from the ASG
refactoring
#86108
Conversation
Recording PHIs from analyzable stores is a correctness requirement.
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsThe SSA renaming code was changed in an incompatible way s.t. memory stores in protected blocks were no longer considered to induce PHIs in the corresponding handlers.
|
@@ -1114,7 +1114,7 @@ void SsaBuilder::BlockRenameVariables(BasicBlock* block) | |||
{ | |||
for (GenTree* const tree : stmt->TreeList()) | |||
{ | |||
if (tree->OperIsSsaDef()) | |||
if (tree->OperIsStore() || tree->OperIs(GT_CALL)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In actuality the same problem exists for un-analyzable stores as well. But that is a pre-existing issue.
Reproduction
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)]
public static bool Problem()
{
[MethodImpl(MethodImplOptions.NoInlining)]
static void Throw()
{
_intStatic = 1;
throw new Exception();
}
_intStatic = 2;
try
{
Throw();
_intStatic = 2;
}
catch (Exception)
{
if (_intStatic == 2)
{
return true;
}
}
return false;
}
Filed #86112 for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for spotting this.
The SSA renaming code was changed in an incompatible way s.t. memory stores in protected blocks were no longer considered to induce PHIs in the corresponding handlers.