diff options
author | Vedant Kumar <vsk@apple.com> | 2020-02-10 16:22:27 -0800 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2020-02-12 11:24:02 -0800 |
commit | 34d9f93977fb33e45f9ac09d0a12f41254ef8845 (patch) | |
tree | c77398bb3589c1bc9e187952e677f5a8cccc4db5 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 32aac2563763ca14732c06080242a8fdcff6643e (diff) | |
download | llvm-34d9f93977fb33e45f9ac09d0a12f41254ef8845.zip llvm-34d9f93977fb33e45f9ac09d0a12f41254ef8845.tar.gz llvm-34d9f93977fb33e45f9ac09d0a12f41254ef8845.tar.bz2 |
[AddressSanitizer] Ensure only AllocaInst is passed to dbg.declare
Various parts of the LLVM code generator assume that the address
argument of a dbg.declare is not a `ptrtoint`-of-alloca. ASan breaks
this assumption, and this results in local variables sometimes being
unavailable at -O0.
GlobalISel, SelectionDAG, and FastISel all do not appear to expect
dbg.declares to have a `ptrtoint` as an operand. This means that they do
not place entry block allocas in the usual side table reserved for local
variables available in the whole function scope. This isn't always a
problem, as LLVM can try to lower the dbg.declare to a DBG_VALUE, but
those DBG_VALUEs can get dropped for all the usual reasons DBG_VALUEs
get dropped. In the ObjC test case I'm looking at, the cause happens to
be that `replaceDbgDeclare` has hoisted dbg.declares into the entry
block, causing LiveDebugValues to "kill" the DBG_VALUEs because the
lexical dominance check fails.
To address this, I propose:
1) Have ASan (always) pass an alloca to dbg.declares (this patch). This
is a narrow bugfix for -O0 debugging.
2) Make replaceDbgDeclare not move dbg.declares around. This should be a
generic improvement for optimized debug info, as it would prevent the
lexical dominance check in LiveDebugValues from killing as many
variables.
This means reverting llvm/r227544, which fixed an assertion failure
(llvm.org/PR22386) but no longer seems to be necessary. I was able to
complete a stage2 build with the revert in place.
rdar://54688991
Differential Revision: https://reviews.llvm.org/D74369
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
0 files changed, 0 insertions, 0 deletions