[asan] Fix invalid debug info for promotable allocas
authorKuba Brecka <kuba.brecka@gmail.com>
Fri, 17 Jul 2015 06:29:57 +0000 (06:29 +0000)
committerKuba Brecka <kuba.brecka@gmail.com>
Fri, 17 Jul 2015 06:29:57 +0000 (06:29 +0000)
commitd71b7d01e806e32d0e819bc7c03596bd014062f1
treee87c83ab7fb599e40c396d9a2dfc3058d36989da
parentac018543f82e1772d75ce81eaf8fb7c1fd472a7f
[asan] Fix invalid debug info for promotable allocas

Since r230724 ("Skip promotable allocas to improve performance at -O0"), there is a regression in the generated debug info for those non-instrumented variables. When inspecting such a variable's value in LLDB, you often get garbage instead of the actual value. ASan instrumentation is inserted before the creation of the non-instrumented alloca. The only allocas that are considered standard stack variables are the ones declared in the first basic-block, but the initial instrumentation setup in the function breaks that invariant.

This patch makes sure uninstrumented allocas stay in the first BB.

Differential Revision: http://reviews.llvm.org/D11179

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242510 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Instrumentation/AddressSanitizer.cpp
test/Instrumentation/AddressSanitizer/debug_info_noninstrumented_alloca.ll [new file with mode: 0644]