[compiler-rt] [scudo] Split the code paths which enable memory tagging (PR #83493)

Christopher Ferris via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 21 20:23:39 PDT 2024


================
@@ -1162,31 +1215,23 @@ class Allocator {
       Header->State = Chunk::State::Available;
     else
       Header->State = Chunk::State::Quarantined;
-    Header->OriginOrWasZeroed = useMemoryTagging<Config>(Options) &&
-                                Header->ClassId &&
-                                !TSDRegistry.getDisableMemInit();
-    Chunk::storeHeader(Cookie, Ptr, Header);
 
+    void *BlockBegin;
     if (UNLIKELY(useMemoryTagging<Config>(Options))) {
----------------
cferris1000 wrote:

Would it make sense to reverse the if and else clauses and check LIKELY(!useMemoryTagging...)?

It's a bit easier to read if the likely choice is first.

https://github.com/llvm/llvm-project/pull/83493


More information about the llvm-commits mailing list