Closed
Description
Repro code:
public static void Test(ref byte theRef, byte b) {
if (theRef == b)
{
Console.WriteLine("Hi!");
}
}
Actual codegen:
; Test(Byte ByRef, Byte)
L0000: movzx ecx, byte [rcx]
L0003: movzx eax, dl
L0006: cmp ecx, eax
L0008: jnz L0024
L000a: mov rcx, 0x282bd891e88
L0014: mov rcx, [rcx]
L0017: mov rax, 0x7ffac922d5e8
L0021: jmp rax
L0024: ret
Expected behavior:
I would expect those first three instructions to be combined into a single cmp byte ptr [rcx], dl
instruction.
category:cq
theme:codegen
skill-level:intermediate
cost:medium