This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] SizeClassMap minor improvement/correctness changes
ClosedPublic

Authored by cryptoad on Feb 5 2018, 10:20 AM.

Details

Summary

In ClassID, make sure we use an unsigned as based for the lbits shift.
The previous code resulted in spurious sign extensions like for x64:

add     esi, 0FFFFFFFFh
movsxd  rcx, esi
and     rcx, r15

The code with the U added is:

add     esi, 0FFFFFFFFh
and     rsi, r15

And for MaxCachedHint, use a 32-bit division instead of 64-bit, which is
faster (https://lemire.me/blog/2017/11/16/fast-exact-integer-divisions-using-floating-point-operations/)
and already used in other parts of the code (64-bit GetChunkIdx, 32-bit
GetMetaData enforce 32-bit divisions)

Not major performance gains by any mean, but they don't hurt.

Event Timeline

cryptoad created this revision.Feb 5 2018, 10:20 AM
Herald added subscribers: Restricted Project, delcypher, kubamracek. · View Herald TranscriptFeb 5 2018, 10:20 AM
alekseyshl accepted this revision.Feb 5 2018, 11:23 AM
This revision is now accepted and ready to land.Feb 5 2018, 11:23 AM
This revision was automatically updated to reflect the committed changes.
This revision was automatically updated to reflect the committed changes.