dotnet / dotnet/runtime

JIT: Missed flag re-use over fall-through blocks

Open
#128,535 1 comment 0 reactions 1 assignee Claimed by @BoyBaykiller View on GitHub
area-CodeGen-coreclr
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

https://godbolt.org/z/TMz45r84d
```cs
static bool MissedReuseCmp(int ch, int op2)
{
if (ch <= op2)
{
if (ch != op2)
{
Console.WriteLine("Hi!");
return false;
}
return true;
}
return false;
}
```
```assembly
Program:MissedReuseCmp(int,int):bool (FullOpts):
push rbp
mov rbp, rsp
cmp edi, esi
jg SHORT G_M12322_IG06
cmp edi, esi ; <- can be removed
jne SHORT G_M12322_IG05
mov eax, 1
pop rbp
ret
G_M12322_IG05: ;; offset=0x0013
mov rdi, 0x765570A025E8 ; 'Hi!'
call [System.Console:WriteLine(System.String)]
G_M12322_IG06: ;; offset=0x0023
xor eax, eax
pop rbp
ret
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.