[PATCH] D92689: [scudo][standalone] Small changes to the fastpath

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 4 14:08:16 PST 2020


cryptoad created this revision.
cryptoad added reviewers: cferris, hctim, pcc, eugenis.
cryptoad requested review of this revision.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.

There are a few things that I wanted to reorganize for a while:

- the loop that incrementally goes through classes on failure looked horrible in assembly, mostly because of `LIKELY`/`UNLIKELY` within the loop. So remove those, we are already in an unlikely scenario
- hooks are not used by default on Android/Fuchsia/etc so mark the tests for the existence of the weak functions as unlikely
- mark of couple of conditions as likely/unlikely
- in `reallocate`, the old size was computed again while we already have it in a variable. So just use the one we have.
- remove the bitwise AND trick and use a logical AND, that has one less test by using a purposeful underflow when `Size` is 0 (I actually looked at the assembly of the previous code to steal that trick)
- move the read of the options closer to where they are used, mark them as `const`

Overall this makes things a tiny bit faster, but cleaner.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92689

Files:
  compiler-rt/lib/scudo/standalone/combined.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92689.309648.patch
Type: text/x-patch
Size: 4819 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201204/8c003239/attachment.bin>


More information about the llvm-commits mailing list