[PATCH] D139811: sanmd: improve precision of UAR analysis

Marco Elver via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 12 02:21:08 PST 2022


melver added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp:280-293
+    if (isa<LoadInst>(U))
+      continue;
+    if (auto *SI = dyn_cast<StoreInst>(U)) {
+      // If storing TO the alloca, then the address isn't taken.
+      if (SI->getOperand(1) == &V)
+        continue;
+    }
----------------
dvyukov wrote:
> melver wrote:
> > LoadInst, StoreInst, GetElementPtrInst and BitCastInst all are derived from Instruction, so these checks can be moved in the 'if (... dyn_cast<Instruction>' branch.
> Can users be a non-instruction?
> I assumed that I need a cast to Instruction just to get access to its methods.
Yes, all I'm suggesting is a small optimization, because the additional casts to *Inst will fail if the cast to Instruction above failed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139811



More information about the llvm-commits mailing list