JIT: Missed flag re-use over fall-through blocks
- 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
Assessment
This issue has not been assessed yet.