Implement __assume for non-windows builds #8544
Labels
area-PAL-coreclr
enhancement
Product code improvement that does NOT require public API changes/additions
help wanted
[up-for-grabs] Good issue for external contributors
os-freebsd
FreeBSD OS
os-linux
Linux OS (any supported distro)
os-mac-os-x
macOS aka OSX
tenet-performance
Performance related issue
Milestone
MethodTable::GetManagedClassObjectIfExists()
usesCOMPILER_ASSUME
to help the native compiler avoid a null check and branch in the common case.COMPILER_ASSUME
expands to__assume
but the latter is defined in pal.h as(void)0
when not compiling with MSVC. Seems like we ought to be able try clang's__builtin_assume
here and get similar benefits.MethodTable::GetManagedClassObjectIfExists()
is fairly hot since it is called in the fast path ofObject.GetType()
.If this works in Clang as it does in MSVC, it should give a small improvement in the performance of
Object.GetType()
, as in the attached program.The text was updated successfully, but these errors were encountered: