BinaryPrimitives endianness-specific methods contain confusing branches #74892
-
See the original bug report in the ILSpy repository: icsharpcode/ILSpy#3166 It looks like some branch optimization was only done halfway or is there any specific reason why the method call in the else branch was removed?
The IL in question contains a branch instruction with a relative target-offset of 0, which basically means "don't jump at all", so ILSpy is decompiling/displaying the code correctly.
The generated code contains 3 method calls, as expected. Would like to know if this should be reported as a bug or if there is a different explanation for this behavior. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
No, it's for JIT.
IL is expected to contain calls and branches around intrinsic functions. They will be constant folded by JIT. You should view JIT asm in sharplab. There's only one branch for range checking in this case. |
Beta Was this translation helpful? Give feedback.
No, it's for JIT.
[Intrinsic]
is for JIT and roslyn know nothing about it.In fact, roslyn can't even see the
[Intrinsic]
or[MethodImplOptions.AggressiveInlining]
attributes since they are only present in implementation, not the reference assembly.IL is expected to contain calls and branches around intrinsic functions. They will be constant folded by JIT.
You should view JIT asm in sharplab. There's only one branch for range checking in this case.