-
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
Bug fixes from dead code elimination #69897
Conversation
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsFixes 2 issues from the dead code elimination changes earlier.
This one was happening because we detect certain block is dead and remove the code inside it, but sometimes might decide to not delete the block itself. In those cases, we need to still make sure that we update liveness of variables. In #69421, I was only updating the liveness if we deleted the actual blocks. The fix is to take into account if any block was unreachable and if yes, update the liveness info.
This one was interesting. We have chain of try-finally that looks like this. During dead block elimination, we eliminate
The fix was to check if we made any reachable blocks dead and if yes, do another iteration. We would restrict the number of iterations to 3. Fixes: #69659
|
squash: Update test case name
unreachable to squash
@dotnet/jit-contrib |
Finally chains can be arbitrarily long, so how does this keep us from getting into trouble? Seems like we either need to iterate until we've got rid of all unreachable blocks, or have some way to handle blocks that are unreachable but still in the bb chain. |
True, and for now, I just added a check to not iterate more than 3 times.
Which as you pointed can be problematic and long.
Another alternative I tried was to re-populate the |
If you changed the |
1 similar comment
If you changed the |
Right, I didn't want to go up to 10 iterations, and just soft break the loop. But I think we will still hit a problem with a weird case that has more than 3 chains of try-finally. So, I will keep the code similar to |
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.
LGTM
You have formatting to fix and some arm failures to look into.
Done. |
arg4 = arg4; | ||
} | ||
} | ||
} |
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.
Sorry for the late review, but GitHub_XYZ refers to the dotnet/coreclr repo, so this should have been named Runtime_69659. Also it would be nice to name the class something like Runtime_69659
, it makes it easier to track the test down on failures.
It seems there are a few tests incorrectly filed under GitHub_XYZ tag, so maybe something to consider cleaning up as part of a future change.
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.
so this should have been named Runtime_69659
Ah, didn't realize that. I named them _1
and _2
because there were 2 separate issues that were filed in #69659. I think I forgot to have the right class name in one of those files.
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.
Ah sorry, Runtime_69569_1
etc. sounds right then.
Fixes 2 issues from the dead code elimination changes earlier.
This one was happening because we detect certain block is dead and remove the code inside it, but sometimes might decide to not delete the block itself. In those cases, we need to still make sure that we update liveness of variables. In #69421, I was only updating the liveness if we deleted the actual blocks.
The fix is to take into account if any block was unreachable and if yes, update the liveness info.
This one was interesting. We have chain of try-finally that looks like this. During dead block elimination, we eliminate
BB08
andBB09
. However, we fail to detect thatBB11
could be eliminated as well because the only block that reachesBB11
isBB09
. Going forward, we add labels togenMarkLabelsForCodegen
and since no block is jumping toBB11
, we do not add label to it, do not generate a dedicated IG for it and hence do not havebbEmitCookie
.The fix was to check if we made any reachable blocks dead and if yes, do another iteration. We would restrict the number of iterations to 3.
Fixes: #69659