-
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
Jit doesn't always eliminate identical checks #11909
Comments
From dotnet/coreclr#22297 class Program
{
static void Main() { Positive1(42); Positive2(42); }
[MethodImpl(MethodImplOptions.NoInlining)]
private static bool Positive1(int? i) => i.HasValue && i.Value > 0;
} G_M60389_IG02:
movzx rax, byte ptr [rsp+30H]
test eax, eax
je SHORT G_M60389_IG05 ; should eliminate one below?
test eax, eax
je SHORT G_M60389_IG07 ; should be eliminated? |
Probably not going to get fixed in 3.0, but let me take a look first. |
For Wondering how well a simple demand driven walk back up the dominator tree would do for things like this.... if a dom pred ends in a JTRUE and its compare node value numbers the same, we should be able to deduce the outcome of the dominated compare. Then we wouldn't be so reliant on assertion prop trying to guess which facts were interesting. Not likely to get to this in 3.0, but might not be all that hard. |
For a relop, walk up the dominator tree to see if any dominating block has a similar compare. If so, and there's just one path from that block to the relop, the relop's value is known. Closes dotnet#11909.
For a relop, walk up the dominator tree to see if any dominating block has a similar compare. If so, and there's just one path from that block to the relop, the relop's value is known. Closes #11909.
Double check is via outer method (first) and then inlined method (second, Span .ctor)
Seen in dotnet/coreclr#22207 (comment)
/cc @AndyAyersMS
category:cq
theme:basic-cq
skill-level:expert
cost:medium
The text was updated successfully, but these errors were encountered: