ASAN: Provide reliable debug info for local variables at -O0.

The function stack poisioner conditionally stores local variables
either in an alloca or in malloc'ated memory, which has the
unfortunate side-effect, that the actual address of the variable is
only materialized when the variable is accessed, which means that
those variables are mostly invisible to the debugger even when
compiling without optimizations.

This patch stores the address of the local stack base into an alloca,
which can be referred to by the debug info and is available throughout
the function. This adds one extra pointer-sized alloca to each stack
frame (but mem2reg can optimize it away again when optimizations are
enabled, yielding roughly the same debug info quality as before in
optimized code).

rdar://problem/30433661

Differential Revision: https://reviews.llvm.org/D41034

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320415 91177308-0d34-0410-b5e6-96231b3b80d8
(cherry picked from commit af6ca7789cd09ba45df03ce0263625e7ee3609b2)
6 files changed