Open
Description
A simplified repro of what I saw in a real code:
void Test(int a)
{
if (a >= 100)
{
if (a <= 100)
{
Console.WriteLine(a);
}
}
}
Current codegen:
; Method Prog:Test(int):this (FullOpts)
G_M36082_IG01:
sub rsp, 40
G_M36082_IG02:
cmp edx, 100
jl SHORT G_M36082_IG04
G_M36082_IG03:
cmp edx, 100
jg SHORT G_M36082_IG04
mov ecx, edx
call [System.Console:WriteLine(int)]
G_M36082_IG04:
nop
G_M36082_IG05:
add rsp, 40
ret
; Total bytes of code: 28
Expected codegen:
; Method Prog:Test(int):this (FullOpts)
G_M36082_IG01:
sub rsp, 40
G_M36082_IG02:
cmp edx, 100
jne SHORT G_M36082_IG04
G_M36082_IG03:
mov ecx, 100
call [System.Console:WriteLine(int)]
G_M36082_IG04:
nop
G_M36082_IG05:
add rsp, 40
ret
; Total bytes of code: 26