Example:
public int Test1(char format) =>
format switch
{
'A' => 1,
'B' => 2,
'C' => 3,
'D' => 4,
_ => 0,
};
public int Test2() => Test1('B');
Codegen for Test2:
mov edx, 66
jmp ConsoleApp26.Program:Test1(ushort):int:this
; Total bytes of code: 10
Currently it's failed to inline into Test2:
INLINER: during 'fgInline' result 'failed this callee' reason 'has switch'
I guess it's tricky for the importer, but at least we could import it as a single JTRUE block when we pass a constant at the callsite (and that arg feeds that switch).
/cc @AndyAyersMS
Example:
Codegen for
Test2:Currently it's failed to inline into
Test2:I guess it's tricky for the importer, but at least we could import it as a single JTRUE block when we pass a constant at the callsite (and that arg feeds that switch).
/cc @AndyAyersMS