[PATCH] D74517: [Local] Do not move around dbg.declares during replaceDbgDeclare

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 12 16:58:33 PST 2020


vsk created this revision.
vsk added reviewers: aprantl, rnk, eugenis.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

replaceDbgDeclare is used to update the descriptions of stack variables
when they are moved (e.g. by ASan or SafeStack). A side effect of
replaceDbgDeclare is that it moves dbg.declares around in the
instruction stream (typically by hoisting them into the entry block).
This behavior was introduced in llvm/r227544 to fix an assertion failure
(llvm.org/PR22386), but no longer appears to be necessary.

Hoisting a dbg.declare generally does not create problems. Usually,
dbg.declare either describes an argument or an alloca in the entry
block, and backends have special handling to emit locations for these.
In optimized builds, LowerDbgDeclare places dbg.values in the right
spots regardless of where the dbg.declare is. And no one uses
replaceDbgDeclare to handle things like VLAs.

However, there doesn't seem to be a positive case for moving
dbg.declares around anymore, and this reordering can get in the way of
understanding other bugs. I propose getting rid of it.

Testing: stage2 RelWithDebInfo sanitized build, check-llvm

rdar://59397340


https://reviews.llvm.org/D74517

Files:
  llvm/include/llvm/Transforms/Utils/Local.h
  llvm/lib/CodeGen/SafeStack.cpp
  llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
  llvm/lib/Transforms/Utils/InlineFunction.cpp
  llvm/lib/Transforms/Utils/Local.cpp
  llvm/test/Instrumentation/AddressSanitizer/debug_info.ll
  llvm/test/Instrumentation/AddressSanitizer/local_stack_base.ll
  llvm/test/Transforms/Inline/alloca-dbgdeclare-merge.ll
  llvm/test/Transforms/Inline/alloca-dbgdeclare.ll
  llvm/test/Transforms/Inline/inline_dbg_declare.ll
  llvm/unittests/Transforms/Utils/LocalTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74517.244305.patch
Type: text/x-patch
Size: 12266 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200213/068e8a2e/attachment.bin>


More information about the llvm-commits mailing list