[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:45:48 PST 2020


cryptoad added inline comments.


================
Comment at: compiler-rt/lib/scudo/standalone/combined.h:1053
     const bool BypassQuarantine =
-        !Quarantine.getCacheSize() | !Size | (Size > QuarantineMaxChunkSize);
+        !Quarantine.getCacheSize() || ((Size - 1) > QuarantineMaxChunkSize);
     if (BypassQuarantine) {
----------------
pcc wrote:
> Isn't this changing the condition? i.e. it should be `Size - 1 > QuarantineMaxChunkSize - 1` now.
> 
> Does the assembly still look bad if we just have logical OR here with the original clauses?
Right, thank you! It should be `(Size - 1) >= QuarantineMaxChunkSize.`
With the logical OR, we get 3 comparisons and conditional jumps, with the bitwise OR we get 2, as the compiler folds the last 2 into the one, via the trick used here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92689/new/

https://reviews.llvm.org/D92689



More information about the llvm-commits mailing list