[all-commits] [llvm/llvm-project] 8e77b3: [Local] Do not move around dbg.declares during rep...

Vedant Kumar via All-commits all-commits at lists.llvm.org
Thu Feb 13 14:35:08 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 8e77b33b3c67aa8f2580671b019eeb3862651ecb
      https://github.com/llvm/llvm-project/commit/8e77b33b3c67aa8f2580671b019eeb3862651ecb
  Author: Vedant Kumar <vsk at apple.com>
  Date:   2020-02-13 (Thu, 13 Feb 2020)

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

  Log Message:
  -----------
  [Local] Do not move around dbg.declares during replaceDbgDeclare

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

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




More information about the All-commits mailing list