[llvm-branch-commits] [llvm] [compiler-rt] [asan] isInterestingAlloca: remove the isAllocaPromotable condition (PR #77221)

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Jan 6 20:47:28 PST 2024


https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/77221

Commit 8ed1d8196bef89c3099be4ce4aa65f613ab819cc made an AllocaInst
interesting only if
`!ClSkipPromotableAllocas || !isAllocaPromotable(&AI)`, which greatly
removed memory operand instrumention for -O0. However, this optimization
is subsumed by StackSafetyAnalysis and therefore unnecessary when we
enable StackSafetyAnalysis by default.

Actually, having the `!ClSkipPromotableAllocas || !isAllocaPromotable(&AI)`
condition before `!(SSGI && SSGI->isSafe(AI)))` has an interesting false
positive involving MemIntrinsic (see `hoist-argument-init-insts.ll`):

* `isInterestingAlloca` is transitively called by
  `getInterestingMemoryOperands` and `FunctionStackPoisoner`.
* If `getInterestingMemoryOperands` never calls
  `StackSafetyGlobalInfo::getInfo`, and a MemIntrinsic is converted to
  `__asan_memcpy` by `instrumentMemIntrinsic`, when
  `StackSafetyGlobalInfo::getInfo` is called, StackSafetyAnalysis will
  consider `__asan_memcpy` as unsafe, leading to an unnecessary
  alloca instrumentation





More information about the llvm-branch-commits mailing list