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

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 11 23:55:40 PST 2022


dvyukov added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp:274
 
+static bool hasUseAfterReturnUnsafeUses(Value &V) {
+  for (User *U : V.users()) {
----------------
dvyukov wrote:
> I was looking at isSafeAndProfitableToSinkLoad:
> https://github.com/llvm/llvm-project/blob/881076cde29699ef2a458c9d957ebcd49ded8893/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp#L621
> 
> and isAllocaPromotable:
> https://github.com/llvm/llvm-project/blob/af4e856fa71c6b5086aeda79bfcd954e98cef591/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp#L63
Btw, isSafeAndProfitableToSinkLoad is broken. All allocas now sink to lifetime intrinsics. So it will conclude all allocas are address-taken. This immediately popped up in our end-to-end C++ tests, but wasn't detected by the InstCombine bitcode tests.


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