[PATCH] D112098: [ASan] Added stack safety support in address sanitizer.

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 3 17:39:41 PDT 2021


vitalybuka accepted this revision.
vitalybuka added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:1511
 
+  if (ClUseStackSafety && SSGI != nullptr && findAllocaForValue(Ptr) &&
+      SSGI->stackAccessIsSafe(*Inst))
----------------
check is not needed, we SSGI should be already null in this case


================
Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:1499-1502
+  if (ClUseStackSafety && findAllocaForValue(Ptr)) {
+    if (SSI && SSI->stackAccessIsSafe(*Inst)) {
+      return true;
+    }
----------------
fmayer wrote:
> Doesn't need nested if.
> 
> I would order this as ClUseStackSafety && SSI && findAllocaForValue(Ptr) && ... (cheapest first).
findAllocaForValue is DFS (expensive), stackAccessIsSafe is hash table lookup (cheep)
so I would recommend to switch them


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112098



More information about the llvm-commits mailing list