-
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
Dead code not eliminated after constant folding/propagation #57033
Comments
During constant prop the jit doesn't clear the exception flag (
Should be an easy fix. |
FWIW, I've bumped into the exact same problem before: #50450 (comment), and also found no diffs doing the "easy" fix. What we'd like to do in these situations is use exception sets, but we cannot because they do not model all exceptions today (canonical example is the lack of |
For divide at least the operator side effects are modelled. Wondering if we should consider modelling all the possible effects or consider what it would mean to have some generalized exception VN to model the all exceptions we don't specifically track -- I suppose for the latter we might have a lot of unique exception VNs running around since it might be hard to deduce when two different bits of IR could produce the same set of unmodelled exceptions. |
FWIW, we now model all exception sets precisely, modulo those coming from calls (both helper and user). Once that's fixed, we can start using them a bit more liberally. There is also the possibility of a more low-tech solution, say enhancing the VN-based constant propagation to clear the exception bits with some kind of |
Closed via #78630 |
This example is a derivative of one from wikipedia:
The JIT successfully reduces the entire operation to
mov eax, 4
, but it leaves behind multiple computations that would seem to no longer be necessary:Is there some kind of side effect it's relying on from all the earlier gunk, or should it be removing the mov, mov, xor, idiv and just isn't? Note that if I tweak the C# to make
int a = 30
beconst int a = 30
, then all the extra operations go away as expected.category:cq
theme:value-numbering
skill-level:expert
cost:medium
impact:medium
The text was updated successfully, but these errors were encountered: