[llvm-dev] Obtaining the origin function for a local var after inlining

Alexander Potapenko via llvm-dev llvm-dev at lists.llvm.org
Mon Sep 17 06:59:59 PDT 2018


(I think I've asked a similar question off-list a couple of times, but
never got an answer)

Hi folks,

For [K]MSAN we need to figure out which inlined function a local var
originally belonged to in the source file.
E.g. when a local buffer %buf is declared in @bar(), but @bar() is
inlined into @foo(), then there's a local %buf.i in @foo(), but we
need to determine that the local came from @bar(). In the case of
nested inline functions we need the deepest one.

Is there any existing code for that? If not, which debug info
constructs do we need to look up to get this information?

https://llvm.org/docs/SourceLevelDebugging.html mentions
@llvm.dbg.addr as the source of information about a local var, but the
ToT Clang doesn't emit it. There're calls to @llvm.debug.declare in
the IR, but it's said to be deprecated, so I'm not sure if it's ok to
use it.

Thanks in advance,
-- 
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg


More information about the llvm-dev mailing list