[all-commits] [llvm/llvm-project] fea067: [mem2reg] Remove dbg.values describing contents of...

Orlando Cazalet-Hyams via All-commits all-commits at lists.llvm.org
Fri Oct 23 02:01:22 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: fea067bdfde430a74de077f1f61ef1f8a43d9c30
      https://github.com/llvm/llvm-project/commit/fea067bdfde430a74de077f1f61ef1f8a43d9c30
  Author: OCHyams <orlando.hyams at sony.com>
  Date:   2020-10-23 (Fri, 23 Oct 2020)

  Changed paths:
    M llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
    A llvm/test/DebugInfo/Generic/mem2reg-promote-alloca-1.ll
    A llvm/test/DebugInfo/Generic/mem2reg-promote-alloca-2.ll
    A llvm/test/DebugInfo/Generic/mem2reg-promote-alloca-3.ll

  Log Message:
  -----------
  [mem2reg] Remove dbg.values describing contents of dead allocas

This patch copies @vsk's fix to instcombine from D85555 over to mem2reg. The
motivation and rationale are exactly the same: When mem2reg removes an alloca,
it erases the dbg.{addr,declare} instructions which refer to the alloca. It
would be better to instead remove all debug intrinsics which describe the
contents of the dead alloca, namely all dbg.value(<dead alloca>, ...,
DW_OP_deref)'s.

As far as I can tell, prior to D80264 these `dbg.value+deref`s would have been
silently dropped instead of being made `undef`, so we're just returning to
previous behaviour with these patches.

Testing:
`llvm-lit llvm/test` and `ninja check-clang` gave no unexpected failures. Added
3 tests, each of which covers a dbg.value deletion path in mem2reg:
  mem2reg-promote-alloca-1.ll
  mem2reg-promote-alloca-2.ll
  mem2reg-promote-alloca-3.ll
The first is based on the dexter test inlining.c from D89543. This patch also
improves the debugging experience for loop.c from D89543, which suffers
similarly after arg promotion instead of inlining.




More information about the All-commits mailing list