[HWASan] do not replace lifetime intrinsics with tagged address.
authorFlorian Mayer <fmayer@google.com>
Thu, 10 Mar 2022 23:17:26 +0000 (15:17 -0800)
committerFlorian Mayer <fmayer@google.com>
Fri, 18 Mar 2022 16:45:05 +0000 (09:45 -0700)
commit208b923e74feeb986fe5114ca39a74b1d2032ed7
treec6bfc13c40e2bdf003259ff0169668acb19b446c
parentf5fea45d09e5bae2f141195d05cfcb055914b63f
[HWASan] do not replace lifetime intrinsics with tagged address.

Quote from the LLVM Language Reference
  If ptr is a stack-allocated object and it points to the first byte of the
  object, the object is initially marked as dead. ptr is conservatively
  considered as a non-stack-allocated object if the stack coloring algorithm
  that is used in the optimization pipeline cannot conclude that ptr is a
  stack-allocated object.

By replacing the alloca pointer with the tagged address before this change,
we confused the stack coloring algorithm.

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D121835
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
llvm/test/Instrumentation/HWAddressSanitizer/exception-lifetime.ll
llvm/test/Instrumentation/HWAddressSanitizer/stack-coloring.ll [new file with mode: 0644]
llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope.ll