[all-commits] [llvm/llvm-project] 1d712c: [DebugInfo][InstrRef] Don't generate redundant DBG...

Jeremy Morse via All-commits all-commits at lists.llvm.org
Tue May 3 01:56:30 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1d712c381819498940ee592b670a81eb0f762f7d
  Author: Jeremy Morse <jeremy.morse at sony.com>
  Date:   2022-05-03 (Tue, 03 May 2022)

  Changed paths:
    M llvm/include/llvm/CodeGen/MachineFunction.h
    M llvm/lib/CodeGen/MachineFunction.cpp
    M llvm/test/DebugInfo/X86/dbg-value-funcarg.ll
    A llvm/test/DebugInfo/X86/dbg-value-funcarg4.ll
    M llvm/test/DebugInfo/X86/instr-ref-selectiondag.ll

  Log Message:
  [DebugInfo][InstrRef] Don't generate redundant DBG_PHIs

In SelectionDAG, DBG_PHI instructions are created to "read" physreg values
and give them an instruction number, when they can't be traced back to a
defining instruction. The most common scenario if arguments to a function.
Unfortunately, if you have 100 inlined methods, each of which has the same
"this" pointer, then the 100 dbg.value instructions become 100
DBG_INSTR_REFs plus 100 DBG_PHIs, where only one DBG_PHI would suffice.

This patch adds a vreg cache for MachienFunction::salvageCopySSA, if we've
already traced a value back to the start of a block and created a DBG_PHI
then it allows us to re-use the DBG_PHI, as well as reducing work.

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

More information about the All-commits mailing list